com.intellij.ui.content.ContentFactory Java Examples

The following examples show how to use com.intellij.ui.content.ContentFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnalyzeSizeToolWindowFactory.java    From size-analyzer with Apache License 2.0 6 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
  ContentManager contentManager = toolWindow.getContentManager();
  AnalyzeSizeToolWindow analyzeSizeToolWindow =
      new AnalyzeSizeToolWindow(
          toolWindow,
          project,
          categorizedSuggestions,
          categoryDisplayOrder
          );
  Content content =
      ContentFactory.SERVICE
          .getInstance()
          .createContent(analyzeSizeToolWindow.getContent(), CONTENT_TITLE, false);
  // We want only one content tab to exist at a time, but clearing all of them will cause the
  // tool window to disappear, so we add the new tab and remove the others after.
  contentManager.addContent(content);
  contentManager.setSelectedContent(content);
  for (Content otherContent : contentManager.getContents()) {
    if (otherContent != content) {
      contentManager.removeContent(otherContent, true);
    }
  }
  toolWindow.show(null);
}
 
Example #2
Source File: PantsConsoleManager.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
private static void initializeConsolePanel(Project project, ConsoleView console) {
  ToolWindow window =
    ToolWindowManager.getInstance(project).registerToolWindow(
      PantsConstants.PANTS_CONSOLE_NAME,
      true,
      ToolWindowAnchor.BOTTOM,
      project,
      true
    );

  window.setIcon(PantsIcons.Icon);

  PantsConsoleViewPanel pantsConsoleViewPanel = new PantsConsoleViewPanel(project, console);
  final boolean isLockable = true;
  final String displayName = "";
  Content pantsConsoleContent = ContentFactory.SERVICE.getInstance().createContent(pantsConsoleViewPanel, displayName, isLockable);
  pantsConsoleContent.setCloseable(false);
  window.getContentManager().addContent(pantsConsoleContent);
}
 
Example #3
Source File: ANTLRv4PluginController.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void createToolWindows() {
	LOG.info("createToolWindows "+project.getName());
	ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);

	previewPanel = new PreviewPanel(project);

	ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
	Content content = contentFactory.createContent(previewPanel, "", false);
	content.setCloseable(false);

	previewWindow = toolWindowManager.registerToolWindow(PREVIEW_WINDOW_ID, true, ToolWindowAnchor.BOTTOM);
	previewWindow.getContentManager().addContent(content);
	previewWindow.setIcon(Icons.getToolWindow());

	TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
	TextConsoleBuilder consoleBuilder = factory.createBuilder(project);
	this.console = consoleBuilder.getConsole();

	JComponent consoleComponent = console.getComponent();
	content = contentFactory.createContent(consoleComponent, "", false);
	content.setCloseable(false);

	consoleWindow = toolWindowManager.registerToolWindow(CONSOLE_WINDOW_ID, true, ToolWindowAnchor.BOTTOM);
	consoleWindow.getContentManager().addContent(content);
	consoleWindow.setIcon(Icons.getToolWindow());
}
 
Example #4
Source File: EmbeddedLinuxJVMConsoleView.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Creats the tool window content
 * @param toolWindow
 */
public void createToolWindowContent(@NotNull ToolWindow toolWindow) {
    //Create runner UI layout
    RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
    RunnerLayoutUi layoutUi = factory.create("", "", "session", project);

    // Adding actions
    DefaultActionGroup group = new DefaultActionGroup();
    layoutUi.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);

    Content console = layoutUi.createContent(EmbeddedLinuxJVMToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
    AnAction[] consoleActions = consoleView.createConsoleActions();
    for (AnAction action : consoleActions) {
        if (!shouldIgnoreAction(action)) {
            group.add(action);
        }
    }
    layoutUi.addContent(console, 0, PlaceInGrid.right, false);

    JComponent layoutComponent = layoutUi.getComponent();
    myConsolePanel.add(layoutComponent, BorderLayout.CENTER);
    Content content = ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
    toolWindow.getContentManager().addContent(content);
}
 
