Search in sources :

Example 96 with ToolWindow

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

the class ProjectViewSelectInTarget method select.

@NotNull
public static ActionCallback select(@NotNull Project project, final Object toSelect, @Nullable final String viewId, @Nullable final String subviewId, final VirtualFile virtualFile, final boolean requestFocus) {
    final ActionCallback result = new ActionCallback();
    final ProjectView projectView = ProjectView.getInstance(project);
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        AbstractProjectViewPane pane = projectView.getProjectViewPaneById(ProjectViewPane.ID);
        pane.select(toSelect, virtualFile, requestFocus);
        return result;
    }
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
    final Runnable runnable = () -> {
        Runnable r = () -> projectView.selectCB(toSelect, virtualFile, requestFocus).notify(result);
        projectView.changeViewCB(ObjectUtils.chooseNotNull(viewId, ProjectViewPane.ID), subviewId).doWhenProcessed(r);
    };
    if (requestFocus) {
        projectViewToolWindow.activate(runnable, true);
    } else {
        projectViewToolWindow.show(runnable);
    }
    return result;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ActionCallback(com.intellij.openapi.util.ActionCallback) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ProjectView(com.intellij.ide.projectView.ProjectView) AbstractProjectViewPane(com.intellij.ide.projectView.impl.AbstractProjectViewPane) NotNull(org.jetbrains.annotations.NotNull)

Example 97 with ToolWindow

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

the class VcsLogContentProvider method openAnotherLogTab.

public static void openAnotherLogTab(@NotNull VcsLogManager logManager, @NotNull Project project) {
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
    String name = generateShortName(toolWindow);
    openLogTab(project, logManager, TAB_NAME, name, logManager.getMainLogUiFactory(name));
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow)

Example 98 with ToolWindow

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

the class VcsLogContentProvider method openLogTab.

public static <U extends AbstractVcsLogUi> void openLogTab(@NotNull Project project, @NotNull VcsLogManager logManager, @NotNull String tabGroupName, @NotNull String shortName, @NotNull VcsLogManager.VcsLogUiFactory<U> factory) {
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
    String name = ContentUtilEx.getFullName(tabGroupName, shortName);
    U logUi = logManager.createLogUi(name, factory);
    ContentUtilEx.addTabbedContent(toolWindow.getContentManager(), new VcsLogPanel(logManager, logUi), tabGroupName, shortName, true, logUi);
    toolWindow.activate(null);
    logManager.scheduleInitialization();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) VcsLogPanel(com.intellij.vcs.log.ui.VcsLogPanel)

Example 99 with ToolWindow

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

the class VcsLogContentProvider method closeLogTabs.

private void closeLogTabs() {
    ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS);
    if (toolWindow != null) {
        VcsLogManager logManager = myProjectLog.getLogManager();
        if (logManager != null) {
            for (String tabName : logManager.getTabNames()) {
                if (tabName != TAB_NAME) {
                    // main tab is closed by the ChangesViewContentManager
                    Content content = toolWindow.getContentManager().findContent(tabName);
                    ContentsUtil.closeContentTab(toolWindow.getContentManager(), content);
                }
            }
        }
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) TabbedContent(com.intellij.ui.content.TabbedContent)

Example 100 with ToolWindow

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

the class MvcModuleStructureSynchronizer method updateProjectViewVisibility.

private void updateProjectViewVisibility() {
    if (ApplicationManager.getApplication().isUnitTestMode())
        return;
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {

        @Override
        public void run() {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (myProject.isDisposed())
                    return;
                for (ToolWindowEP ep : ToolWindowEP.EP_NAME.getExtensions()) {
                    if (MvcToolWindowDescriptor.class.isAssignableFrom(ep.getFactoryClass())) {
                        MvcToolWindowDescriptor descriptor = (MvcToolWindowDescriptor) ep.getToolWindowFactory();
                        String id = descriptor.getToolWindowId();
                        boolean shouldShow = descriptor.value(myProject);
                        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
                        ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
                        if (shouldShow && toolWindow == null) {
                            toolWindow = toolWindowManager.registerToolWindow(id, true, ToolWindowAnchor.LEFT, myProject, true);
                            toolWindow.setIcon(descriptor.getFramework().getToolWindowIcon());
                            descriptor.createToolWindowContent(myProject, toolWindow);
                        } else if (!shouldShow && toolWindow != null) {
                            toolWindowManager.unregisterToolWindow(id);
                            Disposer.dispose(toolWindow.getContentManager());
                        }
                    }
                }
            });
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MvcToolWindowDescriptor(org.jetbrains.plugins.groovy.mvc.projectView.MvcToolWindowDescriptor) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ToolWindowEP(com.intellij.openapi.wm.ToolWindowEP) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable)

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