Search in sources :

Example 6 with ContentManager

use of com.intellij.ui.content.ContentManager 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 7 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class RunnerLayoutUiImpl method addListener.

@NotNull
@Override
public RunnerLayoutUi addListener(@NotNull final ContentManagerListener listener, @NotNull final Disposable parent) {
    final ContentManager mgr = getContentManager();
    mgr.addContentManagerListener(listener);
    Disposer.register(parent, new Disposable() {

        @Override
        public void dispose() {
            mgr.removeContentManagerListener(listener);
        }
    });
    return this;
}
Also used : Disposable(com.intellij.openapi.Disposable) ContentManager(com.intellij.ui.content.ContentManager) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class SliceManager method createToolWindow.

public void createToolWindow(boolean dataFlowToThis, @NotNull SliceRootNode rootNode, boolean splitByLeafExpressions, @NotNull String displayName) {
    final SliceToolwindowSettings sliceToolwindowSettings = SliceToolwindowSettings.getInstance(myProject);
    final ContentManager contentManager = getContentManager(dataFlowToThis);
    final Content[] myContent = new Content[1];
    ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(dataFlowToThis ? BACK_TOOLWINDOW_ID : FORTH_TOOLWINDOW_ID);
    final SlicePanel slicePanel = new SlicePanel(myProject, dataFlowToThis, rootNode, splitByLeafExpressions, toolWindow) {

        @Override
        protected void close() {
            super.close();
            contentManager.removeContent(myContent[0], true);
        }

        @Override
        public boolean isAutoScroll() {
            return sliceToolwindowSettings.isAutoScroll();
        }

        @Override
        public void setAutoScroll(boolean autoScroll) {
            sliceToolwindowSettings.setAutoScroll(autoScroll);
        }

        @Override
        public boolean isPreview() {
            return sliceToolwindowSettings.isPreview();
        }

        @Override
        public void setPreview(boolean preview) {
            sliceToolwindowSettings.setPreview(preview);
        }
    };
    myContent[0] = contentManager.getFactory().createContent(slicePanel, displayName, true);
    contentManager.addContent(myContent[0]);
    contentManager.setSelectedContent(myContent[0]);
    toolWindow.activate(null);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 9 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class RunDashboardManagerImpl method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    myDashboardContent = new RunDashboardContent(myProject, myContentManager, myGroupers);
    ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(myDashboardContent, null, false);
    Disposer.register(content, myDashboardContent);
    Disposer.register(content, () -> myDashboardContent = null);
    toolWindow.getContentManager().addContent(content);
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 10 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class BrowseHierarchyActionBase method createAndAddToPanel.

@NotNull
public static HierarchyBrowser createAndAddToPanel(@NotNull Project project, @NotNull final HierarchyProvider provider, @NotNull PsiElement target) {
    HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);
    final Content content;
    HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);
    final ContentManager contentManager = hierarchyBrowserManager.getContentManager();
    final Content selectedContent = contentManager.getSelectedContent();
    if (selectedContent != null && !selectedContent.isPinned()) {
        content = selectedContent;
        final Component component = content.getComponent();
        if (component instanceof Disposable) {
            Disposer.dispose((Disposable) component);
        }
        content.setComponent(hierarchyBrowser.getComponent());
    } else {
        content = ContentFactory.SERVICE.getInstance().createContent(hierarchyBrowser.getComponent(), null, true);
        contentManager.addContent(content);
    }
    contentManager.setSelectedContent(content);
    hierarchyBrowser.setContent(content);
    final Runnable runnable = () -> {
        if (hierarchyBrowser instanceof HierarchyBrowserBase && ((HierarchyBrowserBase) hierarchyBrowser).isDisposed()) {
            return;
        }
        provider.browserActivated(hierarchyBrowser);
    };
    ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY).activate(runnable);
    return hierarchyBrowser;
}
Also used : Disposable(com.intellij.openapi.Disposable) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) HierarchyBrowser(com.intellij.ide.hierarchy.HierarchyBrowser) HierarchyBrowserManager(com.intellij.ide.hierarchy.HierarchyBrowserManager) HierarchyBrowserBase(com.intellij.ide.hierarchy.HierarchyBrowserBase) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ContentManager (com.intellij.ui.content.ContentManager)53 Content (com.intellij.ui.content.Content)41 ToolWindow (com.intellij.openapi.wm.ToolWindow)14 Project (com.intellij.openapi.project.Project)6 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)4 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)4 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)3 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)3 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)3 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)3 ContentFactory (com.intellij.ui.content.ContentFactory)3 ConsoleView (com.intellij.execution.ui.ConsoleView)2 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)2 HierarchyBrowserBase (com.intellij.ide.hierarchy.HierarchyBrowserBase)2 Disposable (com.intellij.openapi.Disposable)2 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 TabInfo (com.intellij.ui.tabs.TabInfo)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2