Search in sources :

Example 51 with ContentManager

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

the class PaletteToolWindowManager method initToolWindow.

@Override
protected void initToolWindow() {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(IdeBundle.message("toolwindow.palette"), false, getAnchor(), myProject, true);
    myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);
    initGearActions();
    ContentManager contentManager = myToolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(myToolWindowPanel, null, false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(myToolWindowPanel);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    myToolWindow.setAvailable(false, null);
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 52 with ContentManager

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

the class FileHistorySessionPartner method createOrSelectContentIfNeeded.

private void createOrSelectContentIfNeeded() {
    ToolWindow toolWindow = getToolWindow(myVcs.getProject());
    if (myRefresherI.isFirstTime()) {
        ContentManager manager = toolWindow.getContentManager();
        boolean selectedExistingContent = ContentUtilEx.selectContent(manager, myFileHistoryPanel, true);
        if (!selectedExistingContent) {
            String tabName = myPath.getName();
            if (myStartingRevisionNumber != null) {
                tabName += " (";
                if (myStartingRevisionNumber instanceof ShortVcsRevisionNumber) {
                    tabName += ((ShortVcsRevisionNumber) myStartingRevisionNumber).toShortString();
                } else {
                    tabName += myStartingRevisionNumber.asString();
                }
                tabName += ")";
            }
            ContentUtilEx.addTabbedContent(manager, myFileHistoryPanel, "History", tabName, true);
        }
        toolWindow.activate(null);
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ContentManager(com.intellij.ui.content.ContentManager)

Example 53 with ContentManager

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

the class PaletteToolWindowManager method initToolWindow.

//////////////////////////////////////////////////////////////////////////////////////////
//
// Impl
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void initToolWindow() {
    if (myToolWindowPanel == null) {
        myToolWindowPanel = new PalettePanel();
    }
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow("Palette\t", false, getAnchor(), myProject, true);
    myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPalette);
    initGearActions();
    ContentManager contentManager = myToolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(myToolWindowPanel, null, false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(myToolWindowPanel);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    myToolWindow.setAvailable(false, null);
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 54 with ContentManager

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

the class CloseLogTabAction method actionPerformed.

public void actionPerformed(@NotNull AnActionEvent e) {
    VcsLogUtil.triggerUsage(e);
    Project project = e.getProject();
    assert project != null;
    ContentManager contentManager = getContentManager(project);
    if (contentManager == null)
        return;
    Content selectedContent = getTabbedContent(contentManager);
    if (selectedContent != null) {
        ContentsUtil.closeContentTab(contentManager, selectedContent);
    }
}
Also used : Project(com.intellij.openapi.project.Project) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 55 with ContentManager

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

the class GitShowExternalLogAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    final GitVcs vcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
    final List<VirtualFile> roots = getGitRootsFromUser(project);
    if (roots.isEmpty()) {
        return;
    }
    if (project.isDefault() || !ProjectLevelVcsManager.getInstance(project).hasActiveVcss()) {
        ProgressManager.getInstance().run(new ShowLogInDialogTask(project, roots, vcs));
        return;
    }
    final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
    final Runnable showContent = () -> {
        ContentManager cm = window.getContentManager();
        if (checkIfProjectLogMatches(project, vcs, cm, roots) || checkIfAlreadyOpened(cm, roots)) {
            return;
        }
        String tabName = calcTabName(cm, roots);
        MyContentComponent component = createManagerAndContent(project, vcs, roots, tabName);
        Content content = ContentFactory.SERVICE.getInstance().createContent(component, tabName, false);
        content.setDisposer(component.myDisposable);
        content.setDescription("Log for " + StringUtil.join(roots, VirtualFile::getPath, "\n"));
        content.setCloseable(true);
        cm.addContent(content);
        cm.setSelectedContent(content);
    };
    if (!window.isVisible()) {
        window.activate(showContent, true);
    } else {
        showContent.run();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) GitVcs(git4idea.GitVcs) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ChangesViewContentManager(com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager) 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