Example #5
Source File: DataSourcesView.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 6 votes vote down vote up
public void initToolWindow(Project project, ToolWindow toolWindow) {
    if (!initialized) {
        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
        Content content = contentFactory.createContent(toolWindowContent, "", false);
        toolWindow.getContentManager().addContent(content);

        component = project.getComponent(DataSourcesComponent.class);
        componentMetadata = project.getComponent(DataSourcesComponentMetadata.class);
        dataSourceMetadataUi = new DataSourceMetadataUi(componentMetadata);
        treeRoot = new PatchedDefaultMutableTreeNode(new RootTreeNodeModel());
        treeModel = new DefaultTreeModel(treeRoot, false);
        decorator = ToolbarDecorator.createDecorator(dataSourceTree);
        decorator.addExtraAction(new RefreshDataSourcesAction(this));

        configureDataSourceTree();
        decorateDataSourceTree();

        interactions = new DataSourceInteractions(project, this);

        replaceTreeWithDecorated();
        showDataSources();
        refreshDataSourcesMetadata();

        initialized = true;
    }
}
 
Example #6
Source File: ProjectLevelVcsManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Content getOrCreateConsoleContent(final ContentManager contentManager) {
  final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name");
  Content content = contentManager.findContent(displayName);
  if (content == null) {
    releaseConsole();

    myConsole = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole();

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(myConsole.getComponent(), BorderLayout.CENTER);

    ActionToolbar toolbar = ActionManager.getInstance()
            .createActionToolbar("VcsManager", new DefaultActionGroup(myConsole.createConsoleActions()), false);
    panel.add(toolbar.getComponent(), BorderLayout.WEST);

    content = ContentFactory.getInstance().createContent(panel, displayName, true);
    content.setDisposer(myConsoleDisposer);
    contentManager.addContent(content);

    for (Pair<String, ConsoleViewContentType> pair : myPendingOutput) {
      printToConsole(pair.first, pair.second);
    }
    myPendingOutput.clear();
  }
  return content;
}
 
Example #7
Source File: AbstractVcsHelperImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
      messageView.runWhenInitialized(new Runnable() {
        @Override
        public void run() {
          final Content content =
                  ContentFactory.getInstance().createContent(errorTreeView, tabDisplayName, true);
          messageView.getContentManager().addContent(content);
          Disposer.register(content, errorTreeView);
          messageView.getContentManager().setSelectedContent(content);
          removeContents(content, tabDisplayName);

          ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
        }
      });
    }
  }, VcsBundle.message("command.name.open.error.message.view"), null);
}
 
Example #8
Source File: FlutterConsole.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
static FlutterConsole create(@NotNull Project project, @Nullable Module module) {
  final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
  builder.setViewer(true);
  if (module != null) {
    builder.addFilter(new FlutterConsoleFilter(module));
  }
  final ConsoleView view = builder.getConsole();

  final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
  panel.setContent(view.getComponent());

  final String title = module != null ? "[" + module.getName() + "] Flutter" : "Flutter";
  final Content content = ContentFactory.SERVICE.getInstance().createContent(panel.getComponent(), title, true);
  Disposer.register(content, view);

  return new FlutterConsole(view, content, project, module);
}
 
Example #9
Source File: FlutterConsole.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@NotNull
static FlutterConsole create(@NotNull Project project, @Nullable Module module) {
  final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
  builder.setViewer(true);
  if (module != null) {
    builder.addFilter(new FlutterConsoleFilter(module));
  }
  final ConsoleView view = builder.getConsole();

  final SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true);
  panel.setContent(view.getComponent());

  final String title = module != null ? "[" + module.getName() + "] Flutter" : "Flutter";
  final Content content = ContentFactory.SERVICE.getInstance().createContent(panel.getComponent(), title, true);
  Disposer.register(content, view);

  return new FlutterConsole(view, content, project, module);
}
 
