Search in sources :

Example 1 with Content

use of com.intellij.ui.content.Content in project intellij-code-outline by sitano.

the class CodeOutlinePlugin method regForProject.

/**
     * Creates a code outline tool window for the given project.
     *
     * @param project the project to register
     */
private synchronized void regForProject(final Project project) {
    final CodeOutlineToolWindow window = new CodeOutlineToolWindow(this, project);
    ToolWindowManager twm = ToolWindowManager.getInstance(project);
    ToolWindowManagerEx twmEx = (ToolWindowManagerEx) twm;
    ToolWindow tw = twm.registerToolWindow(TOOLWINDOW_ID, false, ToolWindowAnchor.RIGHT);
    ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
    Content content = contentFactory.createContent(window, "", false);
    tw.getContentManager().addContent(content);
    tw.getContentManager().setSelectedContent(content, false);
    twmEx.addToolWindowManagerListener(window.getToolWindowManagerListener());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentFactory(com.intellij.ui.content.ContentFactory) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 2 with Content

use of com.intellij.ui.content.Content in project freeline by alibaba.

the class FreelineTerminal method initTerminal.

public void initTerminal(final ToolWindow toolWindow) {
    toolWindow.setToHideOnEmptyContent(true);
    LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
    toolWindow.setStripeTitle("Freeline");
    Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
    toolWindow.getContentManager().addContent(content);
    toolWindow.setShowStripeButton(true);
    toolWindow.setTitle("Console");
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(this.myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {

        @Override
        public void toolWindowRegistered(@NotNull String s) {
        }

        @Override
        public void stateChanged() {
            ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(FreelineToolWindowFactory.TOOL_WINDOW_ID);
            if (window != null) {
                boolean visible = window.isVisible();
                if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                    initTerminal(window);
                }
            }
        }
    });
    toolWindow.show(null);
    JBTabbedTerminalWidget terminalWidget = getTerminalWidget(toolWindow);
    if (terminalWidget != null && terminalWidget.getCurrentSession() != null) {
        Terminal terminal = terminalWidget.getCurrentSession().getTerminal();
        if (terminal != null) {
            terminal.setCursorVisible(false);
        }
    }
}
Also used : ToolWindowManagerListener(com.intellij.openapi.wm.ex.ToolWindowManagerListener) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) LocalTerminalDirectRunner(org.jetbrains.plugins.terminal.LocalTerminalDirectRunner) JBTabbedTerminalWidget(org.jetbrains.plugins.terminal.JBTabbedTerminalWidget) Terminal(com.jediterm.terminal.Terminal) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 3 with Content

use of com.intellij.ui.content.Content in project freeline by alibaba.

the class FreelineTerminal method createTerminalInContentPanel.

/**
     * 创建Terminal panel
     *
     * @param terminalRunner
     * @param toolWindow
     * @return
     */
private Content createTerminalInContentPanel(@NotNull AbstractTerminalRunner terminalRunner, @NotNull final ToolWindow toolWindow) {
    SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
    Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
    content.setCloseable(true);
    myTerminalWidget = terminalRunner.createTerminalWidget(content);
    panel.setContent(myTerminalWidget.getComponent());
    panel.addFocusListener(this);
    ActionToolbar toolbar = createToolbar(terminalRunner, myTerminalWidget, toolWindow);
    toolbar.setTargetComponent(panel);
    panel.setToolbar(toolbar.getComponent());
    content.setPreferredFocusableComponent(myTerminalWidget.getComponent());
    return content;
}
Also used : Content(com.intellij.ui.content.Content) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar)

Example 4 with Content

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

the class DesignerToolWindowManager method initToolWindow.

//////////////////////////////////////////////////////////////////////////////////////////
//
// Impl
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void initToolWindow() {
    if (myToolWindowContent == null) {
        myToolWindowContent = new DesignerToolWindow(myProject, true);
    }
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(DesignerBundle.message("designer.toolwindow.name"), false, getAnchor(), myProject, true);
    myToolWindow.setIcon(UIDesignerNewIcons.ToolWindow);
    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
        myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
    }
    ((ToolWindowEx) myToolWindow).setTitleActions(myToolWindowContent.createActions());
    initGearActions();
    ContentManager contentManager = myToolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(myToolWindowContent.getToolWindowPanel(), DesignerBundle.message("designer.toolwindow.title"), false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(myToolWindowContent.getComponentTree());
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    myToolWindow.setAvailable(false, null);
}
Also used : ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 5 with Content

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

the class PythonConsoleToolWindow method setContent.

private static void setContent(ToolWindow toolWindow, RunContentDescriptor contentDescriptor) {
    toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
    Content content = toolWindow.getContentManager().findContent(contentDescriptor.getDisplayName());
    if (content == null) {
        content = createContent(contentDescriptor);
        toolWindow.getContentManager().addContent(content);
    } else {
        SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
        resetContent(contentDescriptor, panel, content);
    }
    toolWindow.getContentManager().setSelectedContent(content);
}
Also used : Content(com.intellij.ui.content.Content) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel)

Aggregations

Content (com.intellij.ui.content.Content)157 ContentManager (com.intellij.ui.content.ContentManager)42 ToolWindow (com.intellij.openapi.wm.ToolWindow)37 NotNull (org.jetbrains.annotations.NotNull)19 ContentFactory (com.intellij.ui.content.ContentFactory)14 Project (com.intellij.openapi.project.Project)13 Nullable (org.jetbrains.annotations.Nullable)13 MessageView (com.intellij.ui.content.MessageView)10 Disposable (com.intellij.openapi.Disposable)8 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)8 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)7 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)7 ConsoleView (com.intellij.execution.ui.ConsoleView)6 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)6 TabbedContent (com.intellij.ui.content.TabbedContent)6 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)5 Ref (com.intellij.openapi.util.Ref)5 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)4 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)4 Assert.assertNotNull (junit.framework.Assert.assertNotNull)4