diff --git a/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java b/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java index ce4fdada6cf6..5583029cfc06 100644 --- a/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java +++ b/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java @@ -16,6 +16,7 @@ package com.intellij.openapi.project; +import com.intellij.openapi.actionSystem.ActionWithDelegate; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.util.Consumer; @@ -33,22 +34,12 @@ public abstract class DumbAwareAction extends AnAction implements DumbAware { @NotNull public static DumbAwareAction create(@NotNull Consumer actionPerformed) { - return new DumbAwareAction() { - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - actionPerformed.consume(e); - } - }; + return new SimpleDumbAwareAction(actionPerformed); } @NotNull public static DumbAwareAction create(@Nullable String text, @NotNull Consumer actionPerformed) { - return new DumbAwareAction(text) { - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - actionPerformed.consume(e); - } - }; + return new SimpleDumbAwareAction(text, actionPerformed); } protected DumbAwareAction() { @@ -61,4 +52,28 @@ public abstract class DumbAwareAction extends AnAction implements DumbAware { protected DumbAwareAction(@Nullable String text, @Nullable String description, @Nullable Icon icon) { super(text, description, icon); } + + private static class SimpleDumbAwareAction extends DumbAwareAction implements ActionWithDelegate> { + private final Consumer myActionPerformed; + + private SimpleDumbAwareAction(Consumer actionPerformed) { + myActionPerformed = actionPerformed; + } + + private SimpleDumbAwareAction(String text, Consumer actionPerformed) { + super(text); + myActionPerformed = actionPerformed; + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + myActionPerformed.consume(e); + } + + @NotNull + @Override + public Consumer getDelegate() { + return myActionPerformed; + } + } } \ No newline at end of file