Search in sources :

Example 46 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class FavoritesViewToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    final ContentManager contentManager = toolWindow.getContentManager();
    final FavoritesTreeViewPanel panel = new FavoritesPanel(project).getPanel();
    panel.setupToolWindow((ToolWindowEx) toolWindow);
    final Content content = contentManager.getFactory().createContent(panel, null, false);
    contentManager.addContent(content);
}
Also used : FavoritesPanel(com.intellij.ide.favoritesTreeView.FavoritesPanel) FavoritesTreeViewPanel(com.intellij.ide.favoritesTreeView.FavoritesTreeViewPanel) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 47 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class GridCellImpl method updateSelection.

public void updateSelection(final boolean isShowing) {
    ContentManager contentManager = myContext.getContentManager();
    if (contentManager.isDisposed())
        return;
    for (Content each : myContents.getKeys()) {
        final TabInfo eachTab = getTabFor(each);
        boolean isSelected = eachTab != null && myTabs.getSelectedInfo() == eachTab;
        if (isSelected && isShowing) {
            contentManager.addSelectedContent(each);
        } else {
            contentManager.removeFromSelection(each);
        }
    }
    for (Content each : myMinimizedContents) {
        contentManager.removeFromSelection(each);
    }
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) TabInfo(com.intellij.ui.tabs.TabInfo)

Example 48 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class MavenProjectsNavigator method initToolWindow.

private void initToolWindow() {
    initTree();
    JPanel panel = new MavenProjectsNavigatorPanel(myProject, myTree);
    AnAction removeAction = EmptyAction.wrap(ActionManager.getInstance().getAction("Maven.RemoveRunConfiguration"));
    removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree, myProject);
    AnAction editSource = EmptyAction.wrap(ActionManager.getInstance().getAction("Maven.EditRunConfiguration"));
    editSource.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree, myProject);
    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
    myToolWindow = (ToolWindowEx) manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.RIGHT, myProject, true);
    myToolWindow.setIcon(MavenIcons.ToolWindowMaven);
    final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
    final Content content = contentFactory.createContent(panel, "", false);
    ContentManager contentManager = myToolWindow.getContentManager();
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {

        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (myToolWindow.isDisposed())
                return;
            boolean visible = myToolWindow.isVisible();
            if (!visible || wasVisible) {
                return;
            }
            scheduleStructureUpdate();
            wasVisible = true;
        }
    };
    manager.addToolWindowManagerListener(listener, myProject);
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(actionManager.getAction("Maven.GroupProjects"));
    group.add(actionManager.getAction("Maven.ShowIgnored"));
    group.add(actionManager.getAction("Maven.ShowBasicPhasesOnly"));
    group.add(actionManager.getAction("Maven.AlwaysShowArtifactId"));
    group.add(actionManager.getAction("Maven.ShowVersions"));
    myToolWindow.setAdditionalGearActions(group);
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ContentFactory(com.intellij.ui.content.ContentFactory) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 49 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class DynamicToolWindowWrapper method getToolWindow.

public ToolWindow getToolWindow() {
    if (myToolWindow == null) {
        myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(GroovyBundle.message("dynamic.tool.window.id"), true, ToolWindowAnchor.RIGHT);
        myToolWindow.setIcon(JetgroovyIcons.Groovy.DynamicProperty_13);
        myToolWindow.setTitle(GroovyBundle.message("dynamic.window"));
        myToolWindow.setToHideOnEmptyContent(true);
        final JPanel panel = buildBigPanel();
        final ContentManager contentManager = myToolWindow.getContentManager();
        final Content content = contentManager.getFactory().createContent(panel, "", false);
        content.setPreferredFocusableComponent(myTreeTable);
        contentManager.addContent(content);
    }
    return myToolWindow;
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 50 with ContentManager

use of com.intellij.ui.content.ContentManager in project intellij-community by JetBrains.

the class MvcProjectViewPane method setup.

public void setup(ToolWindowEx toolWindow) {
    JPanel p = new JPanel(new BorderLayout());
    p.add(myComponent, BorderLayout.CENTER);
    ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(p, null, false);
    content.setDisposer(this);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(createComponent());
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new HideEmptyMiddlePackagesAction());
    group.add(myAutoScrollToSourceHandler.createToggleAction());
    group.add(myAutoScrollFromSourceHandler.createToggleAction());
    toolWindow.setAdditionalGearActions(group);
    TreeExpander expander = new DefaultTreeExpander(myTree);
    CommonActionsManager actionsManager = CommonActionsManager.getInstance();
    AnAction collapseAction = actionsManager.createCollapseAllAction(expander, myTree);
    collapseAction.getTemplatePresentation().setIcon(AllIcons.General.CollapseAll);
    toolWindow.setTitleActions(new AnAction[] { new ScrollFromSourceAction(), collapseAction });
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Aggregations

ContentManager (com.intellij.ui.content.ContentManager)62 Content (com.intellij.ui.content.Content)45 ToolWindow (com.intellij.openapi.wm.ToolWindow)16 Project (com.intellij.openapi.project.Project)6 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)5 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)4 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)4 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)4 ContentFactory (com.intellij.ui.content.ContentFactory)4 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)3 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)3 ContentManagerEvent (com.intellij.ui.content.ContentManagerEvent)3 ConsoleView (com.intellij.execution.ui.ConsoleView)2 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)2 HierarchyBrowserBase (com.intellij.ide.hierarchy.HierarchyBrowserBase)2 Disposable (com.intellij.openapi.Disposable)2 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)2 ContentManagerAdapter (com.intellij.ui.content.ContentManagerAdapter)2 TabInfo (com.intellij.ui.tabs.TabInfo)2 FlutterApp (io.flutter.run.daemon.FlutterApp)2