diff --git a/platform/platform-api/api-dump-unreviewed.txt b/platform/platform-api/api-dump-unreviewed.txt index 84b5101ad3d2..b7e2e66e3608 100644 --- a/platform/platform-api/api-dump-unreviewed.txt +++ b/platform/platform-api/api-dump-unreviewed.txt @@ -5872,6 +5872,7 @@ c:com.intellij.ui.EditorNotificationPanel - f:createActionLabel(java.lang.String,java.lang.String):com.intellij.ui.HyperlinkLabel - f:createActionLabel(java.lang.String,java.lang.String,Z):com.intellij.ui.HyperlinkLabel - p:executeAction(java.lang.String):V +- p:executeAction(java.lang.String,javax.swing.event.HyperlinkEvent):V - findLabelByName(java.lang.String):com.intellij.ui.HyperlinkLabel - p:getActionPlace():java.lang.String - getBackground():java.awt.Color diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java index e2b6df40403c..d9971bc8104b 100644 --- a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java +++ b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java @@ -366,7 +366,16 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr public final @NotNull HyperlinkLabel createActionLabel(@NotNull @LinkLabel String text, @NotNull @NonNls String actionId, boolean showInIntentionMenu) { - return createActionLabel(text, () -> executeAction(actionId), showInIntentionMenu); + return createActionLabel(text, new ActionHandler() { + @Override + public void handlePanelActionClick(@NotNull EditorNotificationPanel panel, @NotNull HyperlinkEvent event) { + executeAction(actionId, event); + } + + @Override + public void handleQuickFixClick(@NotNull Editor editor, @NotNull PsiFile psiFile) { + } + }, showInIntentionMenu); } public final @NotNull HyperlinkLabel createActionLabel(@NotNull @LinkLabel String text, @@ -449,6 +458,18 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr } } + protected void executeAction(@NonNls String actionId, @NotNull HyperlinkEvent e) { + AnAction action = ActionManager.getInstance().getAction(actionId); + if (action == null) { + throw new AssertionError("'" + actionId + "' is not an found"); + } + DataContext dataContext = DataManager.getInstance().getDataContext(this); + AnActionEvent event = AnActionEvent.createEvent(dataContext, null, getActionPlace(), ActionUiKind.TOOLBAR, e.getInputEvent()); + if (ActionUtil.lastUpdateAndCheckDumb(action, event, true)) { + ActionUtil.performActionDumbAwareWithCallbacks(action, event); + } + } + protected @NotNull String getActionPlace() { return ActionPlaces.UNKNOWN; }