RIDER-5008 Solution Explorer: reduce the number of markers for errors

This commit is contained in:
Sergey Malenkov
2017-03-22 21:43:19 +03:00
parent cd20befbf2
commit 229157d52e
2 changed files with 23 additions and 21 deletions
@@ -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) {
@@ -141,7 +141,7 @@ public abstract class Updater<Painter extends ErrorStripePainter> implements Dis
}
protected ErrorStripe getErrorStripe(Object object) {
return null;
return object instanceof ErrorStripe ? (ErrorStripe)object : null;
}
public final void update() {