Example #10
Source File: ToolWindowFactory.java    From adc with Apache License 2.0 6 votes vote down vote up
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    JPanel framePanel = createPanel(project);
    disableAll();

    AndroidDebugBridge adb = AndroidSdkUtils.getDebugBridge(project);
    if (adb == null) {
        return;
    }

    if(adb.isConnected()){
        ToolWindowFactory.this.adBridge = adb;
        Logger.getInstance(ToolWindowFactory.class).info("Successfully obtained debug bridge");
        AndroidDebugBridge.addDeviceChangeListener(deviceChangeListener);
        updateDeviceComboBox();
    } else {
        Logger.getInstance(ToolWindowFactory.class).info("Unable to obtain debug bridge");
        String msg = MessageFormat.format(resourceBundle.getString("error.message.adb"), "");
        Messages.showErrorDialog(msg, resourceBundle.getString("error.title.adb"));
    }

    Content content = contentFactory.createContent(framePanel, "", false);
    toolWindow.getContentManager().addContent(content);
}
 
Example #11
Source File: DesktopToolWindowImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@RequiredUIAccess
@Override
protected void init(boolean canCloseContent, @Nullable Object component) {
  final ContentFactory contentFactory = ContentFactory.getInstance();
  myContentUI = new DesktopToolWindowContentUi(this);
  ContentManager contentManager = myContentManager = contentFactory.createContentManager(myContentUI, canCloseContent, myToolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent((JComponent)component, "", false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
  }

  myComponent = contentManager.getComponent();

  DesktopInternalDecorator.installFocusTraversalPolicy(myComponent, new LayoutFocusTraversalPolicy());

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(contentManager, notifyConnector);
}
 
Example #12
Source File: IMWindowFactory.java    From SmartIM4IntelliJ with Apache License 2.0 6 votes vote down vote up
private void createContents(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    File dir = new File(getWorkDir(), "SmartIM");
    if (dir.exists()) {
        dir.mkdirs();
    }
    System.setProperty("log.home", dir.getAbsolutePath());
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = null;

    WechatPanel wechatPanel = new WechatPanel(project, toolWindow);
    content = contentFactory.createContent(wechatPanel, "Wechat", false);
    toolWindow.getContentManager().addContent(content, 0);

    SmartQQPanel qqPanel = new SmartQQPanel(project, toolWindow);
    content = contentFactory.createContent(qqPanel, "SmartQQ", false);
    toolWindow.getContentManager().addContent(content, 1);

}
 
Example #13
Source File: DependenciesHandlerBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void onSuccess(final List<DependenciesBuilder> builders) {
  //noinspection SSBasedInspection
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      if (shouldShowDependenciesPanel(builders)) {
        final String displayName = getPanelDisplayName(builders.get(0).getScope());
        DependenciesPanel panel = new DependenciesPanel(myProject, builders, myExcluded);
        Content content = ContentFactory.getInstance().createContent(panel, displayName, false);
        content.setDisposer(panel);
        panel.setContent(content);
        DependenciesToolWindow.getInstance(myProject).addContent(content);
      }
    }
  });
}
 
Example #14
Source File: MuleFacet.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public void initFacet() {

    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            ToolWindowManager manager = ToolWindowManager.getInstance(MuleFacet.this.getModule().getProject());
            List<String> ids = Arrays.asList(manager.getToolWindowIds());

            if (manager.getToolWindow("Global Configs") == null && !ids.contains("Global Configs")) {

                try {
                    ToolWindow toolWindow = manager.registerToolWindow("Global Configs", true, ToolWindowAnchor.LEFT, false);
                    toolWindow.setIcon(MuleIcons.MuleIcon);

                    GlobalConfigsToolWindowPanel toolWindowPanel = new GlobalConfigsToolWindowPanel(MuleFacet.this.getModule().getProject());
                    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
                    Content content = contentFactory.createContent(toolWindowPanel, "", true);
                    toolWindow.getContentManager().addContent(content);
                } catch (Exception e) {
                    logger.error("Unable to initialize toolWindow: ", e);
                }
            }
        }
    });
}
 
