use of com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode in project intellij-community by JetBrains.
the class StudyTreeStructureProvider method modify.
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
Project project = parent.getProject();
if (project == null || !shouldModify(project)) {
return children;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return children;
}
Collection<AbstractTreeNode> modifiedNodes = new ArrayList<>();
for (AbstractTreeNode node : children) {
if (parent instanceof ProjectViewProjectNode && node instanceof PsiDirectoryNode) {
modifiedNodes.add(createCourseNode(project, node, settings, course));
continue;
}
if (parent instanceof StudyDirectoryNode) {
AbstractTreeNode modifiedNode = ((StudyDirectoryNode) parent).modifyChildNode(node);
if (modifiedNode != null) {
modifiedNodes.add(modifiedNode);
}
}
}
return modifiedNodes;
}
use of com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode in project android by JetBrains.
the class ModuleNodeIconDecorator method decorate.
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode) node;
PsiDirectory psiDirectory = psiDirectoryNode.getValue();
assert psiDirectory != null;
Project project = psiDirectory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
VirtualFile folder = psiDirectory.getVirtualFile();
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module != null) {
if (isModuleDir(module, folder)) {
data.setIcon(getModuleIcon(module));
} else if (isSourceRoot(folder, project)) {
TestArtifactSearchScopes testScopes = TestArtifactSearchScopes.get(module);
if (testScopes != null && testScopes.isAndroidTestSource(folder)) {
data.setIcon(AndroidIcons.AndroidTestRoot);
}
}
}
}
use of com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode in project intellij-plugins by JetBrains.
the class DartNodeDecorator method decorate.
@Override
public void decorate(@NotNull final ProjectViewNode node, @NotNull final PresentationData presentation) {
if (node instanceof PsiFileNode || node instanceof PsiDirectoryNode) {
final VirtualFile nodeFile = node.getVirtualFile();
final Project project = node.getProject();
if (nodeFile != null && project != null && DartAnalysisServerService.getInstance(project).isFileWithErrors(nodeFile)) {
presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES);
}
}
}
use of com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode in project android by JetBrains.
the class AndroidSourceTypeNode method annotateWithSourceProvider.
private Collection<AbstractTreeNode> annotateWithSourceProvider(Collection<AbstractTreeNode> directoryChildren) {
List<AbstractTreeNode> children = Lists.newArrayListWithExpectedSize(directoryChildren.size());
for (AbstractTreeNode child : directoryChildren) {
if (child instanceof PsiDirectoryNode) {
PsiDirectory directory = ((PsiDirectoryNode) child).getValue();
children.add(new AndroidPsiDirectoryNode(myProject, directory, getSettings(), findSourceProvider(directory.getVirtualFile())));
} else if (child instanceof PsiFileNode) {
PsiFile file = ((PsiFileNode) child).getValue();
children.add(new AndroidPsiFileNode(myProject, file, getSettings(), findSourceProvider(file.getVirtualFile())));
} else {
children.add(child);
}
}
return children;
}
use of com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode in project android by JetBrains.
the class ResourceMergerTreeStructureProvider method modify.
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
if (!ApplicationManager.getApplication().isInternal()) {
return children;
}
if (parent instanceof PsiDirectoryNode) {
PsiDirectory directory = ((PsiDirectoryNode) parent).getValue();
if (!directory.getName().equals("res")) {
return children;
}
Module module = ModuleUtil.findModuleForPsiElement(directory);
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return children;
}
return mergeResourceDirectories(children, settings);
}
return children;
}
Aggregations