Search in sources :

Example 1 with RunnerLayoutUi

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

the class MvcConsole method setUpToolWindow.

private Content setUpToolWindow() {
    //Create runner UI layout
    final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
    final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(myKillAction);
    group.addSeparator();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
    final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);
    final JComponent uiComponent = layoutUi.getComponent();
    myPanel.add(uiComponent, BorderLayout.CENTER);
    final ContentManager manager = myToolWindow.getContentManager();
    final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    final Content content = contentFactory.createContent(uiComponent, null, true);
    manager.addContent(content);
    return content;
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ContentFactory(com.intellij.ui.content.ContentFactory)

Example 2 with RunnerLayoutUi

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

the class PyEduDebugProcess method createTabLayouter.

@NotNull
@Override
public XDebugTabLayouter createTabLayouter() {
    return new XDebugTabLayouter() {

        @NotNull
        @Override
        public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) {
            final PythonDebugLanguageConsoleView view = ((PythonDebugLanguageConsoleView) console);
            view.initialized();
            view.enableConsole(false);
            Content eduConsole = ui.createContent("EduConsole", view.getComponent(), XDebuggerBundle.message("debugger.session.tab.console.content.name"), AllIcons.Debugger.ToolConsole, view.getPreferredFocusableComponent());
            eduConsole.setCloseable(false);
            ui.addContent(eduConsole, 0, PlaceInGrid.right, false);
            return eduConsole;
        }
    };
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) Content(com.intellij.ui.content.Content) XDebugTabLayouter(com.intellij.xdebugger.ui.XDebugTabLayouter) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with RunnerLayoutUi

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

the class PyEduDebugRunner method initSession.

@Override
protected void initSession(XDebugSession session, RunProfileState state, Executor executor) {
    XDebugSessionTab tab = ((XDebugSessionImpl) session).getSessionTab();
    if (tab != null) {
        RunnerLayoutUi ui = tab.getUi();
        ContentManager contentManager = ui.getContentManager();
        Content content = findContent(contentManager, XDebuggerBundle.message("debugger.session.tab.console.content.name"));
        if (content != null) {
            ExecutionConsole console = session.getDebugProcess().createConsole();
            PythonDebugLanguageConsoleView view = (PythonDebugLanguageConsoleView) console;
            Presentation presentation = view.getSwitchConsoleActionPresentation();
            ToggleAction action = new ToggleAction(presentation.getText(), presentation.getDescription(), presentation.getIcon()) {

                @Override
                public boolean isSelected(AnActionEvent e) {
                    return !view.isPrimaryConsoleEnabled();
                }

                @Override
                public void setSelected(AnActionEvent e, boolean state) {
                    view.enableConsole(!state);
                }
            };
            content.setActions(new DefaultActionGroup(action), ActionPlaces.DEBUGGER_TOOLBAR, view.getPreferredFocusableComponent());
        }
        patchLeftToolbar(session, ui);
    }
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) XDebugSessionImpl(com.intellij.xdebugger.impl.XDebugSessionImpl)

Example 4 with RunnerLayoutUi

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

the class JavaDebugProcess method createTabLayouter.

