Search in sources :

Example 1 with ShowVarsAction

use of com.jetbrains.python.console.actions.ShowVarsAction in project intellij-community by JetBrains.

the class PythonScriptCommandLineState method execute.

@Override
public ExecutionResult execute(Executor executor, PythonProcessStarter processStarter, final CommandLinePatcher... patchers) throws ExecutionException {
    if (myConfig.showCommandLineAfterwards() && !myConfig.emulateTerminal()) {
        if (executor.getId() == DefaultDebugExecutor.EXECUTOR_ID) {
            return super.execute(executor, processStarter, ArrayUtil.append(patchers, new CommandLinePatcher() {

                @Override
                public void patchCommandLine(GeneralCommandLine commandLine) {
                    commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_DEBUGGER).addParameterAt(1, "--cmd-line");
                }
            }));
        }
        PythonScriptWithConsoleRunner runner = new PythonScriptWithConsoleRunner(myConfig.getProject(), myConfig.getSdk(), PyConsoleType.PYTHON, myConfig.getWorkingDirectory(), myConfig.getEnvs(), patchers, PyConsoleOptions.getInstance(myConfig.getProject()).getPythonConsoleSettings());
        runner.setEnableAfterConnection(false);
        runner.runSync();
        // runner.getProcessHandler() would be null if execution error occurred
        if (runner.getProcessHandler() == null) {
            return null;
        }
        runner.getPydevConsoleCommunication().setConsoleView(runner.getConsoleView());
        List<AnAction> actions = Lists.newArrayList(createActions(runner.getConsoleView(), runner.getProcessHandler()));
        actions.add(new ShowVarsAction(runner.getConsoleView(), runner.getPydevConsoleCommunication()));
        return new DefaultExecutionResult(runner.getConsoleView(), runner.getProcessHandler(), actions.toArray(new AnAction[actions.size()]));
    } else if (myConfig.emulateTerminal()) {
        setRunWithPty(true);
        final ProcessHandler processHandler = startProcess(processStarter, patchers);
        TerminalExecutionConsole executeConsole = new TerminalExecutionConsole(myConfig.getProject(), processHandler);
        executeConsole.addMessageFilter(myConfig.getProject(), new PythonTracebackFilter(myConfig.getProject()));
        executeConsole.addMessageFilter(myConfig.getProject(), new UrlFilter());
        processHandler.startNotify();
        return new DefaultExecutionResult(executeConsole, processHandler, AnAction.EMPTY_ARRAY);
    } else {
        return super.execute(executor, processStarter, patchers);
    }
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ShowVarsAction(com.jetbrains.python.console.actions.ShowVarsAction) TerminalExecutionConsole(com.intellij.terminal.TerminalExecutionConsole) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) UrlFilter(com.intellij.execution.filters.UrlFilter) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 2 with ShowVarsAction

use of com.jetbrains.python.console.actions.ShowVarsAction in project intellij-community by JetBrains.

the class PydevConsoleRunnerImpl method fillToolBarActions.

private List<AnAction> fillToolBarActions(final DefaultActionGroup toolbarActions, final RunContentDescriptor contentDescriptor) {
    //toolbarActions.add(backspaceHandlingAction);
    toolbarActions.add(createRerunAction());
    List<AnAction> actions = ContainerUtil.newArrayList();
    //stop
    actions.add(createStopAction());
    //close
    actions.add(createCloseAction(contentDescriptor));
    // run action
    actions.add(new ConsoleExecuteAction(myConsoleView, myConsoleExecuteActionHandler, myConsoleExecuteActionHandler.getEmptyExecuteAction(), myConsoleExecuteActionHandler));
    // Help
    actions.add(CommonActionsManager.getInstance().createHelpAction("interactive_console"));
    toolbarActions.addAll(actions);
    actions.add(0, createRerunAction());
    actions.add(createInterruptAction());
    actions.add(PyConsoleUtil.createTabCompletionAction(myConsoleView));
    actions.add(createSplitLineAction());
    toolbarActions.add(new ShowVarsAction(myConsoleView, myPydevConsoleCommunication));
    toolbarActions.add(ConsoleHistoryController.getController(myConsoleView).getBrowseHistory());
    toolbarActions.add(new ConnectDebuggerAction());
    toolbarActions.add(new NewConsoleAction());
    return actions;
}
Also used : ShowVarsAction(com.jetbrains.python.console.actions.ShowVarsAction) ConsoleExecuteAction(com.intellij.execution.console.ConsoleExecuteAction)

Aggregations

ShowVarsAction (com.jetbrains.python.console.actions.ShowVarsAction)2 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 ConsoleExecuteAction (com.intellij.execution.console.ConsoleExecuteAction)1 UrlFilter (com.intellij.execution.filters.UrlFilter)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 TerminalExecutionConsole (com.intellij.terminal.TerminalExecutionConsole)1