Search in sources :

Example 31 with ToolWindow

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

the class TestResultsPanel method splitVertically.

private boolean splitVertically() {
    final String windowId = myProperties.getExecutor().getToolWindowId();
    final ToolWindow toolWindow = ToolWindowManager.getInstance(myProperties.getProject()).getToolWindow(windowId);
    boolean splitVertically = false;
    if (toolWindow != null) {
        final ToolWindowAnchor anchor = toolWindow.getAnchor();
        splitVertically = anchor == ToolWindowAnchor.LEFT || anchor == ToolWindowAnchor.RIGHT;
    }
    return splitVertically;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor)

Example 32 with ToolWindow

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

the class ShowContentAction method getWindow.

@Nullable
private ToolWindow getWindow(AnActionEvent event) {
    if (myWindow != null)
        return myWindow;
    Project project = event.getProject();
    if (project == null)
        return null;
    ToolWindowManager manager = ToolWindowManager.getInstance(project);
    final ToolWindow window = manager.getToolWindow(manager.getActiveToolWindowId());
    if (window == null)
        return null;
    final Component context = PlatformDataKeys.CONTEXT_COMPONENT.getData(event.getDataContext());
    if (context == null)
        return null;
    return SwingUtilities.isDescendingFrom(window.getComponent(), context) ? window : null;
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Nullable(org.jetbrains.annotations.Nullable)

Example 33 with ToolWindow

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

the class BaseToolWindowToggleAction method update.

@Override
public final void update(AnActionEvent e) {
    super.update(e);
    Presentation presentation = e.getPresentation();
    Project project = e.getProject();
    if (project == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindowManager mgr = ToolWindowManager.getInstance(project);
    String id = mgr.getActiveToolWindowId();
    if (id == null) {
        presentation.setEnabled(false);
        return;
    }
    ToolWindow window = mgr.getToolWindow(id);
    if (window == null) {
        presentation.setEnabled(false);
        return;
    }
    update(window, presentation);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 34 with ToolWindow

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

the class CloseActiveTabAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    ContentManager contentManager = ContentManagerUtil.getContentManagerFromContext(e.getDataContext(), true);
    boolean processed = false;
    if (contentManager != null && contentManager.canCloseContents()) {
        final Content selectedContent = contentManager.getSelectedContent();
        if (selectedContent != null && selectedContent.isCloseable()) {
            contentManager.removeContent(selectedContent, true);
            processed = true;
        }
    }
    if (!processed && contentManager != null) {
        final DataContext context = DataManager.getInstance().getDataContext(contentManager.getComponent());
        final ToolWindow tw = PlatformDataKeys.TOOL_WINDOW.getData(context);
        if (tw != null) {
            tw.hide(null);
        }
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 35 with ToolWindow

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

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