Example usage for com.intellij.openapi.actionSystem IdeActions ACTION_STOP_PROGRAM

List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_STOP_PROGRAM

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions ACTION_STOP_PROGRAM.

Prototype

String ACTION_STOP_PROGRAM

To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_STOP_PROGRAM.

Click Source Link

Usage

From source file:com.android.tools.idea.run.ExternalToolRunner.java

License:Apache License

protected void fillToolBarActions(DefaultActionGroup toolbarActions) {
    toolbarActions.addAction(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
}

From source file:com.ansorgit.plugins.bash.runner.repl.AbstractConsoleRunnerWithHistory.java

License:Apache License

protected AnAction createStopAction() {
    return ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM);
}

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

License:Apache License

@Override
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar,
        @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
    ActionManager manager = ActionManager.getInstance();
    leftToolbar.add(new SaveAndExitAction(), new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));

    leftToolbar.remove(manager.getAction(IdeActions.ACTION_RERUN));
    leftToolbar.remove(manager.getAction(IdeActions.ACTION_STOP_PROGRAM));

    // XDebugSessionTab puts this action second from end.
    AnAction[] actions = leftToolbar.getChildActionsOrStubs();
    for (AnAction action : actions) {
        String text = action.getTemplatePresentation().getText();
        if (ExecutionBundle.message("close.tab.action.name").equals(text)) {
            leftToolbar.remove(action);//from  ww  w  . j  a v a  2  s .  c  om
            break;
        }
    }

    // remove help button since it points to the IntelliJ help by default and we don't have
    // a help page yet.
    // for some reason, the help button's key in leftToolbar is null, so we need to remove it
    // by class name.
    // https://github.com/GoogleCloudPlatform/gcloud-intellij/issues/149
    for (AnAction child : leftToolbar.getChildActionsOrStubs()) {
        if (child.getClass().getCanonicalName()
                .equalsIgnoreCase("com.intellij.ide.actions.ContextHelpAction")) {
            // we never want to show IDEA's help.
            leftToolbar.remove(child);

            // show our help if we have it.
            String helpUrl = GctBundle.getString("clouddebug.helpurl");
            if (!"".equals(helpUrl)) {
                leftToolbar.add(new CloudDebugHelpAction(helpUrl));
            }
            break;
        }
    }

    leftToolbar.remove(manager.getAction(XDebuggerActions.RESUME));
    leftToolbar.remove(manager.getAction(XDebuggerActions.PAUSE));
    leftToolbar.remove(manager.getAction(XDebuggerActions.MUTE_BREAKPOINTS));

    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OVER));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.FORCE_STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OUT));
    topToolbar.remove(manager.getAction(XDebuggerActions.RUN_TO_CURSOR));
    topToolbar.remove(manager.getAction(XDebuggerActions.EVALUATE_EXPRESSION));
    topToolbar.remove(manager.getAction(DebuggerActions.POP_FRAME));
}

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

License:Apache License

@Test
public void testRegisterAdditionalActions_stop() {
    assertRemoveFromLeftToolbar(IdeActions.ACTION_STOP_PROGRAM);
}

From source file:com.google.gct.idea.appengine.deploy.AppEngineUpdater.java

License:Apache License

