private void mousePressedInIconsArea(MouseEvent e) { EditorMessageIconRenderer iconRenderer = getIconRendererUnderMouse(e); if (iconRenderer != null) { if (e.getButton() == MouseEvent.BUTTON3) { JPopupMenu popupMenu = iconRenderer.getPopupMenu(); if (popupMenu != null && e.getID() == MouseEvent.MOUSE_PRESSED) { e.consume(); Component component = e.getComponent(); popupMenu.show(component == null ? myEditorComponent : component, e.getX(), e.getY()); } return; } AnAction action = iconRenderer.getClickAction(); if (e.getButton() == MouseEvent.BUTTON1 && action != null) { if (e.getID() == MouseEvent.MOUSE_CLICKED) { AnActionEvent actionEvent = new AnActionEvent( e, new LeftEditorHighlighterDataContext(myEditorComponent, iconRenderer.getNode()), ICON_AREA, action.getTemplatePresentation(), ActionManager.getInstance(), e.getModifiers()); action.update(actionEvent); action.actionPerformed(actionEvent); } e.consume(); } } }
public static void invokeNamedAction(final String actionId) { final AnAction action = ActionManager.getInstance().getAction(actionId); assertNotNull(action); final Presentation presentation = new Presentation(); @SuppressWarnings("deprecation") final DataContext context = DataManager.getInstance().getDataContext(); final AnActionEvent event = new AnActionEvent(null, context, "", presentation, ActionManager.getInstance(), 0); action.update(event); Assert.assertTrue(presentation.isEnabled()); action.actionPerformed(event); }
public void update(final AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(getScope() != null); }
public void update(final AnActionEvent e) { super.update(e); e.getPresentation().setEnabled(!getSelectedScope(myLeftTree).isEmpty()); }
@Override public void update(AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); presentation.setEnabled(allTargetsAreValid()); }