Example usage for com.intellij.openapi.actionSystem ActionPlaces DEBUGGER_TOOLBAR

List of usage examples for com.intellij.openapi.actionSystem ActionPlaces DEBUGGER_TOOLBAR

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem ActionPlaces DEBUGGER_TOOLBAR.

Prototype

String DEBUGGER_TOOLBAR

To view the source code for com.intellij.openapi.actionSystem ActionPlaces DEBUGGER_TOOLBAR.

Click Source Link

Usage

From source file:com.goide.debugger.ideagdb.debug.GdbDebugProcess.java

License:Apache License

/**
 * Called when the debugger UI is created so we can add our own content.
 *
 * @param ui The debugger UI./*w  w w.  j  a v  a 2 s  .c o m*/
 */
@Override
public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) {
    Content gdbConsoleContent = ui.createContent("GdbConsoleContent", myGdbConsole.getComponent(),
            "GDB Console", AllIcons.Debugger.Console, myGdbConsole.getPreferredFocusableComponent());
    gdbConsoleContent.setCloseable(false);

    // Create the actions
    final DefaultActionGroup consoleActions = new DefaultActionGroup();
    AnAction[] actions = myGdbConsole.getConsole().createConsoleActions();
    for (AnAction action : actions) {
        consoleActions.add(action);
    }
    gdbConsoleContent.setActions(consoleActions, ActionPlaces.DEBUGGER_TOOLBAR,
            myGdbConsole.getConsole().getPreferredFocusableComponent());

    ui.addContent(gdbConsoleContent, 2, PlaceInGrid.bottom, false);
}

From source file:com.google.cloud.tools.intellij.debugger.ui.BreakpointConfigurationPanel.java

License:Apache License

/**
 * Executes the standard add and remove watch from the watch list.
 *///from  w w w. j a v  a  2  s  .  c om
private void executeAction(@NotNull String watch) {
    AnAction action = ActionManager.getInstance().getAction(watch);
    Presentation presentation = action.getTemplatePresentation().clone();
    DataContext context = DataManager.getInstance().getDataContext(treePanel.getTree());

    AnActionEvent actionEvent = new AnActionEvent(null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation,
            ActionManager.getInstance(), 0);
    action.actionPerformed(actionEvent);
}

From source file:com.google.gct.idea.debugger.ui.BreakpointConfigurationPanel.java

License:Apache License

/**
 * Executes the standard add and remove watch from the watch list.
 *///from   ww w  .  j  ava  2  s . c o  m
private void executeAction(@NotNull 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);
}

From source file:com.intellij.debugger.actions.ForceEarlyReturnAction.java

License:Apache License

public void update(@NotNull AnActionEvent e) {
    boolean enable = false;

    JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
    if (stackFrame != null && stackFrame.getDescriptor().getUiIndex() == 0) {
        enable = stackFrame.getStackFrameProxy().getVirtualMachine().canForceEarlyReturn();
    }/*w  ww  .ja va2s  . co  m*/

    if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace())
            || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
        e.getPresentation().setEnabled(enable);
    } else {
        e.getPresentation().setVisible(enable);
    }
}

From source file:com.intellij.debugger.actions.PopFrameAction.java

License:Apache License

