Search in sources :

Example 26 with ContentManager

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

the class CaptureEditorLightToolWindowManager method initToolWindow.

@Override
protected void initToolWindow() {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(getManagerName(), false, getAnchor(), myProject, true);
    myToolWindow.setIcon(getIcon());
    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
        myToolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
    }
    ((ToolWindowEx) myToolWindow).setTitleActions(createActions());
    initGearActions();
    ContentManager contentManager = myToolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(getContent(), getToolWindowTitleBarText(), false);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(getFocusedComponent());
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    myToolWindow.setAvailable(false, null);
}
Also used : ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 27 with ContentManager

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

the class NlPreviewManager method initToolWindow.

protected void initToolWindow() {
    myToolWindowForm = new NlPreviewForm(this);
    final String toolWindowId = getToolWindowId();
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(toolWindowId, false, ToolWindowAnchor.RIGHT, myProject, true);
    myToolWindow.setIcon(AndroidIcons.AndroidPreview);
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (myProject.isDisposed()) {
                return;
            }
            final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(toolWindowId);
            if (window != null && window.isAvailable()) {
                final boolean visible = window.isVisible();
                AndroidEditorSettings.getInstance().getGlobalState().setVisible(visible);
                if (myToolWindowForm != null) {
                    if (visible) {
                        myToolWindowForm.activate();
                    } else {
                        myToolWindowForm.deactivate();
                    }
                }
            }
        }
    });
    final JComponent contentPanel = myToolWindowForm.getComponent();
    final ContentManager contentManager = myToolWindow.getContentManager();
    @SuppressWarnings("ConstantConditions") final Content content = contentManager.getFactory().createContent(contentPanel, null, false);
    content.setDisposer(myToolWindowForm);
    content.setCloseable(false);
    content.setPreferredFocusableComponent(contentPanel);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, true);
    myToolWindow.setAvailable(false, null);
    myToolWindowForm.setUseInteractiveSelector(isUseInteractiveSelector());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 28 with ContentManager

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

the class DartPubActionBase method showPubOutputConsole.

private static void showPubOutputConsole(@NotNull final Module module, @NotNull final GeneralCommandLine command, @NotNull final OSProcessHandler processHandler, @NotNull final VirtualFile pubspecYamlFile, @NotNull final String actionTitle) {
    final ConsoleView console;
    PubToolWindowContentInfo info = findExistingInfoForCommand(module.getProject(), command);
    if (info != null) {
        // rerunning the same pub command in the same tool window tab (corresponding tool window action invoked)
        console = info.console;
        console.clear();
    } else {
        console = createConsole(module.getProject(), pubspecYamlFile);
        info = new PubToolWindowContentInfo(module, pubspecYamlFile, command, actionTitle, console);
        final ActionToolbar actionToolbar = createToolWindowActionsBar(info);
        final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
        toolWindowPanel.setContent(console.getComponent());
        toolWindowPanel.setToolbar(actionToolbar.getComponent());
        final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(), actionTitle, true);
        content.putUserData(PUB_TOOL_WINDOW_CONTENT_INFO_KEY, info);
        Disposer.register(content, console);
        final ContentManager contentManager = MessageView.SERVICE.getInstance(module.getProject()).getContentManager();
        removeOldTabs(contentManager);
        contentManager.addContent(content);
        contentManager.setSelectedContent(content);
        final ToolWindow toolWindow = ToolWindowManager.getInstance(module.getProject()).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        toolWindow.activate(null, true);
    }
    info.rerunPubCommandAction.setProcessHandler(processHandler);
    info.stopProcessAction.setProcessHandler(processHandler);
    processHandler.addProcessListener(new ProcessAdapter() {

        @Override
        public void processTerminated(final ProcessEvent event) {
            console.print(IdeBundle.message("finished.with.exit.code.text.message", event.getExitCode()), ConsoleViewContentType.SYSTEM_OUTPUT);
        }
    });
    console.print(DartBundle.message("working.dir.0", FileUtil.toSystemDependentName(pubspecYamlFile.getParent().getPath())) + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
    console.attachToProcess(processHandler);
    processHandler.startNotify();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessEvent(com.intellij.execution.process.ProcessEvent) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel)

Example 29 with ContentManager

use of com.intellij.ui.content.ContentManager in project buck by facebook.

the class BuckToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
    toolWindow.setAvailable(true, null);
    toolWindow.setToHideOnEmptyContent(true);
    toolWindow.setIcon(BuckIcons.BUCK_TOOL_WINDOW_ICON);
    RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
    BuckSettingsProvider.State state = BuckSettingsProvider.getInstance().getState();
    JBTabs myTabs = new JBTabsImpl(project);
    // Debug Console
    if (state.showDebug) {
        Content consoleContent = createConsoleContent(runnerLayoutUi, project);
        myTabs.addTab(new TabInfo(consoleContent.getComponent())).setText("Debug");
    }
    // Build Tree Events
    Content treeViewContent = runnerLayoutUi.createContent(BUILD_OUTPUT_PANEL, createBuildInfoPanel(project), "Build Output", null, null);
    myTabs.addTab(new TabInfo(treeViewContent.getComponent()).setText("Build"));
    Content tabsContent = runnerLayoutUi.createContent(TABS_CONTENT_ID, myTabs.getComponent(), "Buck Tool Tabs", null, null);
    runnerLayoutUi.addContent(tabsContent, 0, PlaceInGrid.center, false);
    runnerLayoutUi.getOptions().setLeftToolbar(getLeftToolbarActions(project), ActionPlaces.UNKNOWN);
    runnerLayoutUi.updateActionsNow();
    final ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(runnerLayoutUi.getComponent(), "", true);
    contentManager.addContent(content);
    updateBuckToolWindowTitle(project);
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) JBTabs(com.intellij.ui.tabs.JBTabs) JBTabsImpl(com.intellij.ui.tabs.impl.JBTabsImpl) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) BuckSettingsProvider(com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider) TabInfo(com.intellij.ui.tabs.TabInfo)

Example 30 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)

Aggregations

ContentManager (com.intellij.ui.content.ContentManager)53 Content (com.intellij.ui.content.Content)41 ToolWindow (com.intellij.openapi.wm.ToolWindow)14 Project (com.intellij.openapi.project.Project)6 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)4 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)4 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)3 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)3 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)3 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)3 ContentFactory (com.intellij.ui.content.ContentFactory)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 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 TabInfo (com.intellij.ui.tabs.TabInfo)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2