From 8cfda8e54241370344bc0c8d311614bf4288355a Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Sat, 9 Jun 2012 18:34:12 +0400 Subject: [PATCH] [merge tool] Don't show the default gutter popup. REASON: * The settings are available from the new gear-button on the toolbar. * The settings can't be possibly available without the gutter (which is probably in the future + if line numbers are hidden). * Default popup contains "show annotate" (not applicable for merge tool), but doesn't contain "use soft wrap" (totally applicable and useful). * Default popup affects only the editor of the selected gutter, but it means no sense to disable, for example, line numbers in one merge editor, but enable it in the other. Changing the behavior of the popup, on the other hand, can confuse the user. DETAILS: * Introduce EditorGutterComponentEx#setShowDefaultGutterPopup and call it when initializing editors. --- .../diff/impl/incrementalMerge/ui/MergePanel2.java | 2 +- .../openapi/editor/ex/EditorGutterComponentEx.java | 2 ++ .../editor/impl/EditorGutterComponentImpl.java | 14 +++++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index 2ebac7c61ddb..a26ad70fd08c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -411,7 +411,7 @@ public class MergePanel2 implements DiffViewer { editor.getSettings().setFoldingOutlineShown(false); editor.getFoldingModel().setFoldingEnabled(false); editor.getSettings().setLineMarkerAreaShown(false); - + editor.getGutterComponentEx().setShowDefaultGutterPopup(false); initEditorSettings(editor); return editor; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java index 1d936db0345e..43090c6dfe42 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorGutterComponentEx.java @@ -56,4 +56,6 @@ public abstract class EditorGutterComponentEx extends JComponent implements Edit public abstract Point getPoint(GutterIconRenderer renderer); public abstract void setLineNumberConvertor(final Convertor lineNumberConvertor); + + public abstract void setShowDefaultGutterPopup(boolean show); } 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 b5403375405b..08d0a0f0d559 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 @@ -91,6 +91,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse private String myLastGutterToolTip = null; private int myLastPreferredHeight = -1; private Convertor myLineNumberConvertor; + private boolean myShowDefaultGutterPopup = true; @SuppressWarnings("unchecked") public EditorGutterComponentImpl(EditorImpl editor) { @@ -1343,6 +1344,11 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse myLineNumberConvertor = lineNumberConvertor; } + @Override + public void setShowDefaultGutterPopup(boolean show) { + myShowDefaultGutterPopup = show; + } + private void invokePopup(MouseEvent e) { final ActionManager actionManager = ActionManager.getInstance(); if (myEditor.getMouseEventArea(e) == EditorMouseEventArea.ANNOTATIONS_AREA) { @@ -1381,9 +1387,11 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } } else { - ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_EDITOR_GUTTER); - ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(ActionPlaces.UNKNOWN, group); - popupMenu.getComponent().show(this, e.getX(), e.getY()); + if (myShowDefaultGutterPopup) { + ActionGroup group = (ActionGroup)CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_EDITOR_GUTTER); + ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(ActionPlaces.UNKNOWN, group); + popupMenu.getComponent().show(this, e.getX(), e.getY()); + } e.consume(); } }