From 37fdcb69ffd64477afdaeb82d663dbc6b1e64dce Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Mon, 7 May 2018 14:26:23 +0300 Subject: [PATCH] always prefer getRightButtonClickAction to allow extra breakpoint actions in getPopupMenuActions for IDEA-125463 --- .../editor/markup/GutterIconRenderer.java | 23 +++++++----------- .../impl/EditorGutterComponentImpl.java | 24 +++++++++---------- 2 files changed, 19 insertions(+), 28 deletions(-) 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 4d372b2e6c79..03effba8213c 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 @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.editor.markup; import com.intellij.codeInsight.daemon.GutterMark; @@ -42,6 +28,7 @@ public abstract class GutterIconRenderer implements GutterMark, PossiblyDumbAwar * displayed when the icon is right-clicked. * * @return the group of actions for the context menu, or null if no context menu is required. + * @see #getRightButtonClickAction() */ @Nullable public ActionGroup getPopupMenuActions() { @@ -79,6 +66,12 @@ public abstract class GutterIconRenderer implements GutterMark, PossiblyDumbAwar return null; } + /** + * Returns the action executed when the icon is right-clicked. + * + * @return the action instance, or null to show the popup menu + * @see #getPopupMenuActions() + */ @Nullable public AnAction getRightButtonClickAction() { return null; 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 58b5ee524090..0977feeb843e 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 @@ -1863,22 +1863,20 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse else { GutterIconRenderer renderer = getGutterRenderer(e); if (renderer != null) { - ActionGroup actionGroup = renderer.getPopupMenuActions(); - if (actionGroup != null) { - if (checkDumbAware(actionGroup)) { - ActionPopupMenu popupMenu = actionManager.createActionPopupMenu(ActionPlaces.UNKNOWN, - actionGroup); - popupMenu.getComponent().show(this, e.getX(), e.getY()); - } - else { - notifyNotDumbAware(); - } + AnAction rightButtonAction = renderer.getRightButtonClickAction(); + if (rightButtonAction != null) { + performAction(rightButtonAction, e, "ICON_NAVIGATION_SECONDARY_BUTTON", myEditor.getDataContext()); e.consume(); } else { - AnAction rightButtonAction = renderer.getRightButtonClickAction(); - if (rightButtonAction != null) { - performAction(rightButtonAction, e, "ICON_NAVIGATION_SECONDARY_BUTTON", myEditor.getDataContext()); + ActionGroup actionGroup = renderer.getPopupMenuActions(); + if (actionGroup != null) { + if (checkDumbAware(actionGroup)) { + actionManager.createActionPopupMenu(ActionPlaces.UNKNOWN, actionGroup).getComponent().show(this, e.getX(), e.getY()); + } + else { + notifyNotDumbAware(); + } e.consume(); } }