Search in sources :

Example 36 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow in project android by JetBrains.

the class AndroidMonitorToolWindow method updateToolWindow.

public void updateToolWindow() {
    ToolWindowManager manager = ToolWindowManager.getInstance(myProject);
    ToolWindow window = manager.getToolWindow(AndroidMonitorToolWindowFactory.ID);
    boolean maximize = myProfilers.getMode() == ProfilerMode.EXPANDED;
    if (maximize != manager.isMaximized(window)) {
        manager.setMaximized(window, maximize);
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 37 with ToolWindow

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

the class GitShowCommitInLogAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    final Project project = event.getRequiredData(CommonDataKeys.PROJECT);
    final VcsRevisionNumber revision = getRevisionNumber(event);
    if (revision == null) {
        return;
    }
    boolean logReady = findLog(project) != null;
    final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    ContentManager cm = window.getContentManager();
    Content[] contents = cm.getContents();
    for (Content content : contents) {
        if (VcsLogContentProvider.TAB_NAME.equals(content.getDisplayName())) {
            cm.setSelectedContent(content);
            break;
        }
    }
    final VcsLog log = findLog(project);
    if (log == null) {
        showLogNotReadyMessage(project);
        return;
    }
    Runnable selectAndOpenLog = new Runnable() {

        @Override
        public void run() {
            Runnable selectCommit = new Runnable() {

                @Override
                public void run() {
                    jumpToRevisionUnderProgress(project, log, revision);
                }
            };
            if (!window.isVisible()) {
                window.activate(selectCommit, true);
            } else {
                selectCommit.run();
            }
        }
    };
    if (logReady) {
        selectAndOpenLog.run();
        return;
    }
    VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
    if (projectLog == null) {
        showLogNotReadyMessage(project);
        return;
    }
    VcsLogUiImpl logUi = projectLog.getMainLogUi();
    if (logUi == null) {
        showLogNotReadyMessage(project);
        return;
    }
    logUi.invokeOnChange(selectAndOpenLog);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) VcsLog(com.intellij.vcs.log.VcsLog) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) ChangesViewContentManager(com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager) ContentManager(com.intellij.ui.content.ContentManager) VcsProjectLog(com.intellij.vcs.log.impl.VcsProjectLog) VcsLogUiImpl(com.intellij.vcs.log.ui.VcsLogUiImpl)

Example 38 with ToolWindow

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

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

use of com.intellij.openapi.wm.ToolWindow 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)

Aggregations

ToolWindow (com.intellij.openapi.wm.ToolWindow)124 Content (com.intellij.ui.content.Content)37 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)34 Project (com.intellij.openapi.project.Project)21 ContentManager (com.intellij.ui.content.ContentManager)14 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)13 Nullable (org.jetbrains.annotations.Nullable)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 ConsoleView (com.intellij.execution.ui.ConsoleView)5 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)5 NotNull (org.jetbrains.annotations.NotNull)5 RunContentManager (com.intellij.execution.ui.RunContentManager)4 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)3 ProcessEvent (com.intellij.execution.process.ProcessEvent)3 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)3 ProjectView (com.intellij.ide.projectView.ProjectView)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)3 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)3 ToolWindowEP (com.intellij.openapi.wm.ToolWindowEP)3