List of usage examples for com.intellij.openapi.actionSystem Anchor BEFORE
Anchor BEFORE
To view the source code for com.intellij.openapi.actionSystem Anchor BEFORE.
Click Source Link
From source file:com.intellij.debugger.engine.JavaDebugProcess.java
License:Apache License
@Override public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) { Constraints beforeRunner = new Constraints(Anchor.BEFORE, "Runner.Layout"); leftToolbar.add(AnSeparator.getInstance(), beforeRunner); leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.EXPORT_THREADS), beforeRunner); leftToolbar.add(ActionManager.getInstance().getAction(DebuggerActions.DUMP_THREADS), beforeRunner); leftToolbar.add(AnSeparator.getInstance(), beforeRunner); addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP); settings.addAction(new AutoVarsSwitchAction(), Constraints.FIRST); settings.addAction(new WatchLastMethodReturnValueAction(), Constraints.FIRST); }
From source file:com.intellij.debugger.ui.DebuggerSessionTab.java
License:Apache License
public DebuggerSessionTab(final Project project, final String sessionName, @NotNull final DebugUIEnvironment environment, @NotNull DebuggerSession debuggerSession) { super(project, "JavaDebugger", sessionName, debuggerSession.getSearchScope()); myDebuggerSession = debuggerSession; myDebugUIEnvironment = environment;/*from ww w.j a v a2 s. co m*/ final DefaultActionGroup focus = new DefaultActionGroup(); focus.add(ActionManager.getInstance().getAction("Debugger.FocusOnBreakpoint")); myUi.getOptions().setAdditionalFocusActions(focus); final DebuggerSettings debuggerSettings = DebuggerSettings.getInstance(); if (!ApplicationManager.getApplication().isUnitTestMode()) { getContextManager().addListener(new DebuggerContextListener() { @Override public void changeEvent(DebuggerContextImpl newContext, int event) { switch (event) { case DebuggerSession.EVENT_DETACHED: myUi.updateActionsNow(); if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings() .isHideDebuggerOnProcessTermination()) { try { ExecutionManager.getInstance(project).getContentManager().hideRunContent( DefaultDebugExecutor.getDebugExecutorInstance(), myRunContentDescriptor); } catch (NullPointerException e) { //if we can get closeProcess after the project have been closed LOG.debug(e); } } break; } } }); } DefaultActionGroup topToolbar = new DefaultActionGroup(); ActionManager actionManager = ActionManager.getInstance(); topToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP)); topToolbar.add(actionManager.getAction(DebuggerActions.POP_FRAME), new Constraints(Anchor.AFTER, XDebuggerActions.STEP_OUT)); topToolbar.add(AnSeparator.getInstance(), new Constraints(Anchor.BEFORE, DebuggerActions.POP_FRAME)); topToolbar.add(AnSeparator.getInstance(), new Constraints(Anchor.AFTER, DebuggerActions.POP_FRAME)); myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR); myWatchPanel = new MainWatchPanel(project, getContextManager()); myFramesPanel = new FramesPanel(project, getContextManager()); final AlertIcon breakpointAlert = new AlertIcon(AllIcons.Debugger.BreakpointAlert); // watches Content watches = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchPanel, XDebuggerBundle.message("debugger.session.tab" + ".watches.title"), AllIcons.Debugger.Watches, null); watches.setCloseable(false); watches.setAlertIcon(breakpointAlert); myUi.addContent(watches, 0, PlaceInGrid.right, false); // frames Content framesContent = myUi.createContent(DebuggerContentInfo.FRAME_CONTENT, myFramesPanel, XDebuggerBundle.message("debugger.session.tab" + ".frames.title"), AllIcons.Debugger.Frame, myFramesPanel.getFramesList()); framesContent.setCloseable(false); framesContent.setAlertIcon(breakpointAlert); myUi.addContent(framesContent, 0, PlaceInGrid.left, false); // variables myVariablesPanel = new VariablesPanel(project, myStateManager, this); myVariablesPanel.getFrameTree().setAutoVariablesMode(debuggerSettings.AUTO_VARIABLES_MODE); Content vars = myUi.createContent(DebuggerContentInfo.VARIABLES_CONTENT, myVariablesPanel, XDebuggerBundle.message("debugger.session.tab" + ".variables.title"), AllIcons.Debugger.Value, null); vars.setCloseable(false); vars.setAlertIcon(breakpointAlert); myUi.addContent(vars, 0, PlaceInGrid.center, false); // threads myThreadsPanel = new ThreadsPanel(project, getContextManager()); Content threadsContent = myUi.createContent(DebuggerContentInfo.THREADS_CONTENT, myThreadsPanel, XDebuggerBundle.message("debugger.session" + ".tab.threads.title"), AllIcons.Debugger.Threads, null); threadsContent.setCloseable(false); //threadsContent.setAlertIcon(breakpointAlert); //final DefaultActionGroup threadsGroup = new DefaultActionGroup(); //threadsContent.setActions(threadsGroup, ActionPlaces.DEBUGGER_TOOLBAR, threadsPanel.getThreadsTree()); myUi.addContent(threadsContent, 0, PlaceInGrid.left, true); for (Content each : myUi.getContents()) { updateStatus(each); } myUi.addListener(new ContentManagerAdapter() { @Override public void selectionChanged(ContentManagerEvent event) { updateStatus(event.getContent()); } }, this); debuggerSession.getContextManager().addListener(new DebuggerContextListener() { @Override public void changeEvent(DebuggerContextImpl newContext, int event) { if (!myUi.isDisposed()) { attractFramesOnPause(event); myStateManager.fireStateChanged(newContext, event); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!myUi.isDisposed()) { myUi.updateActionsNow(); } } }); } } }); // ExecutionResult executionResult = debuggerSession.getProcess().getExecutionResult(); // myConsole = executionResult.getExecutionConsole(); // myRunContentDescriptor = new RunContentDescriptor(myConsole, executionResult.getProcessHandler(), myUi.getComponent(), // getSessionName(), // environment.getIcon()); // initUI(executionResult); }
From source file:com.mediaworx.intellij.opencmsplugin.OpenCmsPlugin.java
License:Open Source License
/** * Creates and registers the OpenCms menu for the main menu as an action group *//*from ww w .j av a 2 s .c o m*/ private void registerMainMenu() { OpenCmsMainMenu openCmsMainMenu = (OpenCmsMainMenu) actionManager.getAction(OPENCMS_MENU_ID); if (openCmsMainMenu == null) { DefaultActionGroup mainMenu = (DefaultActionGroup) actionManager.getAction(IdeActions.GROUP_MAIN_MENU); openCmsMainMenu = OpenCmsMainMenu.getInstance(this); addAction(mainMenu, OPENCMS_MENU_ID, openCmsMainMenu, "_OpenCms", null, new Constraints(Anchor.BEFORE, "HelpMenu")); } }
From source file:com.mediaworx.intellij.opencmsplugin.OpenCmsPlugin.java
License:Open Source License
/** * Creates and registers the OpenCms menu for the project popup as an action group *///from w w w. j a va 2 s . c o m private void registerProjectPopupMenu() { OpenCmsProjectPopupMenu openCmsProjectPopupMenu = (OpenCmsProjectPopupMenu) actionManager .getAction(PROJECT_POPUP_MENU_ID); if (openCmsProjectPopupMenu == null) { DefaultActionGroup projectPopup = (DefaultActionGroup) actionManager .getAction(IdeActions.GROUP_PROJECT_VIEW_POPUP); openCmsProjectPopupMenu = new OpenCmsProjectPopupMenu(this); addAction(projectPopup, PROJECT_POPUP_MENU_ID, openCmsProjectPopupMenu, "_OpenCms", MENU_ICON, new Constraints(Anchor.BEFORE, "RevealIn")); projectPopup.add(Separator.getInstance(), new Constraints(Anchor.AFTER, PROJECT_POPUP_MENU_ID)); } }
From source file:com.mediaworx.intellij.opencmsplugin.OpenCmsPlugin.java
License:Open Source License
/** * Creates and registers the OpenCms menu for the editor popup as an action group *//*from ww w . ja va2 s . c o m*/ private void registerEditorPopupMenu() { OpenCmsEditorPopupMenu openCmsEditorPopupMenu = (OpenCmsEditorPopupMenu) actionManager .getAction(EDITOR_POPUP_MENU_ID); if (openCmsEditorPopupMenu == null) { DefaultActionGroup editorPopup = (DefaultActionGroup) actionManager .getAction(IdeActions.GROUP_EDITOR_POPUP); openCmsEditorPopupMenu = new OpenCmsEditorPopupMenu(this); addAction(editorPopup, EDITOR_POPUP_MENU_ID, openCmsEditorPopupMenu, "_OpenCms", MENU_ICON, new Constraints(Anchor.AFTER, "ChangeFileEncodingAction")); editorPopup.addAction(Separator.getInstance(), new Constraints(Anchor.BEFORE, EDITOR_POPUP_MENU_ID)); } }
From source file:com.mediaworx.intellij.opencmsplugin.OpenCmsPlugin.java
License:Open Source License
/** * Creates and registers the OpenCms menu for the editor tab popup as an action group *//*from w w w . j av a2s . c o m*/ private void registerEditorTabPopupMenu() { OpenCmsEditorTabPopupMenu openCmsEditorTabPopupMenu = (OpenCmsEditorTabPopupMenu) actionManager .getAction(TAB_POPUP_MENU_ID); if (openCmsEditorTabPopupMenu == null) { // DefaultActionGroup editorTabPopup = (DefaultActionGroup)actionManager.getAction(IdeActions.GROUP_EDITOR_TAB_POPUP); DefaultActionGroup editorTabPopup = (DefaultActionGroup) actionManager .getAction("EditorTabPopupMenuEx"); openCmsEditorTabPopupMenu = new OpenCmsEditorTabPopupMenu(this); editorTabPopup.addAction(Separator.getInstance()); // addAction(editorTabPopup, TAB_POPUP_MENU_ID, openCmsEditorTabPopupMenu, "_OpenCms", MENU_ICON, new Constraints(Anchor.AFTER, "UnsplitAll")); addAction(editorTabPopup, TAB_POPUP_MENU_ID, openCmsEditorTabPopupMenu, "_OpenCms", MENU_ICON, new Constraints(Anchor.BEFORE, "RunContextPopupGroup")); // editorTabPopup.addAction(Separator.getInstance(), new Constraints(Anchor.BEFORE, TAB_POPUP_MENU_ID)); editorTabPopup.addAction(Separator.getInstance(), new Constraints(Anchor.AFTER, TAB_POPUP_MENU_ID)); } }
From source file:generate.tostring.psi.PsiAdapter.java
License:Apache License
/** * Adds the action to the menu./*w w w.j a v a2 s .c om*/ * <p/> * The group must be of a DefaultActionGroup instance, if not this method returns false. * * @param actionId group id of the action to add. * @param menuId id of the menu the action should be added to. See ActionManager.xml in the IDEA openapi folder. * @param anchorId id of the action to position relative to. See ActionManager.xml in the IDEA openapi folder. * @param afterAnchor true if the action should be added after the anchorId, false if before. * @return true if the action was added, false if not. */ public boolean addActionToMenu(String actionId, String menuId, String anchorId, boolean afterAnchor) { ActionManager am = ActionManager.getInstance(); AnAction group = am.getAction(menuId); // must be default action group if (group instanceof DefaultActionGroup) { DefaultActionGroup defGroup = (DefaultActionGroup) group; // loop children (actions) and remove the matching id AnAction[] actions = defGroup.getChildren(null); for (AnAction action : actions) { String id = am.getId(action); // if match id then add action to menu if (anchorId.equals(id)) { AnAction actionToAdd = am.getAction(actionId); // find the action to add defGroup.add(actionToAdd, new Constraints(afterAnchor ? Anchor.AFTER : Anchor.BEFORE, anchorId)); return true; } } } // action to add next to not found return false; }
From source file:org.metaborg.intellij.idea.actions.ActionUtils.java
License:Apache License
/** * Gets an object that specifies where the action is positioned. * * @param relativeToActionId The action ID relative to which to position the action; * or <code>null</code> to position the action at the start or end. * @param anchor The anchor indicating where to position the action; * or <code>null</code> to position the action after or at the end. * @return The {@link Constraints}./*from w w w. j av a 2 s .c o m*/ */ private Constraints getActionConstraints(@Nullable final String relativeToActionId, @Nullable final Anchor anchor) { if (relativeToActionId != null && anchor != null) { return new Constraints(anchor, relativeToActionId); } else if (relativeToActionId != null) { return new Constraints(Anchor.AFTER, relativeToActionId); } else if (anchor == Anchor.BEFORE || anchor == Anchor.FIRST) { return Constraints.FIRST; } else { return Constraints.LAST; } }
From source file:org.twodividedbyzero.idea.findbugs.core.FindBugsPluginImpl.java
License:Open Source License
private static void registerToolbarActions() { final DefaultActionGroup mainToolbar = (DefaultActionGroup) ActionManager.getInstance() .getAction("MainToolBar"); for (final AnAction anAction : _mainToolbarActions) { if (!isActionRegistered(anAction)) { _registeredMainToolbarActions.add(anAction); mainToolbar.add(anAction, new Constraints(Anchor.BEFORE, "RunConfiguration")); }//w ww .java 2 s. c om } }