public void update(AnActionEvent e) {
    boolean enable = false;
    StackFrameProxyImpl stackFrameProxy = getStackFrameProxy(e);

    if (stackFrameProxy != null && isAtBreakpoint(e)) {
        VirtualMachineProxyImpl virtualMachineProxy = stackFrameProxy.getVirtualMachine();
        enable = virtualMachineProxy.canPopFrames();
    }//  www .j av a 2  s.  co  m

    if (ActionPlaces.MAIN_MENU.equals(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
        e.getPresentation().setEnabled(enable);
    } else {
        e.getPresentation().setVisible(enable);
    }
}

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.  ja v  a 2s  .  c  om*/

    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.intellij.debugger.ui.DebuggerSessionTab.java

License:Apache License

private void initUI(ExecutionResult executionResult) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return;//from   w  ww.  j  av  a  2  s.c o m
    }

    myUi.removeContent(myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT), true);

    Content console = null;
    if (myConsole instanceof ExecutionConsoleEx) {
        ((ExecutionConsoleEx) myConsole).buildUi(myUi);
        console = myUi.findContent(DebuggerContentInfo.CONSOLE_CONTENT);
        if (console == null) {
            LOG.debug("Reuse console created with non-debug runner");
        }
    }
    if (console == null) {
        console = myUi.createContent(DebuggerContentInfo.CONSOLE_CONTENT, myConsole.getComponent(),
                XDebuggerBundle.message("debugger.session" + ".tab.console.content.name"),
                AllIcons.Debugger.Console, myConsole.getPreferredFocusableComponent());

        console.setCloseable(false);
        myUi.addContent(console, 1, PlaceInGrid.bottom, false);
    }
    attachNotificationTo(console);

    if (myConsole != null) {
        Disposer.register(this, myConsole);
    }

    final DefaultActionGroup consoleActions = new DefaultActionGroup();
    if (myConsole instanceof ConsoleView) {
        AnAction[] actions = ((ConsoleView) myConsole).createConsoleActions();
        for (AnAction goAction : actions) {
            consoleActions.add(goAction);
        }
    }
    console.setActions(consoleActions, ActionPlaces.DEBUGGER_TOOLBAR,
            myConsole.getPreferredFocusableComponent());

    //    myDebugUIEnvironment.initLogs(myRunContentDescriptor, myManager);

    DefaultActionGroup leftToolbar = new DefaultActionGroup();

    if (executionResult instanceof DefaultExecutionResult) {
        final AnAction[] actions = ((DefaultExecutionResult) executionResult).getRestartActions();
        if (actions != null) {
            leftToolbar.addAll(actions);
            if (actions.length > 0) {
                leftToolbar.addSeparator();
            }
        }
    }
    final AnAction[] profileActions = executionResult.getActions();
    leftToolbar.addAll(profileActions);

    leftToolbar.add(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));
    if (executionResult instanceof DefaultExecutionResult) {
        AnAction[] actions = ((DefaultExecutionResult) executionResult).getAdditionalStopActions();
        for (AnAction action : actions) {
            leftToolbar.add(action, new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
        }
    }

    leftToolbar.addSeparator();
    addAction(leftToolbar, DebuggerActions.EXPORT_THREADS);
    addAction(leftToolbar, DebuggerActions.DUMP_THREADS);
    leftToolbar.addSeparator();

    leftToolbar.add(myUi.getOptions().getLayoutActions());

    final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
    final AnAction commonSettingsList = myUi.getOptions().getSettingsActions();

    final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) {
        @Override
        public void update(AnActionEvent e) {
            e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
            e.getPresentation().setIcon(commonSettingsList.getTemplatePresentation().getIcon());
        }

        @Override
        public boolean isDumbAware() {
            return true;
        }
    };
    for (AnAction each : commonSettings) {
        settings.add(each);
    }
    if (commonSettings.length > 0) {
        settings.addSeparator();
    }
    settings.add(new WatchLastMethodReturnValueAction());
    settings.add(new AutoVarsSwitchAction());
    settings.addSeparator();
    addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);

    leftToolbar.add(settings);

    leftToolbar.addSeparator();

    addActionToGroup(leftToolbar, PinToolwindowTabAction.ACTION_NAME);

    myDebugUIEnvironment.initActions(myRunContentDescriptor, leftToolbar);

    myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
}

From source file:com.intellij.debugger.ui.FramesPanel.java

License:Apache License

private ActionToolbar createToolbar() {
    final DefaultActionGroup framesGroup = new DefaultActionGroup();
    framesGroup.addSeparator();//from   www  .  j a v a  2  s. co m

    CommonActionsManager actionsManager = CommonActionsManager.getInstance();
    framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator()));
    framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator()));
    framesGroup.add(new ShowLibraryFramesAction());

    final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR,
            framesGroup, true);
    toolbar.setReservePlaceAutoPopupIcon(false);
    ((ActionToolbarImpl) toolbar).setAddSeparatorFirst(true);
    toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
    return toolbar;
}

From source file:com.intellij.debugger.ui.impl.MainWatchPanel.java

License:Apache License

private static void executeAction(final String watch, final WatchDebuggerTree tree) {
    AnAction action = ActionManager.getInstance().getAction(watch);
    Presentation presentation = action.getTemplatePresentation().clone();
    DataContext context = DataManager.getInstance().getDataContext(tree);

    AnActionEvent actionEvent = new AnActionEvent(null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation,
            ActionManager.getInstance(), 0);
    action.actionPerformed(actionEvent);
}

From source file:com.intellij.execution.ui.layout.impl.RunnerContentUi.java

License:Apache License

private boolean rebuildMinimizedActions() {
    for (Map.Entry<GridImpl, Wrapper> entry : myMinimizedButtonsPlaceholder.entrySet()) {
        Wrapper eachPlaceholder = entry.getValue();
        ActionToolbar tb = myActionManager.createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR,
                myMinimizedViewActions, true);
        tb.getComponent().setBorder(null);
        tb.setReservePlaceAutoPopupIcon(false);
        JComponent minimized = tb.getComponent();
        eachPlaceholder.setContent(minimized);
    }/*from www.jav  a 2 s.c o  m*/

    myTabs.getComponent().revalidate();
    myTabs.getComponent().repaint();

    return myMinimizedViewActions.getChildrenCount() > 0;
}