From 70071f1fd5d032f96d9f547e257738571fd0beaa Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 10 Oct 2017 18:40:19 +0300 Subject: [PATCH] convenience factory method --- .../intellij/openapi/project/DumbAwareAction.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 a28df9ebb7d2..9093a7aff3f5 100644 --- a/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java +++ b/platform/platform-api/src/com/intellij/openapi/project/DumbAwareAction.java @@ -17,6 +17,9 @@ package com.intellij.openapi.project; import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.util.Consumer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -25,6 +28,18 @@ import javax.swing.*; * @author nik */ public abstract class DumbAwareAction extends AnAction implements DumbAware { + + @NotNull + public static DumbAwareAction create(@NotNull Consumer actionPerformed) { + return new DumbAwareAction() { + @Override + public void actionPerformed(AnActionEvent e) { + actionPerformed.consume(e); + } + }; + } + + protected DumbAwareAction() { }