Example #15
Source File: TodoView.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void addCustomTodoView(final TodoTreeBuilderFactory factory, final String title, final TodoPanelSettings settings) {
  Content content = ContentFactory.SERVICE.getInstance().createContent(null, title, true);
  final ChangeListTodosPanel panel = new ChangeListTodosPanel(myProject, settings, content) {
    @Override
    protected TodoTreeBuilder createTreeBuilder(JTree tree, Project project) {
      TodoTreeBuilder todoTreeBuilder = factory.createTreeBuilder(tree, project);
      todoTreeBuilder.init();
      return todoTreeBuilder;
    }
  };
  content.setComponent(panel);
  Disposer.register(this, panel);

  if (myContentManager == null) {
    myNotAddedContent.add(content);
  }
  else {
    myContentManager.addContent(content);
  }
  myPanels.add(panel);
  content.setCloseable(true);
  content.setDisposer(new Disposable() {
    @Override
    public void dispose() {
      myPanels.remove(panel);
    }
  });
}
 
Example #16
Source File: WindowFactory.java    From leetcode-editor with Apache License 2.0 5 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {

    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    JComponent navigatorPanel=  new NavigatorPanel(toolWindow,project);
    navigatorPanel.addAncestorListener(new UpdatePluginListener());
    Content content = contentFactory.createContent(navigatorPanel, "", false);
    toolWindow.getContentManager().addContent(content);

}
 
Example #17
Source File: NoSqlWindowManager.java    From nosql4idea with Apache License 2.0 5 votes vote down vote up
public NoSqlWindowManager(Project project) {
    this.project = project;

    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    noSqlExplorerPanel = new NoSqlExplorerPanel(project, DatabaseVendorClientManager.getInstance(project));
    noSqlExplorerPanel.installActions();
    Content nosqlExplorer = ContentFactory.SERVICE.getInstance().createContent(noSqlExplorerPanel, null, false);

    ToolWindow toolNoSqlExplorerWindow = toolWindowManager.registerToolWindow(NOSQL_EXPLORER, false, ToolWindowAnchor.RIGHT);
    toolNoSqlExplorerWindow.getContentManager().addContent(nosqlExplorer);
    toolNoSqlExplorerWindow.setIcon(NOSQL_ICON);
}
 
Example #18
Source File: FloobitsWindowManager.java    From floobits-intellij with Apache License 2.0 5 votes vote down vote up
protected void createChatWindow(Project project) {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    toolWindow = toolWindowManager.registerToolWindow("Floobits", true, ToolWindowAnchor.BOTTOM);
    toolWindow.setIcon(IconLoader.getIcon("/icons/floo13.png"));
    Content content = ContentFactory.SERVICE.getInstance().createContent(chatForm.getChatPanel(), "", true);
    toolWindow.getContentManager().addContent(content);
    updateTitle();
}
 
Example #19
Source File: CrucibleToolWindowFactory.java    From Crucible4IDEA with MIT License 5 votes vote down vote up
@Override
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
  final ContentManager contentManager = toolWindow.getContentManager();
  final CruciblePanel cruciblePanel = new CruciblePanel(project);
  final Content content = ContentFactory.SERVICE.getInstance().
    createContent(cruciblePanel, CrucibleBundle.message("crucible.main.name"), false);
  content.setCloseable(false);
  contentManager.addContent(content);
}
 
