Search in sources :

Example 66 with ToolWindow

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

the class ActivateToolWindowAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    Project project = getEventProject(e);
    if (project == null)
        return;
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    final ToolWindow window = windowManager.getToolWindow(myToolWindowId);
    InputEvent event = e.getInputEvent();
    Runnable run = null;
    if (event instanceof KeyEvent && event.isShiftDown()) {
        final Content[] contents = window.getContentManager().getContents();
        if (contents.length > 0 && window.getContentManager().getSelectedContent() != contents[0]) {
            run = () -> window.getContentManager().setSelectedContent(contents[0], true, true);
        }
    }
    if (windowManager.isEditorComponentActive() || !myToolWindowId.equals(windowManager.getActiveToolWindowId()) || run != null) {
        if (run != null && window.isActive()) {
            run.run();
        } else {
            window.activate(run);
        }
    } else {
        windowManager.getToolWindow(myToolWindowId).hide(null);
    }
}
Also used : KeyEvent(java.awt.event.KeyEvent) Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) InputEvent(java.awt.event.InputEvent)

Example 67 with ToolWindow

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

the class ActivateToolWindowAction method update.

public void update(AnActionEvent e) {
    Project project = getEventProject(e);
    Presentation presentation = e.getPresentation();
    if (project == null || project.isDisposed()) {
        presentation.setEnabledAndVisible(false);
        return;
    }
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(myToolWindowId);
    if (toolWindow == null) {
        presentation.setEnabledAndVisible(false);
    } else {
        presentation.setVisible(true);
        presentation.setEnabled(toolWindow.isAvailable());
        updatePresentation(presentation, toolWindow);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow)

Example 68 with ToolWindow

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

the class RemoteServersViewImpl method showDeployment.

@Override
public void showDeployment(@NotNull final ServerConnection<?> connection, @NotNull final String deploymentName) {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    final ToolWindow toolWindow = toolWindowManager.getToolWindow(getToolWindowId(connection));
    if (toolWindow != null) {
        toolWindowManager.invokeLater(() -> {
            ServersToolWindowContent component = getServersViewComponent(toolWindow);
            if (component != null) {
                component.select(connection, deploymentName);
            }
        });
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 69 with ToolWindow

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

the class PinActiveTabAction method getToolWindowContent.

@Nullable
private static Content getToolWindowContent(@NotNull AnActionEvent e) {
    // note to future readers: TW tab "pinned" icon is shown when content.getUserData(TW.SHOW_CONTENT_ICON) is true
    ToolWindow window = PlatformDataKeys.TOOL_WINDOW.getData(e.getDataContext());
    Content result = window != null ? window.getContentManager().getSelectedContent() : null;
    return result != null && result.isPinnable() ? result : null;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) Nullable(org.jetbrains.annotations.Nullable)

Example 70 with ToolWindow

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

the class ShowContentAction method update.

@Override
public void update(AnActionEvent e) {
    final ToolWindow window = getWindow(e);
    e.getPresentation().setEnabledAndVisible(window != null && window.getContentManager().getContentCount() > 1);
    e.getPresentation().setText(window == null || window.getContentUiType() == ToolWindowContentUiType.TABBED ? "Show List of Tabs" : "Show List of Views");
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow)

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