@NotNull
@Override
public XDebugTabLayouter createTabLayouter() {
    return new XDebugTabLayouter() {

        @Override
        public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) {
            registerThreadsPanel(ui);
            registerMemoryViewPanel(ui);
        }

        @NotNull
        @Override
        public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) {
            Content content = null;
            if (console instanceof ExecutionConsoleEx) {
                ((ExecutionConsoleEx) console).buildUi(ui);
                content = ui.findContent(DebuggerContentInfo.CONSOLE_CONTENT);
            }
            if (content == null) {
                content = super.registerConsoleContent(ui, console);
            }
            return content;
        }

        private void registerThreadsPanel(@NotNull RunnerLayoutUi ui) {
            final ThreadsPanel panel = new ThreadsPanel(myJavaSession.getProject(), getDebuggerStateManager());
            final Content threadsContent = ui.createContent(DebuggerContentInfo.THREADS_CONTENT, panel, XDebuggerBundle.message("debugger.session.tab.threads.title"), AllIcons.Debugger.Threads, null);
            Disposer.register(threadsContent, panel);
            threadsContent.setCloseable(false);
            ui.addContent(threadsContent, 0, PlaceInGrid.left, true);
            ui.addListener(new ContentManagerAdapter() {

                @Override
                public void selectionChanged(ContentManagerEvent event) {
                    if (event.getContent() == threadsContent) {
                        if (threadsContent.isSelected()) {
                            panel.setUpdateEnabled(true);
                            if (panel.isRefreshNeeded()) {
                                panel.rebuildIfVisible(DebuggerSession.Event.CONTEXT);
                            }
                        } else {
                            panel.setUpdateEnabled(false);
                        }
                    }
                }
            }, threadsContent);
        }

        private void registerMemoryViewPanel(@NotNull RunnerLayoutUi ui) {
            final XDebugSession session = getSession();
            final DebugProcessImpl process = myJavaSession.getProcess();
            final InstancesTracker tracker = InstancesTracker.getInstance(myJavaSession.getProject());
            final ClassesFilteredView classesFilteredView = new ClassesFilteredView(session, process, tracker);
            final Content memoryViewContent = ui.createContent(MemoryViewManager.MEMORY_VIEW_CONTENT, classesFilteredView, "Memory View", AllIcons.Debugger.MemoryView.Active, null);
            memoryViewContent.setCloseable(false);
            memoryViewContent.setPinned(true);
            memoryViewContent.setShouldDisposeContent(true);
            final MemoryViewDebugProcessData data = new MemoryViewDebugProcessData(classesFilteredView);
            process.putUserData(MemoryViewDebugProcessData.KEY, data);
            ui.addListener(new ContentManagerAdapter() {

                @Override
                public void contentAdded(ContentManagerEvent event) {
                    changeMemoryViewMode(event);
                }

                @Override
                public void contentRemoved(ContentManagerEvent event) {
                    changeMemoryViewMode(event);
                }

                @Override
                public void selectionChanged(ContentManagerEvent event) {
                    changeMemoryViewMode(event);
                }

                private void changeMemoryViewMode(@Nullable ContentManagerEvent event) {
                    if (event != null && event.getContent() == memoryViewContent) {
                        final ContentManagerEvent.ContentOperation operation = event.getOperation();
                        final boolean isAddOperation = operation.equals(ContentManagerEvent.ContentOperation.add);
                        if (isAddOperation || operation.equals(ContentManagerEvent.ContentOperation.remove)) {
                            classesFilteredView.setActive(isAddOperation, process.getManagerThread());
                        }
                    }
                }
            }, classesFilteredView);
            ui.addContent(memoryViewContent, 0, PlaceInGrid.right, true);
        }
    };
}
Also used : ThreadsPanel(com.intellij.debugger.ui.impl.ThreadsPanel) InstancesTracker(com.intellij.debugger.memory.component.InstancesTracker) ContentManagerAdapter(com.intellij.ui.content.ContentManagerAdapter) NotNull(org.jetbrains.annotations.NotNull) ClassesFilteredView(com.intellij.debugger.memory.ui.ClassesFilteredView) MemoryViewDebugProcessData(com.intellij.debugger.memory.component.MemoryViewDebugProcessData) RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) Content(com.intellij.ui.content.Content) XDebugTabLayouter(com.intellij.xdebugger.ui.XDebugTabLayouter) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) ExecutionConsoleEx(com.intellij.execution.ui.ExecutionConsoleEx) ContentManagerEvent(com.intellij.ui.content.ContentManagerEvent) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with RunnerLayoutUi

use of com.intellij.execution.ui.RunnerLayoutUi in project android by JetBrains.

the class DefaultGradleConsoleView method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    //Create runner UI layout
    RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
    RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
    JComponent layoutComponent = layoutUi.getComponent();
    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
    Content console = layoutUi.createContent(GradleConsoleToolWindowFactory.ID, myConsoleView.getComponent(), "", null, null);
    AnAction[] consoleActions = myConsoleView.createConsoleActions();
    for (AnAction action : consoleActions) {
        if (!shouldIgnoreAction(action)) {
            group.add(action);
        }
    }
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);
    myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
    //noinspection ConstantConditions
    Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
    toolWindow.getContentManager().addContent(content);
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) Content(com.intellij.ui.content.Content) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) AnAction(com.intellij.openapi.actionSystem.AnAction)

Aggregations

RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)7 Content (com.intellij.ui.content.Content)7 ContentManager (com.intellij.ui.content.ContentManager)4 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)3 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)2 ContentManagerAdapter (com.intellij.ui.content.ContentManagerAdapter)2 ContentManagerEvent (com.intellij.ui.content.ContentManagerEvent)2 XDebugTabLayouter (com.intellij.xdebugger.ui.XDebugTabLayouter)2 PythonDebugLanguageConsoleView (com.jetbrains.python.console.PythonDebugLanguageConsoleView)2 NotNull (org.jetbrains.annotations.NotNull)2 AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)1 DeviceContext (com.android.tools.idea.ddms.DeviceContext)1 DevicePanel (com.android.tools.idea.ddms.DevicePanel)1 OpenVmTraceHandler (com.android.tools.idea.ddms.OpenVmTraceHandler)1 AndroidLogcatView (com.android.tools.idea.logcat.AndroidLogcatView)1 BuckSettingsProvider (com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider)1 InstancesTracker (com.intellij.debugger.memory.component.InstancesTracker)1 MemoryViewDebugProcessData (com.intellij.debugger.memory.component.MemoryViewDebugProcessData)1 ClassesFilteredView (com.intellij.debugger.memory.ui.ClassesFilteredView)1 ThreadsPanel (com.intellij.debugger.ui.impl.ThreadsPanel)1