Java Code Examples for com.intellij.ui.content.ContentManager#getContent()

The following examples show how to use com.intellij.ui.content.ContentManager#getContent() . 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: ConsoleLogToolWindowFactory.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
static void createContent(Project project, ToolWindow toolWindow, ConsoleLogConsole 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(@NonNls String dataId) {
            return PlatformDataKeys.HELP_ID.is(dataId) ? ConsoleLog.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.SERVICE.getInstance().createContent(panel, title, false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content);
}
 
Example 2
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 3
Source File: ProblemsView.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static void selectContent(@Nonnull ContentManager manager, int index) {
  Content content = manager.getContent(index);
  if (content != null) manager.setSelectedContent(content);
}