diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/GutterIconRenderer.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/GutterIconRenderer.java index b4f3dcbc30e8..ad865eae4bed 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/GutterIconRenderer.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/GutterIconRenderer.java @@ -26,10 +26,13 @@ import javax.swing.*; /** * Interface which should be implemented in order to draw icons in the gutter area and handle events * for them. Gutter icons are drawn to the left of the folding area and can be used, for example, - * to mark implemented or overridden methods. + * to mark implemented or overridden methods.

* * Daemon code analyzer checks newly arrived gutter icon renderer against the old one and if they are equal, does not redraw the icon. - * So it is highly advisable to override hashCode()/equals() methods to avoid icon flickering when old gutter renderer gets replaced with the new. + * So it is highly advisable to override hashCode()/equals() methods to avoid icon flickering when old gutter renderer gets replaced with the new.

+ * + * During indexing, click handlers are only invoked for renderers implementing {@link com.intellij.openapi.project.DumbAware}. + * * @author max * @see RangeHighlighter#setGutterIconRenderer(GutterIconRenderer) */ diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 98051d1ef8b2..8cb96e2e8af3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -45,7 +45,7 @@ import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.markup.*; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.IndexNotReadyException; +import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Ref; @@ -1379,31 +1379,32 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } GutterIconRenderer renderer = getGutterRenderer(e); + final Project project = myEditor.getProject(); + if (project != null && DumbService.isDumb(project) && !DumbService.isDumbAware(renderer)) { + DumbService.getInstance(project).showDumbModeNotification("Navigation is not available during indexing"); + return; + } + AnAction clickAction = null; if (renderer != null && e.getButton() < 4) { clickAction = (InputEvent.BUTTON2_MASK & e.getModifiers()) > 0 ? renderer.getMiddleButtonClickAction() : renderer.getClickAction(); } - try { - if (clickAction != null) { - clickAction.actionPerformed(new AnActionEvent(e, myEditor.getDataContext(), "ICON_NAVIGATION", clickAction.getTemplatePresentation(), - ActionManager.getInstance(), - e.getModifiers())); - e.consume(); - repaint(); - } - else { - ActiveGutterRenderer lineRenderer = getActiveRendererByMouseEvent(e); - if (lineRenderer != null) { - lineRenderer.doAction(myEditor, e); - } else { - fireEventToTextAnnotationListeners(e); - } - } + if (clickAction != null) { + clickAction.actionPerformed(new AnActionEvent(e, myEditor.getDataContext(), "ICON_NAVIGATION", clickAction.getTemplatePresentation(), + ActionManager.getInstance(), + e.getModifiers())); + e.consume(); + repaint(); } - catch (IndexNotReadyException e1) { - DumbService.getInstance(myEditor.getProject()).showDumbModeNotification("Navigation is not available during indexing"); + else { + ActiveGutterRenderer lineRenderer = getActiveRendererByMouseEvent(e); + if (lineRenderer != null) { + lineRenderer.doAction(myEditor, e); + } else { + fireEventToTextAnnotationListeners(e); + } } }