diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java index 7db83f57afb1..acea6188ff42 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPSIPane.java @@ -91,26 +91,7 @@ public abstract class AbstractProjectViewPSIPane extends AbstractProjectViewPane DefaultMutableTreeNode node = (DefaultMutableTreeNode)object; object = node.getUserObject(); } - if (object instanceof PsiDirectoryNode && !myTree.isCollapsed(index)) { - object = null; - } - super.update(painter, index, object); - } - - @Override - protected ErrorStripe getErrorStripe(Object object) { - if (object instanceof PresentableNodeDescriptor) { - PresentableNodeDescriptor node = (PresentableNodeDescriptor)object; - PresentationData presentation = node.getPresentation(); - TextAttributesKey key = presentation.getTextAttributesKey(); - if (key != null) { - TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key); - if (attributes != null && EffectType.WAVE_UNDERSCORE == attributes.getEffectType()) { - return ErrorStripe.create(attributes.getEffectColor(), 1); - } - } - } - return null; + super.update(painter, index, getStripe(object, myTree.isExpanded(index))); } }); } @@ -283,6 +264,27 @@ public abstract class AbstractProjectViewPSIPane extends AbstractProjectViewPane protected abstract AbstractTreeUpdater createTreeUpdater(AbstractTreeBuilder treeBuilder); + /** + * @param object an object that represents a node in the project tree + * @param expanded {@code true} if the corresponding node is expanded, + * {@code false} if it is collapsed + * @return a non-null value if the corresponding node should be , or {@code null} + */ + protected ErrorStripe getStripe(Object object, boolean expanded) { + if (expanded && object instanceof PsiDirectoryNode) return null; + if (object instanceof PresentableNodeDescriptor) { + PresentableNodeDescriptor node = (PresentableNodeDescriptor)object; + PresentationData presentation = node.getPresentation(); + TextAttributesKey key = presentation.getTextAttributesKey(); + if (key != null) { + TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key); + if (attributes != null && EffectType.WAVE_UNDERSCORE == attributes.getEffectType()) { + return ErrorStripe.create(attributes.getEffectColor(), 1); + } + } + } + return null; + } protected static final class MySpeedSearch extends TreeSpeedSearch { MySpeedSearch(JTree tree) { diff --git a/platform/platform-impl/src/com/intellij/ui/stripe/Updater.java b/platform/platform-impl/src/com/intellij/ui/stripe/Updater.java index 63f56af89d7a..7d3b63762d97 100644 --- a/platform/platform-impl/src/com/intellij/ui/stripe/Updater.java +++ b/platform/platform-impl/src/com/intellij/ui/stripe/Updater.java @@ -141,7 +141,7 @@ public abstract class Updater implements Dis } protected ErrorStripe getErrorStripe(Object object) { - return null; + return object instanceof ErrorStripe ? (ErrorStripe)object : null; } public final void update() {