Search in sources :

Example 16 with ToolWindowManager

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

the class LafManagerImpl method updateToolWindows.

public static void updateToolWindows() {
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
        for (String id : toolWindowManager.getToolWindowIds()) {
            final ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
            for (Content content : toolWindow.getContentManager().getContents()) {
                final JComponent component = content.getComponent();
                if (component != null) {
                    IJSwingUtilities.updateComponentTreeUI(component);
                }
            }
            final JComponent c = toolWindow.getComponent();
            if (c != null) {
                IJSwingUtilities.updateComponentTreeUI(c);
            }
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 17 with ToolWindowManager

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

the class ServersToolWindowManager method updateWindowAvailable.

private void updateWindowAvailable(final boolean showIfAvailable) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    toolWindowManager.invokeLater(() -> {
        boolean available = getFactory().getContribution().canContribute(myProject);
        final ToolWindow toolWindow = toolWindowManager.getToolWindow(myWindowId);
        if (toolWindow == null) {
            if (available) {
                createToolWindow(myProject, toolWindowManager).show(null);
            }
            return;
        }
        boolean doShow = !toolWindow.isAvailable() && available;
        if (toolWindow.isAvailable() && !available) {
            toolWindow.hide(null);
        }
        toolWindow.setAvailable(available, null);
        if (showIfAvailable && doShow) {
            toolWindow.show(null);
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 18 with ToolWindowManager

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

the class TodoCheckinHandler method showTodo.

private void showTodo(TodoCheckinHandlerWorker worker) {
    String title = "For commit (" + DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ")";
    ServiceManager.getService(myProject, TodoView.class).addCustomTodoView(new TodoTreeBuilderFactory() {

        @Override
        public TodoTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, Project project) {
            return new CustomChangelistTodosTreeBuilder(tree, treeModel, myProject, title, worker.inOneList());
        }
    }, title, new TodoPanelSettings(myConfiguration.myTodoPanelSettings));
    ApplicationManager.getApplication().invokeLater(() -> {
        ToolWindowManager manager = ToolWindowManager.getInstance(myProject);
        if (manager != null) {
            ToolWindow window = manager.getToolWindow("TODO");
            if (window != null) {
                window.show(() -> {
                    ContentManager cm = window.getContentManager();
                    Content[] contents = cm.getContents();
                    if (contents.length > 0) {
                        cm.setSelectedContent(contents[contents.length - 1], true);
                    }
                });
            }
        }
    }, ModalityState.NON_MODAL, myProject.getDisposed());
}
Also used : ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentManager(com.intellij.ui.content.ContentManager) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content)

Example 19 with ToolWindowManager

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

the class SelectBuildVariantAction method doPerform.

@Override
protected void doPerform(@NotNull AnActionEvent e, @NotNull final Project project) {
    final Module module = getSelectedAndroidModule(e);
    if (module != null) {
        ToolWindowManager manager = ToolWindowManager.getInstance(project);
        ToolWindow toolWindow = manager.getToolWindow(BuildVariantToolWindowFactory.ID);
        if (toolWindow != null) {
            toolWindow.activate(new Runnable() {

                @Override
                public void run() {
                    BuildVariantView view = BuildVariantView.getInstance(project);
                    view.findAndSelectVariantEditor(module);
                }
            });
        }
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) BuildVariantView(com.android.tools.idea.gradle.variant.view.BuildVariantView) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) AbstractProjectStructureAction.getSelectedAndroidModule(com.android.tools.idea.gradle.actions.AbstractProjectStructureAction.getSelectedAndroidModule) Module(com.intellij.openapi.module.Module)

Example 20 with ToolWindowManager

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

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