Search in sources :

Example 11 with Content

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

the class MvcConsole method setUpToolWindow.

private Content setUpToolWindow() {
    //Create runner UI layout
    final RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(myProject);
    final RunnerLayoutUi layoutUi = factory.create("", "", "session", myProject);
    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(myKillAction);
    group.addSeparator();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
    final Content console = layoutUi.createContent(CONSOLE_ID, myConsole.getComponent(), "", null, null);
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);
    final JComponent uiComponent = layoutUi.getComponent();
    myPanel.add(uiComponent, BorderLayout.CENTER);
    final ContentManager manager = myToolWindow.getContentManager();
    final ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    final Content content = contentFactory.createContent(uiComponent, null, true);
    manager.addContent(content);
    return content;
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) ContentFactory(com.intellij.ui.content.ContentFactory)

Example 12 with Content

use of com.intellij.ui.content.Content 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)

Example 13 with Content

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

the class StudyCheckUtils method showTestResultsToolWindow.

public static void showTestResultsToolWindow(@NotNull final Project project, @NotNull final String message, boolean solved) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
    if (window == null) {
        toolWindowManager.registerToolWindow(StudyTestResultsToolWindowFactoryKt.ID, true, ToolWindowAnchor.BOTTOM);
        window = toolWindowManager.getToolWindow(StudyTestResultsToolWindowFactoryKt.ID);
        new StudyTestResultsToolWindowFactory().createToolWindowContent(project, window);
    }
    final Content[] contents = window.getContentManager().getContents();
    for (Content content : contents) {
        final JComponent component = content.getComponent();
        if (component instanceof ConsoleViewImpl) {
            ((ConsoleViewImpl) component).clear();
            if (!solved) {
                ((ConsoleViewImpl) component).print(message, ConsoleViewContentType.ERROR_OUTPUT);
            } else {
                ((ConsoleViewImpl) component).print(message, ConsoleViewContentType.NORMAL_OUTPUT);
            }
            window.setAvailable(true, () -> {
            });
            window.show(() -> {
            });
            return;
        }
    }
}
Also used : StudyTestResultsToolWindowFactory(com.jetbrains.edu.learning.ui.StudyTestResultsToolWindowFactory) Content(com.intellij.ui.content.Content) ConsoleViewImpl(com.intellij.execution.impl.ConsoleViewImpl)

Example 14 with Content

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

the class SvnMergeSourceDetails method showMe.

public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) {
    if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
        ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
        final ContentManager contentManager = toolWindow.getContentManager();
        final MyDialog dialog = new MyDialog(project, revision, file);
        // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
        Disposer.register(project, dialog.getDisposable());
        Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(), SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
        ContentsUtil.addOrReplaceContent(contentManager, content, true);
        toolWindow.activate(null);
    } else {
        new MyDialog(project, revision, file).show();
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 15 with Content

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

the class PyEduDebugProcess method createTabLayouter.

@NotNull
@Override
public XDebugTabLayouter createTabLayouter() {
    return new XDebugTabLayouter() {

        @NotNull
        @Override
        public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) {
            final PythonDebugLanguageConsoleView view = ((PythonDebugLanguageConsoleView) console);
            view.initialized();
            view.enableConsole(false);
            Content eduConsole = ui.createContent("EduConsole", view.getComponent(), XDebuggerBundle.message("debugger.session.tab.console.content.name"), AllIcons.Debugger.ToolConsole, view.getPreferredFocusableComponent());
            eduConsole.setCloseable(false);
            ui.addContent(eduConsole, 0, PlaceInGrid.right, false);
            return eduConsole;
        }
    };
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) Content(com.intellij.ui.content.Content) XDebugTabLayouter(com.intellij.xdebugger.ui.XDebugTabLayouter) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Content (com.intellij.ui.content.Content)157 ContentManager (com.intellij.ui.content.ContentManager)42 ToolWindow (com.intellij.openapi.wm.ToolWindow)37 NotNull (org.jetbrains.annotations.NotNull)19 ContentFactory (com.intellij.ui.content.ContentFactory)14 Project (com.intellij.openapi.project.Project)13 Nullable (org.jetbrains.annotations.Nullable)13 MessageView (com.intellij.ui.content.MessageView)10 Disposable (com.intellij.openapi.Disposable)8 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)8 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)7 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)7 ConsoleView (com.intellij.execution.ui.ConsoleView)6 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)6 TabbedContent (com.intellij.ui.content.TabbedContent)6 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)5 Ref (com.intellij.openapi.util.Ref)5 ExecutionConsole (com.intellij.execution.ui.ExecutionConsole)4 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)4 Assert.assertNotNull (junit.framework.Assert.assertNotNull)4