Search in sources :

Example 56 with ContentManager

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

the class PyExecuteSelectionAction method selectConsole.

private static void selectConsole(@NotNull DataContext dataContext, @NotNull Project project, final Consumer<PyCodeExecutor> consumer, Editor editor) {
    Collection<RunContentDescriptor> consoles = getConsoles(project);
    ExecutionHelper.selectContentDescriptor(dataContext, project, consoles, "Select console to execute in", descriptor -> {
        if (descriptor != null && descriptor.getExecutionConsole() instanceof PyCodeExecutor) {
            ExecutionConsole console = descriptor.getExecutionConsole();
            consumer.consume((PyCodeExecutor) console);
            if (console instanceof PythonDebugLanguageConsoleView) {
                XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
                if (currentSession != null) {
                    ContentManager contentManager = currentSession.getUI().getContentManager();
                    Content content = contentManager.findContent("Console");
                    contentManager.setSelectedContent(content);
                    IdeFocusManager.findInstance().requestFocus(editor.getContentComponent(), true);
                }
            } else {
                PythonConsoleToolWindow consoleToolWindow = PythonConsoleToolWindow.getInstance(project);
                ToolWindow toolWindow = consoleToolWindow != null ? consoleToolWindow.getToolWindow() : null;
                if (toolWindow != null && !toolWindow.isVisible()) {
                    toolWindow.show(null);
                    ContentManager contentManager = toolWindow.getContentManager();
                    Content content = contentManager.findContent(descriptor.getDisplayName());
                    if (content != null) {
                        contentManager.setSelectedContent(content);
                    }
                }
            }
        }
    });
}
Also used : XDebugSession(com.intellij.xdebugger.XDebugSession) ToolWindow(com.intellij.openapi.wm.ToolWindow) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole)

Example 57 with ContentManager

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

the class StudyToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    toolWindow.setIcon(InteractiveLearningIcons.TaskDescription);
    StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
    final Course course = taskManager.getCourse();
    if (course != null) {
        final StudyToolWindow studyToolWindow;
        if (StudyUtils.hasJavaFx() && taskManager.shouldUseJavaFx()) {
            studyToolWindow = new StudyJavaFxToolWindow();
        } else {
            studyToolWindow = new StudySwingToolWindow();
        }
        studyToolWindow.init(project, true);
        final ContentManager contentManager = toolWindow.getContentManager();
        final Content content = contentManager.getFactory().createContent(studyToolWindow, null, false);
        contentManager.addContent(content);
        Disposer.register(project, studyToolWindow);
    }
}
Also used : Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) StudyTaskManager(com.jetbrains.edu.learning.StudyTaskManager) Course(com.jetbrains.edu.learning.courseFormat.Course)

Example 58 with ContentManager

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

the class ObservatoryActionGroup method removeEmptyContent.

private void removeEmptyContent(ToolWindow toolWindow) {
    final ContentManager contentManager = toolWindow.getContentManager();
    contentManager.removeContent(emptyContent, true);
    toolWindow.setIcon(ExecutionUtil.getLiveIndicator(FlutterIcons.Flutter_13));
    emptyContent = null;
}
Also used : ContentManager(com.intellij.ui.content.ContentManager)

Example 59 with ContentManager

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

the class ObservatoryActionGroup method displayEmptyContent.

private void displayEmptyContent(ToolWindow toolWindow) {
    // Display a 'No running applications' message.
    final ContentManager contentManager = toolWindow.getContentManager();
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel label = new JLabel("No running applications", SwingConstants.CENTER);
    label.setForeground(UIUtil.getLabelDisabledForeground());
    panel.add(label, BorderLayout.CENTER);
    emptyContent = contentManager.getFactory().createContent(panel, null, false);
    contentManager.addContent(emptyContent);
    toolWindow.setIcon(FlutterIcons.Flutter_13);
}
Also used : ContentManager(com.intellij.ui.content.ContentManager)

Example 60 with ContentManager

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

the class FlutterConsole method bringToFront.

/**
 * Moves this console to the end of the tool window's tab list, selects it, and shows the tool window.
 */
void bringToFront() {
    // Move the tab to be last and select it.
    final MessageView messageView = MessageView.SERVICE.getInstance(project);
    final ContentManager contentManager = messageView.getContentManager();
    contentManager.addContent(content);
    contentManager.setSelectedContent(content);
    // Show the panel.
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
    toolWindow.activate(null, true);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MessageView(com.intellij.ui.content.MessageView) 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