+
+
+
+ * public class MyAction extends AnAction { + * public MyAction() { + * // ... + * } + * + * public void update(AnActionEvent e) { + * Presentation presentation = e.getPresentation(); + * presentation.setVisible(true); + * presentation.setText(e.getPlace()); + * } + * + * public void actionPerformed(AnActionEvent e) { + * // do something when this action is pressed + * } + * } + *+ * + * This implementation is partially adopted from IntelliJ's Actions API. + * + * @see AnActionEvent + * @see Presentation + * @see ActionPlaces + */ +public abstract class AnAction { + + private Presentation mTemplatePresentation; + + public AnAction() { + + } + + public AnAction(Drawable icon) { + this(Presentation.NULL_STRING, Presentation.NULL_STRING, icon); + } + + public AnAction(@Nullable String text) { + this(text, null, null); + } + + public AnAction(@NonNull Supplier
+ * public class MyAction extends AnAction { + * public void update(AnActionEvent e) { + * // perform action if and only if EDITOR != null + * boolean visible = e.getData(CommonDataKeys.EDITOR) != null; + * e.getPresentation().setVisible(visible); + * } + * + * public void actionPerformed(AnActionEvent e) { + * // if we're here then EDITOR != null + * Editor editor = e.getRequiredData(CommonDataKeys.EDITOR); + * } + * } + *+ */ + @NonNull + public