[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.
This commit is contained in:
Kirill Likhodedov
2012-06-27 15:05:05 +04:00
parent 62ee77a2d3
commit 8cfda8e542
3 changed files with 14 additions and 4 deletions
@@ -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;
@@ -56,4 +56,6 @@ public abstract class EditorGutterComponentEx extends JComponent implements Edit
public abstract Point getPoint(GutterIconRenderer renderer);
public abstract void setLineNumberConvertor(final Convertor<Integer, Integer> lineNumberConvertor);
public abstract void setShowDefaultGutterPopup(boolean show);
}
@@ -91,6 +91,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
private String myLastGutterToolTip = null;
private int myLastPreferredHeight = -1;
private Convertor<Integer, Integer> 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();
}
}