Example #20
Source File: UnifiedToolWindowImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
protected void init(boolean canCloseContent, @Nullable Object component) {
  final ContentFactory contentFactory = ContentFactory.getInstance();
  ContentManager contentManager = myContentManager = contentFactory.createContentManager(new UnifiedToolWindowContentUI(this), canCloseContent, myToolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createUIContent((Component)component, "", false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
  }

  myComponent = contentManager.getUIComponent();
}
 
Example #21
Source File: TestErrorViewAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void openView(Project project, JComponent component) {
  final MessageView messageView = MessageView.SERVICE.getInstance(project);
  final Content content = ContentFactory.getInstance().createContent(component, getContentName(), true);
  messageView.getContentManager().addContent(content);
  messageView.getContentManager().setSelectedContent(content);
  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
  if (toolWindow != null) {
    toolWindow.activate(null);
  }
}
 
Example #22
Source File: EventLogToolWindowFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
static void createContent(Project project, ToolWindow toolWindow, EventLogConsole console, String title) {
  // update default Event Log tab title
  ContentManager contentManager = toolWindow.getContentManager();
  Content generalContent = contentManager.getContent(0);
  if (generalContent != null && contentManager.getContentCount() == 1) {
    generalContent.setDisplayName("General");
  }

  final Editor editor = console.getConsoleEditor();

  SimpleToolWindowPanel panel = new SimpleToolWindowPanel(false, true) {
    @Override
    public Object getData(@Nonnull @NonNls Key dataId) {
      return PlatformDataKeys.HELP_ID == dataId ? EventLog.HELP_ID : super.getData(dataId);
    }
  };
  panel.setContent(editor.getComponent());
  panel.addAncestorListener(new LogShownTracker(project));

  ActionToolbar toolbar = createToolbar(project, editor, console);
  toolbar.setTargetComponent(editor.getContentComponent());
  panel.setToolbar(toolbar.getComponent());

  Content content = ContentFactory.getInstance().createContent(panel, title, false);
  contentManager.addContent(content);
  contentManager.setSelectedContent(content);
}
 
Example #23
Source File: BrowseHierarchyActionBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static HierarchyBrowser createAndAddToPanel(@Nonnull Project project, @Nonnull final HierarchyProvider provider, @Nonnull PsiElement target) {
  final HierarchyBrowser hierarchyBrowser = provider.createHierarchyBrowser(target);

  final Content content;

  final HierarchyBrowserManager hierarchyBrowserManager = HierarchyBrowserManager.getInstance(project);

  final ContentManager contentManager = hierarchyBrowserManager.getContentManager();
  final Content selectedContent = contentManager.getSelectedContent();
  if (selectedContent != null && !selectedContent.isPinned()) {
    content = selectedContent;
    final Component component = content.getComponent();
    if (component instanceof Disposable) {
      Disposer.dispose((Disposable)component);
    }
    content.setComponent(hierarchyBrowser.getComponent());
  }
  else {
    content = ContentFactory.getInstance().createContent(hierarchyBrowser.getComponent(), null, true);
    contentManager.addContent(content);
  }
  contentManager.setSelectedContent(content);
  hierarchyBrowser.setContent(content);

  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      provider.browserActivated(hierarchyBrowser);
    }
  };
  ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY).activate(runnable);
  return hierarchyBrowser;
}
 
Example #24
Source File: AbstractVcsHelperImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void openCommittedChangesTab(final CommittedChangesProvider provider,
                                    final RepositoryLocation location,
                                    final ChangeBrowserSettings settings,
                                    final int maxCount,
                                    String title) {
  DefaultActionGroup extraActions = new DefaultActionGroup();
  CommittedChangesPanel panel = new CommittedChangesPanel(myProject, provider, settings, location, extraActions);
  panel.setMaxCount(maxCount);
  panel.refreshChanges(false);
  final ContentFactory factory = ContentFactory.getInstance();
  if (title == null && location != null) {
    title = VcsBundle.message("browse.changes.content.title", location.toPresentableString());
  }
  final Content content = factory.createContent(panel, title, false);
  final ChangesViewContentI contentManager = ChangesViewContentManager.getInstance(myProject);
  contentManager.addContent(content);
  contentManager.setSelectedContent(content);

  extraActions.add(new CloseTabToolbarAction() {
    @Override
    public void actionPerformed(final AnActionEvent e) {
      contentManager.removeContent(content);
    }
  });

  ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
  if (!window.isVisible()) {
    window.activate(null);
  }
}
 
