mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
convenience factory method
This commit is contained in:
@@ -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<AnActionEvent> actionPerformed) {
|
||||
return new DumbAwareAction() {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
actionPerformed.consume(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
protected DumbAwareAction() {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user