Search in sources :

Example 26 with ToolWindowManagerEx

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

the class JumpToLastWindowAction method update.

public void update(AnActionEvent event) {
    Presentation presentation = event.getPresentation();
    Project project = event.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManagerEx manager = (ToolWindowManagerEx) ToolWindowManager.getInstance(project);
    String id = manager.getLastActiveToolWindowId();
    presentation.setEnabled(id != null && manager.getToolWindow(id).isAvailable());
}
Also used : Project(com.intellij.openapi.project.Project) Presentation(com.intellij.openapi.actionSystem.Presentation) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 27 with ToolWindowManagerEx

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

the class JumpToLastWindowAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) {
        return;
    }
    ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(project);
    String id = manager.getLastActiveToolWindowId();
    if (id == null || !manager.getToolWindow(id).isAvailable()) {
        return;
    }
    manager.getToolWindow(id).activate(null);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 28 with ToolWindowManagerEx

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

the class OccurenceNavigatorActionBase method getOccurenceNavigatorFromContext.

@Nullable
private static Component getOccurenceNavigatorFromContext(DataContext dataContext) {
    Window window = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow();
    if (window != null) {
        Component component = window.getFocusOwner();
        for (Component c = component; c != null; c = c.getParent()) {
            if (c instanceof OccurenceNavigator) {
                return c;
            }
        }
    }
    Project project = CommonDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
        return null;
    }
    ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
    String id = mgr.getLastActiveToolWindowId(component -> findNavigator(component) != null);
    if (id == null) {
        return null;
    }
    return (Component) findNavigator(mgr.getToolWindow(id).getComponent());
}
Also used : Project(com.intellij.openapi.project.Project) OccurenceNavigator(com.intellij.ide.OccurenceNavigator) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx) Nullable(org.jetbrains.annotations.Nullable)

Example 29 with ToolWindowManagerEx

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

the class PlatformProjectViewOpener method configureProject.

@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, Ref<Module> moduleRef) {
    ToolWindowManagerEx manager = (ToolWindowManagerEx) ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = manager.getToolWindow(ToolWindowId.PROJECT_VIEW);
    if (toolWindow == null) {
        manager.addToolWindowManagerListener(new MyListener(manager, project));
    } else {
        StartupManager.getInstance(project).runWhenProjectIsInitialized(new DumbAwareRunnable() {

            @Override
            public void run() {
                activateProjectToolWindow(project, toolWindow);
            }
        });
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 30 with ToolWindowManagerEx

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

the class ProjectViewTestUtil method setupImpl.

public static void setupImpl(@NotNull Project project, boolean loadPaneExtensions) {
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
    if (toolWindow == null) {
        ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
        for (final ToolWindowEP bean : beans) {
            if (bean.id.equals(ToolWindowId.PROJECT_VIEW)) {
                toolWindow = toolWindowManager.registerToolWindow(bean.id, new JLabel(), ToolWindowAnchor.fromText(bean.anchor), project, false, bean.canCloseContents);
                break;
            }
        }
    }
    ((ProjectViewImpl) ProjectView.getInstance(project)).setupImpl(toolWindow, loadPaneExtensions);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowEP(com.intellij.openapi.wm.ToolWindowEP) ProjectViewImpl(com.intellij.ide.projectView.impl.ProjectViewImpl) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)37 Project (com.intellij.openapi.project.Project)14 ToolWindow (com.intellij.openapi.wm.ToolWindow)13 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)9 Content (com.intellij.ui.content.Content)7 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)6 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)5 Presentation (com.intellij.openapi.actionSystem.Presentation)4 ToolWindowManagerListener (com.intellij.openapi.wm.ex.ToolWindowManagerListener)4 DesktopLayout (com.intellij.openapi.wm.impl.DesktopLayout)4 Disposable (com.intellij.openapi.Disposable)3 ToolWindowType (com.intellij.openapi.wm.ToolWindowType)3 ContentManager (com.intellij.ui.content.ContentManager)2 LightToolWindow (com.intellij.designer.LightToolWindow)1 com.intellij.execution (com.intellij.execution)1 RunDashboardManager (com.intellij.execution.dashboard.RunDashboardManager)1 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 OccurenceNavigator (com.intellij.ide.OccurenceNavigator)1 ProjectViewImpl (com.intellij.ide.projectView.impl.ProjectViewImpl)1