mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ScopeView: inline method for icon updating
This commit is contained in:
@@ -583,7 +583,17 @@ public final class ScopeViewTreeModel extends BaseTreeModel<AbstractTreeNode> im
|
||||
String title = getTitle();
|
||||
presentation.setPresentableText(title != null ? title : toString());
|
||||
Icon icon = getIcon();
|
||||
presentation.setIcon(icon != null ? icon : getFileIcon(node));
|
||||
if (icon == null && node.isValid()) {
|
||||
VirtualFile file = node.getVirtualFile();
|
||||
if (file.isDirectory()) {
|
||||
AbstractTreeNode parent = getParent();
|
||||
icon = getFolderIcon(node, null, parent == null ? null : parent.getIcon());
|
||||
}
|
||||
else {
|
||||
icon = file.getFileType().getIcon();
|
||||
}
|
||||
}
|
||||
presentation.setIcon(icon);
|
||||
decorate(presentation);
|
||||
}
|
||||
|
||||
@@ -1037,15 +1047,6 @@ public final class ScopeViewTreeModel extends BaseTreeModel<AbstractTreeNode> im
|
||||
return index == null ? null : index.getModuleForFile(file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Icon getFileIcon(@NotNull ProjectFileNode node) {
|
||||
if (!node.isValid()) return null;
|
||||
VirtualFile file = node.getVirtualFile();
|
||||
return file.isDirectory()
|
||||
? getFolderIcon(node, null, null)
|
||||
: file.getFileType().getIcon();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Icon getFolderIcon(@NotNull ProjectFileNode node, @Nullable PsiElement element, @Nullable Icon parent) {
|
||||
if (parent == AllIcons.Nodes.Package) return parent;
|
||||
|
||||
Reference in New Issue
Block a user