@Override protected ActionPopupMenu createPopupMenu() { ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction(DebuggerActions.FRAME_PANEL_POPUP); return ActionManager.getInstance() .createActionPopupMenu(DebuggerActions.FRAME_PANEL_POPUP, group); }
private JPanel createToolbarPanel() { RunAction runAction = new RunAction(this); runAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this); DefaultActionGroup leftActionGroup = new DefaultActionGroup(); leftActionGroup.add(runAction); leftActionGroup.add(new PauseOutputAction(this)); leftActionGroup.add(new StopAction(this)); leftActionGroup.add(new CloseAction()); leftActionGroup.add(new PreviousOccurenceToolbarAction(this)); leftActionGroup.add(new NextOccurenceToolbarAction(this)); leftActionGroup.add(new ContextHelpAction(HelpID.ANT)); DefaultActionGroup rightActionGroup = new DefaultActionGroup(); rightActionGroup.add(new ChangeViewAction(this)); rightActionGroup.add(new VerboseAction(this)); rightActionGroup.add( CommonActionsManager.getInstance().createExpandAllAction(myTreeExpander, this)); rightActionGroup.add( CommonActionsManager.getInstance().createCollapseAllAction(myTreeExpander, this)); rightActionGroup.add(myTreeView.createToggleAutoscrollAction()); myLeftToolbar = ActionManager.getInstance() .createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, leftActionGroup, false); JPanel toolbarPanel = new JPanel(new GridLayout(1, 2, 2, 0)); toolbarPanel.add(myLeftToolbar.getComponent()); myRightToolbar = ActionManager.getInstance() .createActionToolbar(ActionPlaces.ANT_MESSAGES_TOOLBAR, rightActionGroup, false); toolbarPanel.add(myRightToolbar.getComponent()); return toolbarPanel; }
public static ActionToolbar createAddRemoveToolbar(ListTable table) { final AnAction addAction = new AddAction(table); final AnAction removeAction = new RemoveAction(table); final ActionGroup group = new DefaultActionGroup(addAction, removeAction); final ActionManager actionManager = ActionManager.getInstance(); return actionManager.createActionToolbar(ActionPlaces.UNKNOWN, group, true); }
protected ActionPopupMenu createPopupMenu() { ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction(DebuggerActions.WATCH_PANEL_POPUP); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(DebuggerActions.WATCH_PANEL_POPUP, group); return popupMenu; }
public NextOccurrenceAction( EditorSearchComponent editorSearchComponent, Getter<JTextComponent> editorTextField) { super(editorSearchComponent); myTextField = editorTextField; copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_NEXT_OCCURENCE)); ArrayList<Shortcut> shortcuts = new ArrayList<Shortcut>(); ContainerUtil.addAll( shortcuts, ActionManager.getInstance() .getAction(IdeActions.ACTION_FIND_NEXT) .getShortcutSet() .getShortcuts()); if (!editorSearchComponent.getFindModel().isMultiline()) { ContainerUtil.addAll( shortcuts, ActionManager.getInstance() .getAction(IdeActions.ACTION_EDITOR_MOVE_CARET_DOWN) .getShortcutSet() .getShortcuts()); shortcuts.add(new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), null)); } registerShortcutsForComponent(shortcuts, editorTextField.get()); }
private JComponent createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); group.add(ActionManager.getInstance().getAction(SERVERS_TOOL_WINDOW_TOOLBAR)); group.add(new Separator()); group.add(new ContextHelpAction(HELP_ID)); ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, group, false); myTree.putClientProperty( DataManager.CLIENT_PROPERTY_DATA_PROVIDER, new DataProvider() { @Override public Object getData(@NonNls String dataId) { if (KEY.getName().equals(dataId)) { return ServersToolWindowContent.this; } for (RemoteServersViewContributor contributor : RemoteServersViewContributor.EP_NAME.getExtensions()) { Object data = contributor.getData(dataId, ServersToolWindowContent.this); if (data != null) { return data; } } return null; } }); actionToolBar.setTargetComponent(myTree); return actionToolBar.getComponent(); }
protected ActionPopupMenu createPopupMenu() { ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction(DebuggerActions.EVALUATION_DIALOG_POPUP); return ActionManager.getInstance() .createActionPopupMenu(DebuggerActions.EVALUATION_DIALOG_POPUP, group); }
protected void addActionsTo(DefaultActionGroup group) { group.add(new MyGroupByPackagesAction()); group.add(new GroupByChangeListAction()); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EXPAND_ALL)); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COLLAPSE_ALL)); group.add(ActionManager.getInstance().getAction("Diff.UpdatedFiles")); }
private void registerFileChooserShortcut( @NonNls final String baseActionId, @NonNls final String fileChooserActionId) { final JTree tree = myFileSystemTree.getTree(); final AnAction syncAction = ActionManager.getInstance().getAction(fileChooserActionId); AnAction original = ActionManager.getInstance().getAction(baseActionId); syncAction.registerCustomShortcutSet(original.getShortcutSet(), tree, myDisposable); }
private void handle(MouseEvent e) { if (e.isPopupTrigger()) { ActionManager mgr = getContext().getActions(); JPopupMenu menu = mgr.createPopup( getContext().getResources().getStringArray(ElementNavigator.class, "popupActions")); menu.show((JComponent) e.getSource(), e.getX(), e.getY()); } }
private void popupInvoked(Component component, int x, int y) { final TreePath path = myTree.getLeadSelectionPath(); if (path == null) return; if (!(path.getLastPathComponent() instanceof MessageNode)) return; if (getData(DataConstants.NAVIGATABLE_ARRAY) == null) return; DefaultActionGroup group = new DefaultActionGroup(); group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE)); ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.ANT_MESSAGES_POPUP, group); menu.getComponent().show(component, x, y); }
@Override public void invokePopup(Component comp, int x, int y) { // Single right click ActionManager actionManager = ActionManager.getInstance(); ActionGroup actionGroup = (ActionGroup) actionManager.getAction(ImageEditorActions.GROUP_POPUP); ActionPopupMenu menu = actionManager.createActionPopupMenu(ImageEditorActions.ACTION_PLACE, actionGroup); JPopupMenu popupMenu = menu.getComponent(); popupMenu.pack(); popupMenu.show(comp, x, y); }
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 static ActionToolbar createAddRemoveTreeClassChooserToolbar( ListTable table, String chooserTitle, @NonNls String... ancestorClasses) { final ClassFilter filter; if (ancestorClasses.length == 0) { filter = ClassFilter.ALL; } else { filter = new SubclassFilter(ancestorClasses); } final AnAction addAction = new TreeClassChooserAction(table, chooserTitle, filter); final AnAction removeAction = new RemoveAction(table); final ActionGroup group = new DefaultActionGroup(addAction, removeAction); final ActionManager actionManager = ActionManager.getInstance(); return actionManager.createActionToolbar(ActionPlaces.UNKNOWN, group, true); }
public static ActionToolbar createAddRemoveTreeAnnotationChooserToolbar( ListTable table, String chooserTitle) { final ClassFilter filter = new ClassFilter() { public boolean isAccepted(PsiClass psiClass) { return psiClass.isAnnotationType(); } }; final AnAction addAction = new TreeClassChooserAction(table, chooserTitle, filter); final AnAction removeAction = new RemoveAction(table); final ActionGroup group = new DefaultActionGroup(addAction, removeAction); final ActionManager actionManager = ActionManager.getInstance(); return actionManager.createActionToolbar(ActionPlaces.UNKNOWN, group, true); }
private void executeAction(final String watch) { AnAction action = ActionManager.getInstance().getAction(watch); Presentation presentation = action.getTemplatePresentation().clone(); DataContext context = DataManager.getInstance().getDataContext(myTreePanel.getTree()); AnActionEvent actionEvent = new AnActionEvent( null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation, ActionManager.getInstance(), 0); action.actionPerformed(actionEvent); }
public String[] getNames(boolean checkBoxState) { final ArrayList<String> result = new ArrayList<String>(); collectActionIds( result, (ActionGroup) myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU)); if (checkBoxState) { final Set<String> ids = ((ActionManagerImpl) myActionManager).getActionIds(); for (String id : ids) { final AnAction anAction = myActionManager.getAction(id); if (!(anAction instanceof ActionGroup)) { result.add(id); } } } return ArrayUtil.toStringArray(result); }
private JComponent createActionPanel() { JPanel actions = new NonOpaquePanel(); actions.setBorder(JBUI.Borders.emptyLeft(10)); actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS)); ActionManager actionManager = ActionManager.getInstance(); ActionGroup quickStart = (ActionGroup) actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART); DefaultActionGroup group = new DefaultActionGroup(); collectAllActions(group, quickStart); for (AnAction action : group.getChildren(null)) { JPanel button = new JPanel(new BorderLayout()); button.setOpaque(false); button.setBorder(JBUI.Borders.empty(8, 20)); AnActionEvent e = AnActionEvent.createFromAnAction( action, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(this)); action.update(e); Presentation presentation = e.getPresentation(); if (presentation.isVisible()) { String text = presentation.getText(); if (text != null && text.endsWith("...")) { text = text.substring(0, text.length() - 3); } Icon icon = presentation.getIcon(); if (icon.getIconHeight() != JBUI.scale(16) || icon.getIconWidth() != JBUI.scale(16)) { icon = JBUI.emptyIcon(16); } action = wrapGroups(action); ActionLink link = new ActionLink(text, icon, action, createUsageTracker(action)); link.setPaintUnderline(false); link.setNormalColor(getLinkNormalColor()); button.add(link); if (action instanceof WelcomePopupAction) { button.add(createArrow(link), BorderLayout.EAST); } installFocusable(button, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, true); actions.add(button); } } WelcomeScreenActionsPanel panel = new WelcomeScreenActionsPanel(); panel.actions.add(actions); return panel.root; }
private JComponent toUsageViewToolbar(final DefaultActionGroup group) { ActionToolbar actionToolbar = ActionManager.getInstance() .createActionToolbar(ActionPlaces.USAGE_VIEW_TOOLBAR, group, false); actionToolbar.setTargetComponent(myRootPanel); return actionToolbar.getComponent(); }
private ActionToolbar createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); BackAction back = new BackAction(); back.registerCustomShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)), this); group.add(back); ForwardAction forward = new ForwardAction(); forward.registerCustomShortcutSet( new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)), this); group.add(forward); EditSourceActionBase edit = new EditSourceAction(); edit.registerCustomShortcutSet( new CompositeShortcutSet(CommonShortcuts.getEditSource(), CommonShortcuts.ENTER), this); group.add(edit); edit = new ShowSourceAction(); edit.registerCustomShortcutSet( new CompositeShortcutSet(CommonShortcuts.getViewSource(), CommonShortcuts.CTRL_ENTER), this); group.add(edit); return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); }
public ErrorTreeView getErrorsTreeView() { if (myErrorsView == null) { myErrorsView = ErrorViewFactory.SERVICE .getInstance() .createErrorTreeView( myProject, null, true, new AnAction[] { (DefaultActionGroup) ActionManager.getInstance().getAction("CvsActions") }, new AnAction[] {new GlobalCvsSettingsAction(), new ReconfigureCvsRootAction()}, new ContentManagerProvider() { public ContentManager getParentContent() { return getContentManager(); } }); addTab( CvsBundle.message("tab.title.errors"), myErrorsView.getComponent(), true, false, true, false, null, "cvs.errors"); } return myErrorsView; }
public ActionMenuItem( final AnAction action, final Presentation presentation, @NotNull final String place, @NotNull DataContext context, final boolean enableMnemonics, final boolean prepareNow, final boolean insideCheckedGroup) { myAction = ActionRef.fromAction(action); myPresentation = presentation; myPlace = place; myContext = context; myEnableMnemonics = enableMnemonics; myToggleable = action instanceof Toggleable; myInsideCheckedGroup = insideCheckedGroup; myEvent = new AnActionEvent(null, context, place, myPresentation, ActionManager.getInstance(), 0); addActionListener(new ActionTransmitter()); setBorderPainted(false); updateUI(); if (prepareNow) { init(); } else { setText("loading..."); } }
private JComponent createTreeToolbar() { final DefaultActionGroup group = new DefaultActionGroup(); final Runnable update = new Runnable() { public void run() { rebuild(true); } }; if (ProjectViewDirectoryHelper.getInstance(myProject).supportsFlattenPackages()) { group.add(new FlattenPackagesAction(update)); } final PatternDialectProvider[] dialectProviders = Extensions.getExtensions(PatternDialectProvider.EP_NAME); for (PatternDialectProvider provider : dialectProviders) { for (AnAction action : provider.createActions(myProject, update)) { group.add(action); } } group.add(new ShowFilesAction(update)); final Module[] modules = ModuleManager.getInstance(myProject).getModules(); if (modules.length > 1) { group.add(new ShowModulesAction(update)); group.add(new ShowModuleGroupsAction(update)); } group.add(new FilterLegalsAction(update)); if (dialectProviders.length > 1) { group.add(new ChooseScopeTypeAction(update)); } ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); return toolbar.getComponent(); }
static void subscribeTo(NavBarPanel panel) { if (panel.getClientProperty(LISTENER) != null) { unsubscribeFrom(panel); } final NavBarListener listener = new NavBarListener(panel); final Project project = panel.getProject(); panel.putClientProperty(LISTENER, listener); KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(listener); FileStatusManager.getInstance(project).addFileStatusListener(listener); PsiManager.getInstance(project).addPsiTreeChangeListener(listener); WolfTheProblemSolver.getInstance(project).addProblemListener(listener); ActionManager.getInstance().addAnActionListener(listener); final MessageBusConnection connection = project.getMessageBus().connect(); connection.subscribe(ProjectTopics.PROJECT_ROOTS, listener); connection.subscribe(NavBarModelListener.NAV_BAR, listener); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, listener); panel.putClientProperty(BUS, connection); panel.addKeyListener(listener); if (panel.isInFloatingMode()) { final Window window = SwingUtilities.windowForComponent(panel); if (window != null) { window.addWindowFocusListener(listener); } } }
private void registerShortcut( @NotNull String actionId, @NotNull ShortcutSet shortcut, @NotNull JComponent component) { final AnAction action = ActionManager.getInstance().getAction(actionId); if (action != null) { action.registerCustomShortcutSet(shortcut, component, this); } }
@Override protected JComponent createTreePanel(final WatchDebuggerTree tree) { final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(tree); decorator.setAddAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { executeAction(DebuggerActions.NEW_WATCH, tree); } }); // TODO[den]: add "Add to watches action" on Mac if (!SystemInfo.isMac) { decorator.addExtraAction( AnActionButton.fromAction( ActionManager.getInstance().getAction(XDebuggerActions.ADD_TO_WATCH))); } decorator.setRemoveAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { executeAction(DebuggerActions.REMOVE_WATCH, tree); } }); CustomLineBorder border = new CustomLineBorder( CaptionPanel.CNT_ACTIVE_BORDER_COLOR, SystemInfo.isMac ? 1 : 0, 0, SystemInfo.isMac ? 0 : 1, 0); decorator.setToolbarBorder(border); final JPanel panel = decorator.createPanel(); panel.setBorder(null); return panel; }
private JComponent createToolbar() { DefaultActionGroup group = new DefaultActionGroup(); group.add(new CloseAction()); group.add(new RerunAction(this)); group.add(new FlattenPackagesAction()); group.add(new ShowFilesAction()); if (ModuleManager.getInstance(myProject).getModules().length > 1) { group.add(new ShowModulesAction()); group.add(new ShowModuleGroupsAction()); } group.add(new GroupByScopeTypeAction()); // group.add(new GroupByFilesAction()); group.add(new FilterLegalsAction()); group.add(new MarkAsIllegalAction()); group.add(new ChooseScopeTypeAction()); group.add(new EditDependencyRulesAction()); group.add( CommonActionsManager.getInstance() .createExportToTextFileAction(new DependenciesExporterToTextFile())); group.add(new ContextHelpAction("dependency.viewer.tool.window")); ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); return toolbar.getComponent(); }
// todo terrible constructor public MultipleChangeListBrowser( Project project, List<? extends ChangeList> changeLists, List<Change> changes, Disposable parentDisposable, ChangeList initialListSelection, boolean capableOfExcludingChanges, boolean highlightProblems, Runnable rebuildListListener, @Nullable Runnable inclusionListener, AnAction... additionalActions) { super( project, changeLists, changes, initialListSelection, capableOfExcludingChanges, highlightProblems, inclusionListener, MyUseCase.LOCAL_CHANGES, null); myParentDisposable = parentDisposable; myRebuildListListener = rebuildListListener; myChangeListChooser = new ChangeListChooser(changeLists); myHeaderPanel.add(myChangeListChooser, BorderLayout.EAST); myShowingAllChangeLists = Comparing.haveEqualElements( changeLists, ChangeListManager.getInstance(project).getChangeLists()); ChangeListManager.getInstance(myProject).addChangeListListener(myChangeListListener); myExtender = new Extender(project, this, additionalActions); ActionManager actionManager = ActionManager.getInstance(); final AnAction moveAction = actionManager.getAction(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST); actionManager.addAnActionListener( new AnActionListener.Adapter() { @Override public void afterActionPerformed( AnAction action, DataContext dataContext, AnActionEvent event) { if (moveAction.equals(action)) { rebuildList(); } } }, myParentDisposable); }
public void showGroupPopupMenu(final Component comp, final int x, final int y) { ActionGroup group = myGroup.getPopupActionGroup(); if (group != null) { ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group); popupMenu.getComponent().show(comp, x, y); } }
private Component createActionsToolbar(ActionManager actionManager) { DefaultActionGroup actionGroup = createActionGroup(); if (actionManager != null) return actionManager.createActionToolbar("TOOLBAR", actionGroup, true).getComponent(); return new JLabel(); }