use of com.intellij.ide.projectView.impl.nodes.ClassTreeNode in project intellij-community by JetBrains.
the class FormNode method getChildren.
private static Collection<BasePsiNode<? extends PsiElement>> getChildren(final Project project, final Form form, final ViewSettings settings) {
final Set<BasePsiNode<? extends PsiElement>> children = new LinkedHashSet<>();
children.add(new ClassTreeNode(project, form.getClassToBind(), settings));
for (PsiFile formBoundToClass : form.getFormFiles()) {
children.add(new PsiFileNode(project, formBoundToClass, settings));
}
return children;
}
use of com.intellij.ide.projectView.impl.nodes.ClassTreeNode in project intellij-community by JetBrains.
the class TreeJavaClassChooserDialog method getSelectedFromTreeUserObject.
@Override
@Nullable
protected PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) {
Object userObject = node.getUserObject();
if (!(userObject instanceof ClassTreeNode))
return null;
ClassTreeNode descriptor = (ClassTreeNode) userObject;
return descriptor.getPsiClass();
}
use of com.intellij.ide.projectView.impl.nodes.ClassTreeNode in project intellij-community by JetBrains.
the class ClassesTreeStructureProvider method modify.
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
ArrayList<AbstractTreeNode> result = new ArrayList<>();
for (final AbstractTreeNode child : children) {
Object o = child.getValue();
if (o instanceof PsiClassOwner && !(o instanceof ServerPageFile)) {
final ViewSettings settings1 = ((ProjectViewNode) parent).getSettings();
final PsiClassOwner classOwner = (PsiClassOwner) o;
final VirtualFile file = classOwner.getVirtualFile();
if (!(classOwner instanceof PsiCompiledElement)) {
//do not show duplicated items if jar file contains classes and sources
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
if (file != null && fileIndex.isInLibrarySource(file)) {
final PsiElement originalElement = classOwner.getOriginalElement();
if (originalElement instanceof PsiFile) {
PsiFile classFile = (PsiFile) originalElement;
final VirtualFile virtualClassFile = classFile.getVirtualFile();
if (virtualClassFile != null && fileIndex.isInLibraryClasses(virtualClassFile) && !classOwner.getManager().areElementsEquivalent(classOwner, classFile) && classOwner.getManager().areElementsEquivalent(classOwner.getContainingDirectory(), classFile.getContainingDirectory())) {
continue;
}
}
}
}
if (fileInRoots(file)) {
PsiClass[] classes = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass[]>() {
@Override
public PsiClass[] compute() {
try {
return classOwner.getClasses();
} catch (IndexNotReadyException e) {
return PsiClass.EMPTY_ARRAY;
}
}
});
if (classes.length == 1 && !(classes[0] instanceof SyntheticElement) && (file == null || file.getNameWithoutExtension().equals(classes[0].getName()))) {
result.add(new ClassTreeNode(myProject, classes[0], settings1));
} else {
result.add(new PsiClassOwnerTreeNode(classOwner, settings1));
}
continue;
}
}
result.add(child);
}
return result;
}
use of com.intellij.ide.projectView.impl.nodes.ClassTreeNode in project intellij by bazelbuild.
the class BlazeJavaSyncStatusClassNodeDecorator method decorate.
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof ClassTreeNode)) {
return;
}
PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
if (psiClass == null) {
return;
}
PsiFile psiFile = psiClass.getContainingFile();
if (psiFile == null) {
return;
}
VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = node.getProject();
if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
data.clearText();
data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
Aggregations