Search in sources :

Example 1 with ContentImpl

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

the class InternalCompilerRefServiceView method createViewTab.

private static InternalCompilerRefServiceView createViewTab(PsiElement element) {
    Project project = element.getProject();
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
    if (toolWindow == null) {
        toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.TOP);
    }
    final InternalCompilerRefServiceView view = new InternalCompilerRefServiceView(project);
    ToolWindow finalToolWindow = toolWindow;
    toolWindow.activate(() -> {
        final String text = SymbolPresentationUtil.getSymbolPresentableText(element);
        final ContentImpl content = new ContentImpl(view, text, true);
        finalToolWindow.getContentManager().addContent(content);
        finalToolWindow.getContentManager().setSelectedContent(content, true);
    });
    return view;
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentImpl(com.intellij.ui.content.impl.ContentImpl)

Example 2 with ContentImpl

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

the class AbstractExternalSystemToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    toolWindow.setTitle(myExternalSystemId.getReadableName());
    ContentManager contentManager = toolWindow.getContentManager();
    final ExternalProjectsViewImpl projectsView = new ExternalProjectsViewImpl(project, (ToolWindowEx) toolWindow, myExternalSystemId);
    ExternalProjectsManager.getInstance(project).registerView(projectsView);
    ContentImpl tasksContent = new ContentImpl(projectsView, ExternalSystemBundle.message("tool.window.title.projects"), true);
    contentManager.addContent(tasksContent);
}
Also used : ContentManager(com.intellij.ui.content.ContentManager) ExternalProjectsViewImpl(com.intellij.openapi.externalSystem.view.ExternalProjectsViewImpl) ContentImpl(com.intellij.ui.content.impl.ContentImpl)

Example 3 with ContentImpl

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

the class FreelineUtil method processConsole.

/* process attach to console,show the log */
// TODO: 2016/9/14 0014 need refactor console method
private static void processConsole(Project project, ProcessHandler processHandler) {
    ConsoleView consoleView = FreeUIManager.getInstance(project).getConsoleView(project);
    consoleView.clear();
    consoleView.attachToProcess(processHandler);
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow;
    toolWindow = toolWindowManager.getToolWindow(TOOL_ID);
    // if already exist tool window then show it
    if (toolWindow != null) {
        toolWindow.show(null);
        return;
    }
    toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM);
    toolWindow.setTitle("free....");
    toolWindow.setStripeTitle("Free Console");
    toolWindow.setShowStripeButton(true);
    toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW);
    toolWindow.getContentManager().addContent(new ContentImpl(consoleView.getComponent(), "Build", true));
    toolWindow.show(null);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ConsoleView(com.intellij.execution.ui.ConsoleView) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentImpl(com.intellij.ui.content.impl.ContentImpl)

Example 4 with ContentImpl

use of com.intellij.ui.content.impl.ContentImpl in project android by JetBrains.

the class AndroidUtils method activateConsoleToolWindow.

public static void activateConsoleToolWindow(@NotNull Project project, @NotNull final Runnable runAfterActivation) {
    final ToolWindowManager manager = ToolWindowManager.getInstance(project);
    final String toolWindowId = AndroidBundle.message("android.console.tool.window.title");
    ToolWindow toolWindow = manager.getToolWindow(toolWindowId);
    if (toolWindow != null) {
        runAfterActivation.run();
        return;
    }
    toolWindow = manager.registerToolWindow(toolWindowId, true, ToolWindowAnchor.BOTTOM);
    final ConsoleView console = new ConsoleViewImpl(project, false);
    project.putUserData(CONSOLE_VIEW_KEY, console);
    toolWindow.getContentManager().addContent(new ContentImpl(console.getComponent(), "", false));
    final ToolWindowManagerListener listener = new ToolWindowManagerListener() {

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

        @Override
        public void stateChanged() {
            ToolWindow window = manager.getToolWindow(toolWindowId);
            if (window != null && !window.isVisible()) {
                ((ToolWindowManagerEx) manager).removeToolWindowManagerListener(this);
                getApplication().invokeLater(() -> manager.unregisterToolWindow(toolWindowId));
            }
        }
    };
    toolWindow.show(() -> {
        runAfterActivation.run();
        ((ToolWindowManagerEx) manager).addToolWindowManagerListener(listener);
    });
}
Also used : ToolWindowManagerListener(com.intellij.openapi.wm.ex.ToolWindowManagerListener) ToolWindow(com.intellij.openapi.wm.ToolWindow) ConsoleView(com.intellij.execution.ui.ConsoleView) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentImpl(com.intellij.ui.content.impl.ContentImpl) NotNull(org.jetbrains.annotations.NotNull) ConsoleViewImpl(com.intellij.execution.impl.ConsoleViewImpl) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 5 with ContentImpl

use of com.intellij.ui.content.impl.ContentImpl in project intellij-plugins by JetBrains.

the class MessagesTabTest method testContent.

public void testContent() throws Exception {
    Content content = new ContentImpl(new JLabel(), "text", true);
    myMessagesTab.attachTo(content);
    assertSame(myMessagesTab, MessagesTab.getTab(content));
    assertSame(content, myMessagesTab.getContent());
}
Also used : Content(com.intellij.ui.content.Content) ContentImpl(com.intellij.ui.content.impl.ContentImpl)

Aggregations

ContentImpl (com.intellij.ui.content.impl.ContentImpl)5 ToolWindow (com.intellij.openapi.wm.ToolWindow)3 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)3 ConsoleView (com.intellij.execution.ui.ConsoleView)2 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)1 ExternalProjectsViewImpl (com.intellij.openapi.externalSystem.view.ExternalProjectsViewImpl)1 Project (com.intellij.openapi.project.Project)1 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)1 ToolWindowManagerListener (com.intellij.openapi.wm.ex.ToolWindowManagerListener)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 NotNull (org.jetbrains.annotations.NotNull)1