private void startUploadingProcess() {
    final Process process;
    final GeneralCommandLine commandLine;

    try {//ww w.  ja  va2 s . c om
        JavaParameters parameters = new JavaParameters();
        parameters.configureByModule(myModule, JavaParameters.JDK_ONLY);
        parameters.setMainClass("com.google.appengine.tools.admin.AppCfg");
        AppEngineSdk mySdk = new AppEngineSdk(mySdkPath);
        if (mySdk.getToolsApiJarFile() == null) {
            Messages.showErrorDialog("Cannot start uploading: The tools sdk jar could not be located.",
                    "Error");
            return;
        }
        parameters.getClassPath().add(mySdk.getToolsApiJarFile().getAbsolutePath());

        final List<KeyValue<String, String>> list = HttpConfigurable.getJvmPropertiesList(false, null);
        if (!list.isEmpty()) {
            final ParametersList parametersList = parameters.getVMParametersList();
            for (KeyValue<String, String> value : list) {
                parametersList.defineProperty(value.getKey(), value.getValue());
            }
        }

        final ParametersList programParameters = parameters.getProgramParametersList();
        programParameters.add("--application=" + myAppEngineProject);
        if (!Strings.isNullOrEmpty(myVersion)) {
            programParameters.add("--version=" + myVersion);
        }
        programParameters.add("--oauth2");
        programParameters.add("--oauth2_client_secret=" + myClientSecret);
        programParameters.add("--oauth2_client_id=" + myClientId);
        programParameters.add("--oauth2_refresh_token=" + myRefreshToken);
        programParameters.add("update");
        programParameters.add(FileUtil.toSystemDependentName(myExplodedWarPath));

        commandLine = CommandLineBuilder.createFromJavaParameters(parameters);

        process = commandLine.createProcess();
    } catch (ExecutionException e) {
        final String message = e.getMessage();
        LOG.error("Cannot start uploading: " + message);

        if (!EventQueue.isDispatchThread()) {
            EventQueue.invokeLater(new Runnable() {
                @Override
                public void run() {
                    Messages.showErrorDialog("Cannot start uploading: " + message, "Error");
                }
            });
        } else {
            Messages.showErrorDialog("Cannot start uploading: " + message, "Error");
        }

        return;
    }

    UsageTracker.getInstance().trackEvent(GctTracking.CATEGORY, GctTracking.DEPLOY, "upload.app", null);

    final ProcessHandler processHandler = new FilteredOSProcessHandler(process,
            commandLine.getCommandLineString(), new String[] { myRefreshToken, myClientSecret, myClientId });
    final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    final ConsoleView console = TextConsoleBuilderFactory.getInstance().createBuilder(myModule.getProject())
            .getConsole();
    final RunnerLayoutUi ui = RunnerLayoutUi.Factory.getInstance(myModule.getProject()).create("Deploy",
            "Deploy to AppEngine", "Deploy Application", myModule.getProject());
    final DefaultActionGroup group = new DefaultActionGroup();
    ui.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
    ui.addContent(ui.createContent("upload", console.getComponent(), "Deploy Application", null,
            console.getPreferredFocusableComponent()));

    console.attachToProcess(processHandler);
    final RunContentDescriptor contentDescriptor = new RunContentDescriptor(console, processHandler,
            ui.getComponent(), "Deploy to AppEngine");
    group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
    group.add(new CloseAction(executor, contentDescriptor, myModule.getProject()));

    ExecutionManager.getInstance(myModule.getProject()).getContentManager().showRunContent(executor,
            contentDescriptor);
    processHandler.startNotify();
}

From source file:com.google.gct.idea.debugger.CloudDebugProcess.java

License:Apache License

@Override
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar,
        @NotNull DefaultActionGroup topToolbar, @NotNull DefaultActionGroup settings) {
    ActionManager manager = ActionManager.getInstance();
    leftToolbar.add(new SaveAndExitAction(), new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));

    leftToolbar.remove(manager.getAction(IdeActions.ACTION_RERUN));
    leftToolbar.remove(manager.getAction(IdeActions.ACTION_STOP_PROGRAM));
    leftToolbar.remove(manager.getAction(XDebuggerActions.RESUME));
    leftToolbar.remove(manager.getAction(XDebuggerActions.PAUSE));
    leftToolbar.remove(manager.getAction(XDebuggerActions.MUTE_BREAKPOINTS));

    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OVER));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.FORCE_STEP_INTO));
    topToolbar.remove(manager.getAction(XDebuggerActions.STEP_OUT));
    topToolbar.remove(manager.getAction(XDebuggerActions.RUN_TO_CURSOR));
    topToolbar.remove(manager.getAction(XDebuggerActions.EVALUATE_EXPRESSION));
}

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  a v 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.execution.runners.RunContentBuilder.java

License:Apache License

@NotNull
private ActionGroup createActionToolbar(@NotNull RunContentDescriptor contentDescriptor) {
    final DefaultActionGroup actionGroup = new DefaultActionGroup();
    actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
    if (myExecutionResult instanceof DefaultExecutionResult) {
        final AnAction[] actions = ((DefaultExecutionResult) myExecutionResult).getRestartActions();
        if (actions != null) {
            actionGroup.addAll(actions);
            if (actions.length > 0) {
                actionGroup.addSeparator();
            }/* w w  w  .j  a v  a2s.c om*/
        }
    }

    actionGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
    if (myExecutionResult instanceof DefaultExecutionResult) {
        actionGroup.addAll(((DefaultExecutionResult) myExecutionResult).getAdditionalStopActions());
    }

    actionGroup.addAll(myExecutionResult.getActions());

    for (AnAction anAction : myRunnerActions) {
        if (anAction != null) {
            actionGroup.add(anAction);
        } else {
            actionGroup.addSeparator();
        }
    }

    actionGroup.addSeparator();
    actionGroup.add(myUi.getOptions().getLayoutActions());
    actionGroup.addSeparator();
    actionGroup.add(PinToolwindowTabAction.getPinAction());
    actionGroup.add(new CloseAction(myEnvironment.getExecutor(), contentDescriptor, myProject));
    final String helpId = contentDescriptor.getHelpId();
    actionGroup.add(new ContextHelpAction(helpId != null ? helpId : myEnvironment.getExecutor().getHelpId()));
    return actionGroup;
}

