@Override public boolean shouldHighlightErrorElement(@NotNull PsiErrorElement element) { PsiFile file = element.getContainingFile(); if (file == null) { return true; } VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) { return true; } TaskFile taskFile = StudyUtils.getTaskFile(element.getProject(), virtualFile); return taskFile == null || taskFile.isHighlightErrors(); }
@NotNull @Override public Collection<AbstractTreeNode> modify( @NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) { if (!isCourseBasedProject(parent)) { return children; } Collection<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>(); for (AbstractTreeNode node : children) { final Project project = node.getProject(); if (project != null) { if (node.getValue() instanceof PsiDirectory) { final PsiDirectory nodeValue = (PsiDirectory) node.getValue(); if (!nodeValue.getName().contains(EduNames.USER_TESTS) && !nodeValue.getName().equals(".idea")) { StudyDirectoryNode newNode = new StudyDirectoryNode(project, nodeValue, settings); nodes.add(newNode); } } else { if (parent instanceof StudyDirectoryNode && node instanceof PsiFileNode) { final PsiFileNode psiFileNode = (PsiFileNode) node; final VirtualFile virtualFile = psiFileNode.getVirtualFile(); if (virtualFile == null) { return nodes; } final TaskFile taskFile = StudyUtils.getTaskFile(project, virtualFile); if (taskFile != null) { nodes.add(node); } final String parentName = parent.getName(); if (parentName != null) { if (parentName.equals(EduNames.SANDBOX_DIR)) { nodes.add(node); } } } } } } return nodes; }