Search in sources :

Example 1 with CloseAction

use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.

the class PyEduDebugRunner method patchLeftToolbar.

private static void patchLeftToolbar(@NotNull XDebugSession session, @NotNull RunnerLayoutUi ui) {
    DefaultActionGroup newLeftToolbar = new DefaultActionGroup();
    DefaultActionGroup firstGroup = new DefaultActionGroup();
    addActionToGroup(firstGroup, XDebuggerActions.RESUME);
    addActionToGroup(firstGroup, IdeActions.ACTION_STOP_PROGRAM);
    newLeftToolbar.addAll(firstGroup);
    newLeftToolbar.addSeparator();
    Executor executor = PyEduDebugExecutor.getInstance();
    newLeftToolbar.add(new CloseAction(executor, session.getRunContentDescriptor(), session.getProject()));
    //TODO: return proper helpID
    newLeftToolbar.add(new ContextHelpAction(executor.getHelpId()));
    ui.getOptions().setLeftToolbar(newLeftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
}
Also used : Executor(com.intellij.execution.Executor) CloseAction(com.intellij.execution.ui.actions.CloseAction) ContextHelpAction(com.intellij.ide.actions.ContextHelpAction)

Example 2 with CloseAction

use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.

the class XDebugSessionTab method attachToSession.

private void attachToSession(@NotNull XDebugSessionImpl session) {
    for (XDebugView view : myViews.values()) {
        attachViewToSession(session, view);
    }
    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());
    settings.addAll(commonSettings);
    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);
    }
}
Also used : DefaultDebugExecutor(com.intellij.execution.executors.DefaultDebugExecutor) Executor(com.intellij.execution.Executor) Content(com.intellij.ui.content.Content) XDebugTabLayouter(com.intellij.xdebugger.ui.XDebugTabLayouter) CloseAction(com.intellij.execution.ui.actions.CloseAction) ContextHelpAction(com.intellij.ide.actions.ContextHelpAction)

Example 3 with CloseAction

use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.

the class RunContentExecutor method createConsole.

private ConsoleView createConsole() {
    TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myProject);
    consoleBuilder.filters(myFilterList);
    final ConsoleView console = consoleBuilder.getConsole();
    if (myHelpId != null) {
        console.setHelpId(myHelpId);
    }
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    DefaultActionGroup actions = new DefaultActionGroup();
    final JComponent consolePanel = createConsolePanel(console, actions);
    RunContentDescriptor descriptor = new RunContentDescriptor(console, myProcess, consolePanel, myTitle);
    Disposer.register(descriptor, this);
    Disposer.register(descriptor, console);
    actions.add(new RerunAction(consolePanel));
    actions.add(new StopAction());
    actions.add(new CloseAction(executor, descriptor, myProject));
    ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, descriptor);
    if (myActivateToolWindow) {
        activateToolWindow();
    }
    return console;
}
Also used : DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ConsoleView(com.intellij.execution.ui.ConsoleView) CloseAction(com.intellij.execution.ui.actions.CloseAction)

Example 4 with CloseAction

use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.

the class RunIdeConsoleAction method createConsoleView.

@NotNull
private static RunContentDescriptor createConsoleView(@NotNull Project project, @NotNull PsiFile psiFile) {
    ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    DefaultActionGroup toolbarActions = new DefaultActionGroup();
    JComponent panel = new JPanel(new BorderLayout());
    panel.add(consoleView.getComponent(), BorderLayout.CENTER);
    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
    toolbar.setTargetComponent(consoleView.getComponent());
    panel.add(toolbar.getComponent(), BorderLayout.WEST);
    final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, psiFile.getName()) {

        @Override
        public boolean isContentReuseProhibited() {
            return true;
        }
    };
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    toolbarActions.addAll(consoleView.createConsoleActions());
    toolbarActions.add(new CloseAction(executor, descriptor, project));
    ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
    return descriptor;
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) Executor(com.intellij.execution.Executor) ConsoleView(com.intellij.execution.ui.ConsoleView) CloseAction(com.intellij.execution.ui.actions.CloseAction) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with CloseAction

use of com.intellij.execution.ui.actions.CloseAction in project intellij-community by JetBrains.

the class AnalyzeStacktraceUtil method addConsole.

public static RunContentDescriptor addConsole(Project project, @Nullable ConsoleFactory consoleFactory, final String tabTitle, String text, @Nullable Icon icon) {
    final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    builder.filters(Extensions.getExtensions(EP_NAME, project));
    final ConsoleView consoleView = builder.getConsole();
    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
    JComponent consoleComponent = consoleFactory != null ? consoleFactory.createConsoleComponent(consoleView, toolbarActions) : new MyConsolePanel(consoleView, toolbarActions);
    final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, icon) {

        @Override
        public boolean isContentReuseProhibited() {
            return true;
        }
    };
    final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    for (AnAction action : consoleView.createConsoleActions()) {
        toolbarActions.add(action);
    }
    final ConsoleViewImpl console = (ConsoleViewImpl) consoleView;
    ConsoleViewUtil.enableReplaceActionForConsoleViewEditor(console.getEditor());
    console.getEditor().getSettings().setCaretRowShown(true);
    toolbarActions.add(new AnnotateStackTraceAction(console.getEditor(), console.getHyperlinks()));
    toolbarActions.add(new CloseAction(executor, descriptor, project));
    ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
    consoleView.allowHeavyFilters();
    if (consoleFactory == null) {
        printStacktrace(consoleView, text);
    }
    return descriptor;
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) Executor(com.intellij.execution.Executor) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ConsoleView(com.intellij.execution.ui.ConsoleView) CloseAction(com.intellij.execution.ui.actions.CloseAction) ConsoleViewImpl(com.intellij.execution.impl.ConsoleViewImpl)

Aggregations

CloseAction (com.intellij.execution.ui.actions.CloseAction)8 Executor (com.intellij.execution.Executor)5 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)4 ContextHelpAction (com.intellij.ide.actions.ContextHelpAction)4 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)3 ConsoleView (com.intellij.execution.ui.ConsoleView)3 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)2 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)2 NotNull (org.jetbrains.annotations.NotNull)2 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 FileEditorManagerListener (com.intellij.openapi.fileEditor.FileEditorManagerListener)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Content (com.intellij.ui.content.Content)1 XDebugTabLayouter (com.intellij.xdebugger.ui.XDebugTabLayouter)1 Nullable (org.jetbrains.annotations.Nullable)1