From source file:com.intellij.xdebugger.impl.ui.XDebugSessionTab.java

License:Apache License

private void attachToSession(@NotNull XDebugSessionImpl session) {
    for (XDebugView view : myViews) {
        session.addSessionListener(new XDebugViewSessionListener(view), myRunContentDescriptor);
    }//from  w w w . j a v  a  2 s  .c  o m

    XDebugTabLayouter layouter = session.getDebugProcess().createTabLayouter();
    Content consoleContent = layouter.registerConsoleContent(myUi, myConsole);
    attachNotificationTo(consoleContent);

    layouter.registerAdditionalContent(myUi);
    RunContentBuilder.addAdditionalConsoleEditorActions(myConsole, consoleContent);

    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return;
    }

    DefaultActionGroup leftToolbar = new DefaultActionGroup();
    final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
    if (myEnvironment != null) {
        leftToolbar.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
        List<AnAction> additionalRestartActions = session.getRestartActions();
        if (!additionalRestartActions.isEmpty()) {
            leftToolbar.addAll(additionalRestartActions);
            leftToolbar.addSeparator();
        }
        leftToolbar.addAll(session.getExtraActions());
    }
    leftToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));

    for (AnAction action : session.getExtraStopActions()) {
        leftToolbar.add(action, new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
    }

    //group.addSeparator();
    //addAction(group, DebuggerActions.EXPORT_THREADS);
    leftToolbar.addSeparator();

    leftToolbar.add(myUi.getOptions().getLayoutActions());
    final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
    DefaultActionGroup settings = new DefaultActionGroup(ActionsBundle.message("group.XDebugger.settings.text"),
            true);
    settings.getTemplatePresentation()
            .setIcon(myUi.getOptions().getSettingsActions().getTemplatePresentation().getIcon());
    if (commonSettings.length > 0) {
        for (AnAction each : commonSettings) {
            settings.add(each);
        }
        settings.addSeparator();
    }
    if (!session.getDebugProcess().isValuesCustomSorted()) {
        settings.add(new ToggleSortValuesAction(commonSettings.length == 0));
    }

    leftToolbar.add(settings);

    leftToolbar.addSeparator();

    leftToolbar.add(PinToolwindowTabAction.getPinAction());
    leftToolbar.add(new CloseAction(myEnvironment != null ? myEnvironment.getExecutor() : debugExecutor,
            myRunContentDescriptor, myProject));
    leftToolbar.add(new ContextHelpAction(debugExecutor.getHelpId()));

    DefaultActionGroup topToolbar = new DefaultActionGroup();
    topToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP));

    session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar, settings);
    myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
    myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);

    if (myEnvironment != null) {
        initLogConsoles(myEnvironment.getRunProfile(), myRunContentDescriptor, myConsole);
    }
}

From source file:consulo.google.appengine.server.GoogleAppEngineUploader.java

License:Apache License

private void startUploadingProcess() {
    final GeneralCommandLine commandLine;

    GoogleAppEngineModuleExtension<DeploymentSource, ?> moduleExtension = mySource.getModuleExtension();

    Project project = mySource.getModuleExtension().getModule().getProject();

    try {/*from www .  j  a  v a2  s .co m*/
        commandLine = moduleExtension.createCommandLine(mySource.getDelegate(), myEmail, false);

        final Executor executor = DefaultRunExecutor.getRunExecutorInstance();

        final ConsoleView console = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
        final RunnerLayoutUi ui = RunnerLayoutUi.Factory.getInstance(project).create("Upload",
                "Upload Application", "Upload Application", project);
        final DefaultActionGroup group = new DefaultActionGroup();
        ui.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
        ui.addContent(ui.createContent("upload", console.getComponent(), "Upload Application", null,
                console.getPreferredFocusableComponent()));

        final ProcessHandler processHandler = new OSProcessHandler(commandLine.createProcess(),
                commandLine.getCommandLineString());
        processHandler.addProcessListener(new MyProcessListener(processHandler));
        console.attachToProcess(processHandler);
        processHandler.startNotify();

        final RunContentDescriptor contentDescriptor = new RunContentDescriptor(console, processHandler,
                ui.getComponent(), "Upload Application");
        group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
        group.add(new CloseAction(executor, contentDescriptor, project));

        ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, contentDescriptor);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}