Example #25
Source File: ShelvedChangesViewManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateChangesContent() {
  myUpdatePending = false;
  final List<ShelvedChangeList> changeLists = new ArrayList<ShelvedChangeList>(myShelveChangesManager.getShelvedChangeLists());
  changeLists.addAll(myShelveChangesManager.getRecycledShelvedChangeLists());
  if (changeLists.size() == 0) {
    if (myContent != null) {
      myContentManager.removeContent(myContent);
      myContentManager.selectContent("Local");
    }
    myContent = null;
  }
  else {
    if (myContent == null) {
      JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
      scrollPane.setBorder(null);
      myContent = ContentFactory.getInstance().createContent(scrollPane, VcsBundle.message("shelf.tab"), false);
      myContent.setCloseable(false);
      myContentManager.addContent(myContent);
    }
    TreeState state = TreeState.createOn(myTree);
    myTree.setModel(buildChangesModel());
    state.applyTo(myTree);
    if (myPostUpdateRunnable != null) {
      myPostUpdateRunnable.run();
    }      
  }
  myPostUpdateRunnable = null;
}
 
Example #26
Source File: ExecutionHelper.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void openMessagesView(@Nonnull final ErrorViewPanel errorTreeView, @Nonnull final Project myProject, @Nonnull final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
      final Content content = ContentFactory.getInstance().createContent(errorTreeView, tabDisplayName, true);
      messageView.getContentManager().addContent(content);
      Disposer.register(content, errorTreeView);
      messageView.getContentManager().setSelectedContent(content);
      removeContents(content, myProject, tabDisplayName);
    }
  }, "Open message view", null);
}
 
Example #27
Source File: InspectionManagerEx.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public InspectionManagerEx(final Project project) {
  super(project);
  if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
    myContentManager = new NotNullLazyValue<ContentManager>() {
      @Nonnull
      @Override
      protected ContentManager compute() {
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
        toolWindowManager.registerToolWindow(ToolWindowId.INSPECTION, true, ToolWindowAnchor.BOTTOM, project);
        return ContentFactory.getInstance().createContentManager(new TabbedPaneContentUI(), true, project);
      }
    };
  }
  else {
    myContentManager = new NotNullLazyValue<ContentManager>() {
      @Nonnull
      @Override
      protected ContentManager compute() {
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
        ToolWindow toolWindow =
                toolWindowManager.registerToolWindow(ToolWindowId.INSPECTION, true, ToolWindowAnchor.BOTTOM, project);
        ContentManager contentManager = toolWindow.getContentManager();
        toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowInspection);
        new ContentManagerWatcher(toolWindow, contentManager);
        return contentManager;
      }
    };
  }
}
 
Example #28
Source File: RunDashboardManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public RunDashboardManagerImpl(@Nonnull final Project project) {
  myProject = project;

  ContentFactory contentFactory = ContentFactory.getInstance();
  ContentUI contentUI = new PanelContentUI();
  myContentManager = contentFactory.createContentManager(contentUI, false, project);

  myGroupers = Arrays.stream(DashboardGroupingRule.EP_NAME.getExtensions()).sorted(DashboardGroupingRule.PRIORITY_COMPARATOR).map(DashboardGrouper::new)
          .collect(Collectors.toList());

  if (isDashboardEnabled()) {
    initToolWindowListeners();
  }
}
 
Example #29
Source File: ReferenceToolWindow.java    From intellij-reference-diagram with Apache License 2.0 5 votes vote down vote up
private void create(@NotNull ToolWindow toolWindow, ContentFactory contentFactory, ReferenceListToolWindow window) {
    Content content = contentFactory.createContent(window.getContent(), window.getName(), false);
    window.setUpdateTabNameCallback(newName -> {
        ApplicationManager.getApplication().invokeLater(
                () -> {
                    content.setDisplayName(newName);
                });
    });
    toolWindow.getContentManager().addContent(content);
}
 
Example #30
Source File: ComponentStructureView.java    From litho with Apache License 2.0 5 votes vote down vote up
synchronized void setup(ToolWindow toolWindow) {
  contentManager = toolWindow.getContentManager();
  Disposer.register(contentManager, this);
  refreshButton = createButton("Update", this::update);
  contentContainer =
      ContentFactory.SERVICE
          .getInstance()
          .createContent(createView(refreshButton, STUB), "", false);
  contentManager.addContent(contentContainer);
  DumbService.getInstance(project).smartInvokeLater(this::update);
}