Search in sources :

Example 6 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager 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 7 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.

the class ExternalSystemUtil method ensureToolWindowInitialized.

public static void ensureToolWindowInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
    try {
        ToolWindowManager manager = ToolWindowManager.getInstance(project);
        if (!(manager instanceof ToolWindowManagerEx)) {
            return;
        }
        ToolWindowManagerEx managerEx = (ToolWindowManagerEx) manager;
        String id = externalSystemId.getReadableName();
        ToolWindow window = manager.getToolWindow(id);
        if (window != null) {
            return;
        }
        ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
        for (final ToolWindowEP bean : beans) {
            if (id.equals(bean.id)) {
                managerEx.initToolWindow(bean);
            }
        }
    } catch (Exception e) {
        LOG.error(String.format("Unable to initialize %s tool window", externalSystemId.getReadableName()), e);
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ToolWindowEP(com.intellij.openapi.wm.ToolWindowEP) ImportCanceledException(com.intellij.openapi.externalSystem.service.ImportCanceledException) IOException(java.io.IOException) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 8 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.

the class ExternalSystemUtil method ensureToolWindowContentInitialized.

@Nullable
public static ToolWindow ensureToolWindowContentInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    if (toolWindowManager == null)
        return null;
    final ToolWindow toolWindow = toolWindowManager.getToolWindow(externalSystemId.getReadableName());
    if (toolWindow == null)
        return null;
    if (toolWindow instanceof ToolWindowImpl) {
        ((ToolWindowImpl) toolWindow).ensureContentInitialized();
    }
    return toolWindow;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowImpl(com.intellij.openapi.wm.impl.ToolWindowImpl) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.

the class ExternalToolWindowManager method getToolWindow.

@Nullable
private static ToolWindow getToolWindow(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    if (toolWindowManager == null) {
        return null;
    }
    ToolWindow result = toolWindowManager.getToolWindow(externalSystemId.getReadableName());
    if (result instanceof ToolWindowImpl) {
        ((ToolWindowImpl) result).ensureContentInitialized();
    }
    return result;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowImpl(com.intellij.openapi.wm.impl.ToolWindowImpl) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Nullable(org.jetbrains.annotations.Nullable)

Example 10 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.

the class RunDashboardManagerImpl method updateDashboard.

private void updateDashboard(final boolean withStructure) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    toolWindowManager.invokeLater(() -> {
        if (myProject.isDisposed()) {
            return;
        }
        if (withStructure) {
            boolean available = hasContent();
            ToolWindow toolWindow = toolWindowManager.getToolWindow(getToolWindowId());
            if (toolWindow == null) {
                if (available) {
                    createToolWindow();
                }
                return;
            }
            boolean doShow = !toolWindow.isAvailable() && available;
            toolWindow.setAvailable(available, null);
            if (doShow) {
                toolWindow.show(null);
            }
        }
        if (myDashboardContent != null) {
            myDashboardContent.updateContent(withStructure);
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Aggregations

ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)60 ToolWindow (com.intellij.openapi.wm.ToolWindow)34 Project (com.intellij.openapi.project.Project)27 Presentation (com.intellij.openapi.actionSystem.Presentation)8 Content (com.intellij.ui.content.Content)7 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)5 Nullable (org.jetbrains.annotations.Nullable)5 Module (com.intellij.openapi.module.Module)3 ContentManager (com.intellij.ui.content.ContentManager)3 ContentImpl (com.intellij.ui.content.impl.ContentImpl)3 NotNull (org.jetbrains.annotations.NotNull)3 ConsoleView (com.intellij.execution.ui.ConsoleView)2 ProjectView (com.intellij.ide.projectView.ProjectView)2 FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)2 ModuleUtilCore (com.intellij.openapi.module.ModuleUtilCore)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 ToolWindowId (com.intellij.openapi.wm.ToolWindowId)2 ToolWindowImpl (com.intellij.openapi.wm.impl.ToolWindowImpl)2 StudyToolWindow (org.stepik.core.ui.StudyToolWindow)2 AbstractProjectStructureAction.getSelectedAndroidModule (com.android.tools.idea.gradle.actions.AbstractProjectStructureAction.getSelectedAndroidModule)1