Search in sources :

Example 6 with ToolWindow

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

the class BrowseRepositoryAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project == null) {
        RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject());
        dialog.show();
    } else {
        ToolWindowManager manager = ToolWindowManager.getInstance(project);
        ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW);
        if (w == null) {
            RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project);
            w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
            final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false);
            Disposer.register(content, component);
            w.getContentManager().addContent(content);
        }
        w.show(null);
        w.activate(null);
    }
}
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) RepositoryBrowserDialog(org.jetbrains.idea.svn.dialogs.RepositoryBrowserDialog)

Example 7 with ToolWindow

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

the class AbstractTerminalRunner method showConsole.

protected void showConsole(Executor defaultExecutor, @NotNull RunContentDescriptor myDescriptor, final Component toFocus) {
    // Show in run toolwindow
    ExecutionManager.getInstance(myProject).getContentManager().showRunContent(defaultExecutor, myDescriptor);
    // Request focus
    final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(defaultExecutor.getId());
    window.activate(() -> IdeFocusManager.getInstance(myProject).requestFocus(toFocus, true));
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow)

Example 8 with ToolWindow

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

the class TerminalToolWindowPanel method initTerminal.

public void initTerminal(final ToolWindow toolWindow) {
    LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
    toolWindow.setToHideOnEmptyContent(true);
    Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
    toolWindow.getContentManager().addContent(content);
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {

        @Override
        public void toolWindowRegistered(@NotNull String id) {
        }

        @Override
        public void stateChanged() {
            ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(TerminalToolWindowFactory.TOOL_WINDOW_ID);
            if (window != null) {
                boolean visible = window.isVisible();
                if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                    initTerminal(window);
                }
            }
        }
    });
    Disposer.register(myProject, new Disposable() {

        @Override
        public void dispose() {
            if (myTerminalWidget != null) {
                myTerminalWidget.dispose();
                myTerminalWidget = null;
            }
        }
    });
    if (myDockContainer == null) {
        myDockContainer = new TerminalDockContainer(toolWindow);
        Disposer.register(myProject, myDockContainer);
        DockManager.getInstance(myProject).register(myDockContainer);
    }
}
Also used : ToolWindowManagerListener(com.intellij.openapi.wm.ex.ToolWindowManagerListener) Disposable(com.intellij.openapi.Disposable) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) DockableContent(com.intellij.ui.docking.DockableContent) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 9 with ToolWindow

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

the class EvalExpressionDialog method init.

protected void init() {
    final ToolWindow findWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.FIND);
    final boolean available = findWindow != null && findWindow.isAvailable();
    myForm.getNewTabCheckbox().setEnabled(available);
    myForm.getNewTabCheckbox().setSelected(FindSettings.getInstance().isShowResultsInSeparateView());
    myForm.getHighlightCheckbox().setSelected(mySettings.HIGHLIGHT_RESULTS);
    myForm.getHighlightCheckbox().addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            updateOkAction();
        }
    });
    myForm.getUsageViewCheckbox().setSelected(mySettings.SHOW_USAGE_VIEW);
    myForm.getUsageViewCheckbox().addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            myForm.getNewTabCheckbox().setEnabled(available && myForm.getUsageViewCheckbox().isSelected());
            updateOkAction();
        }
    });
    super.init();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ItemEvent(java.awt.event.ItemEvent) ItemListener(java.awt.event.ItemListener)

Example 10 with ToolWindow

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

the class IntersectingLocalChangesPanel method showInVersionControlToolWindow.

@SuppressWarnings("SameParameterValue")
public static void showInVersionControlToolWindow(@NotNull Project project, @NotNull String title, @NotNull List<FilePath> files, @NotNull String prompt) {
    IntersectingLocalChangesPanel intersectingPanel = new IntersectingLocalChangesPanel(project, files, prompt);
    Content content = ContentFactory.SERVICE.getInstance().createContent(intersectingPanel.myPanel, title, true);
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
    addContent(toolWindow.getContentManager(), content, true);
    toolWindow.activate(null);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ContentsUtil.addContent(com.intellij.util.ContentsUtil.addContent) Content(com.intellij.ui.content.Content)

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