Search in sources :

Example 46 with ToolWindowManager

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

the class MaximizeToolWindowAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    if (project == null || project.isDisposed())
        return;
    ToolWindow toolWindow = e.getData(PlatformDataKeys.TOOL_WINDOW);
    if (toolWindow == null)
        return;
    ToolWindowManager manager = ToolWindowManager.getInstance(project);
    manager.setMaximized(toolWindow, !manager.isMaximized(toolWindow));
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 47 with ToolWindowManager

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

the class MaximizeToolWindowAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    e.getPresentation().setEnabled(true);
    Project project = e.getProject();
    if (project == null || project.isDisposed()) {
        e.getPresentation().setEnabled(false);
        return;
    }
    ToolWindow toolWindow = e.getData(PlatformDataKeys.TOOL_WINDOW);
    if (toolWindow == null) {
        e.getPresentation().setEnabled(false);
        return;
    }
    ToolWindowManager manager = ToolWindowManager.getInstance(project);
    e.getPresentation().setText(manager.isMaximized(toolWindow) ? ActionsBundle.message("action.ResizeToolWindowMaximize.text.alternative") : ActionsBundle.message("action.ResizeToolWindowMaximize.text"));
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 48 with ToolWindowManager

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

the class AbstractProjectViewPane method doSelectModuleOrGroup.

private void doSelectModuleOrGroup(final Object toSelect, final boolean requestFocus) {
    ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
    final Runnable runnable = () -> {
        ProjectView projectView = ProjectView.getInstance(myProject);
        if (requestFocus) {
            projectView.changeView(getId(), getSubId());
        }
        ((BaseProjectTreeBuilder) getTreeBuilder()).selectInWidth(toSelect, requestFocus, node -> node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode);
    };
    if (requestFocus) {
        windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
    } else {
        runnable.run();
    }
}
Also used : com.intellij.openapi.util(com.intellij.openapi.util) AbstractProjectNode(com.intellij.ide.projectView.impl.nodes.AbstractProjectNode) VirtualFileWindow(com.intellij.injected.editor.VirtualFileWindow) UIUtil(com.intellij.util.ui.UIUtil) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) BaseProjectTreeBuilder(com.intellij.ide.projectView.BaseProjectTreeBuilder) com.intellij.ide.util.treeView(com.intellij.ide.util.treeView) VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashMap(com.intellij.util.containers.HashMap) ProjectView(com.intellij.ide.projectView.ProjectView) Map(java.util.Map) MoveHandler(com.intellij.refactoring.move.MoveHandler) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) Module(com.intellij.openapi.module.Module) ReflectionUtil(com.intellij.util.ReflectionUtil) AbstractModuleNode(com.intellij.ide.projectView.impl.nodes.AbstractModuleNode) ModuleUtilCore(com.intellij.openapi.module.ModuleUtilCore) TreePath(javax.swing.tree.TreePath) BufferedImage(java.awt.image.BufferedImage) DnDAwareTree(com.intellij.ide.dnd.aware.DnDAwareTree) SelectInTarget(com.intellij.ide.SelectInTarget) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager) PsiUtilCore(com.intellij.psi.util.PsiUtilCore) ApplicationManager(com.intellij.openapi.application.ApplicationManager) Registry(com.intellij.openapi.util.registry.Registry) DataProvider(com.intellij.openapi.actionSystem.DataProvider) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) ArrayUtil(com.intellij.util.ArrayUtil) DataContext(com.intellij.openapi.actionSystem.DataContext) TreeNode(javax.swing.tree.TreeNode) Transferable(java.awt.datatransfer.Transferable) NonNls(org.jetbrains.annotations.NonNls) DnDConstants(java.awt.dnd.DnDConstants) ContainerUtil(com.intellij.util.containers.ContainerUtil) ArrayList(java.util.ArrayList) PsiCopyPasteManager(com.intellij.ide.PsiCopyPasteManager) PsiDirectoryNode(com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode) ToolWindowId(com.intellij.openapi.wm.ToolWindowId) Project(com.intellij.openapi.project.Project) com.intellij.ide.dnd(com.intellij.ide.dnd) DataManager(com.intellij.ide.DataManager) TreeUtil(com.intellij.util.ui.tree.TreeUtil) Disposable(com.intellij.openapi.Disposable) File(java.io.File) ExtensionPointName(com.intellij.openapi.extensions.ExtensionPointName) java.awt(java.awt) WolfTheProblemSolver(com.intellij.problems.WolfTheProblemSolver) Navigatable(com.intellij.pom.Navigatable) Element(org.jdom.Element) Collections(java.util.Collections) ModuleGroupNode(com.intellij.ide.projectView.impl.nodes.ModuleGroupNode) javax.swing(javax.swing) AbstractModuleNode(com.intellij.ide.projectView.impl.nodes.AbstractModuleNode) AbstractProjectNode(com.intellij.ide.projectView.impl.nodes.AbstractProjectNode) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ProjectView(com.intellij.ide.projectView.ProjectView) ModuleGroupNode(com.intellij.ide.projectView.impl.nodes.ModuleGroupNode)

Example 49 with ToolWindowManager

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

the class RunContentManagerImpl method init.

// must be called on EDT
private void init() {
    ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(myProject);
    if (toolWindowManager == null) {
        return;
    }
    for (Executor executor : ExecutorRegistry.getInstance().getRegisteredExecutors()) {
        registerToolWindow(executor, toolWindowManager);
    }
    RunDashboardManager dashboardManager = RunDashboardManager.getInstance(myProject);
    initToolWindow(null, dashboardManager.getToolWindowId(), dashboardManager.getToolWindowIcon(), dashboardManager.getDashboardContentManager());
    toolWindowManager.addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (myProject.isDisposed()) {
                return;
            }
            ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
            Set<String> currentWindows = new THashSet<>();
            ContainerUtil.addAll(currentWindows, toolWindowManager.getToolWindowIds());
            myToolwindowIdZBuffer.retainAll(currentWindows);
            final String activeToolWindowId = toolWindowManager.getActiveToolWindowId();
            if (activeToolWindowId != null) {
                if (myToolwindowIdZBuffer.remove(activeToolWindowId)) {
                    myToolwindowIdZBuffer.addFirst(activeToolWindowId);
                }
            }
        }
    });
}
Also used : THashSet(gnu.trove.THashSet) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) RunDashboardManager(com.intellij.execution.dashboard.RunDashboardManager) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 50 with ToolWindowManager

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

the class FavoritesViewSelectInTarget method select.

private static ActionCallback select(@NotNull Project project, Object toSelect, VirtualFile virtualFile, boolean requestFocus) {
    final ActionCallback result = new ActionCallback();
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    final ToolWindow favoritesToolWindow = windowManager.getToolWindow(ToolWindowId.FAVORITES_VIEW);
    if (favoritesToolWindow != null) {
        final Runnable runnable = () -> {
            final FavoritesTreeViewPanel panel = UIUtil.findComponentOfType(favoritesToolWindow.getComponent(), FavoritesTreeViewPanel.class);
            if (panel != null) {
                panel.selectElement(toSelect, virtualFile, requestFocus);
                result.setDone();
            }
        };
        if (requestFocus) {
            favoritesToolWindow.activate(runnable, false);
        } else {
            favoritesToolWindow.show(runnable);
        }
    }
    return result;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ActionCallback(com.intellij.openapi.util.ActionCallback) 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