Example usage for com.intellij.openapi.ui SimpleToolWindowPanel getComponent

List of usage examples for com.intellij.openapi.ui SimpleToolWindowPanel getComponent

Introduction

In this page you can find the example usage for com.intellij.openapi.ui SimpleToolWindowPanel getComponent.

Prototype

@Override
    public JComponent getComponent() 

Source Link

Usage

From source file:io.flutter.console.FlutterConsole.java

License:Open Source License

private static void show(@NotNull Module module, @NotNull ConsoleView console, String processTitle) {
    final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
    toolWindowPanel.setContent(console.getComponent());

    final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(),
            processTitle, true);//from  ww w  . ja v a  2 s .c  om
    Disposer.register(content, console);

    final Project project = module.getProject();

    final MessageView messageView = MessageView.SERVICE.getInstance(project);
    messageView.runWhenInitialized(() -> {
        final ContentManager contentManager = messageView.getContentManager();
        contentManager.addContent(content);
        contentManager.setSelectedContent(content);

        final ToolWindow toolWindow = ToolWindowManager.getInstance(project)
                .getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        toolWindow.activate(null, true);
    });
}

From source file:io.flutter.console.FlutterConsoleHelper.java

License:Open Source License

/**
 * We share one Flutter console per Module, and have one global Flutter console (for tasks which don't
 * take a module, like 'flutter doctor'). We could revisit to have one global, shared flutter console
 * instance./*  w  w  w  .ja va2 s .com*/
 */
private static void show(@NotNull Project project, @Nullable Module module,
        @NotNull OSProcessHandler processHandler, @Nullable Runnable runOnActive) {
    final MessageView messageView = MessageView.SERVICE.getInstance(project);

    messageView.runWhenInitialized(() -> {
        final ToolWindow toolWindow = ToolWindowManager.getInstance(project)
                .getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        final ContentManager contentManager = messageView.getContentManager();
        FlutterConsoleInfo info = findExistingInfoForCommand(project, module);

        if (info != null) {
            info.console.clear();
            contentManager.setSelectedContent(info.content);
        } else {
            final ConsoleView console = createConsole(project, module);
            info = new FlutterConsoleInfo(console, module);

            final String title = module != null ? "[" + module.getName() + "] Flutter" : "Flutter";
            final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
            toolWindowPanel.setContent(info.console.getComponent());

            info.content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(),
                    title, true);
            info.content.putUserData(FLUTTER_MESSAGES_KEY, info);
            Disposer.register(info.content, info.console);

            contentManager.addContent(info.content);
            contentManager.setSelectedContent(info.content);
        }
        info.console.attachToProcess(processHandler);
        toolWindow.activate(runOnActive, true);
    });
}