Java Code Examples for com.intellij.ui.content.Content#setDisposer()

The following examples show how to use com.intellij.ui.content.Content#setDisposer() . 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: 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 2
Source File: KeyPromoterToolWindowFactory.java    From IntelliJ-Key-Promoter-X with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    KeyPromoterToolWindowPanel toolWindowBuilder = new KeyPromoterToolWindowPanel();
    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    JBScrollPane toolWindowContent = new JBScrollPane(toolWindowBuilder.getContent());
    toolWindowContent.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    Content content = contentFactory.createContent(toolWindowContent, "", false);
    content.setPreferredFocusableComponent(toolWindowContent);
    content.setDisposer(toolWindowBuilder);
    toolWindow.getContentManager().addContent(content);
}
 
Example 3
Source File: ServersToolWindowFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void createToolWindowContent(@Nonnull Project project, @Nonnull ToolWindow toolWindow) {
  ContentManager contentManager = toolWindow.getContentManager();

  final ServersToolWindowContent serversContent = new ServersToolWindowContent(project);

  Content content = contentManager.getFactory().createContent(serversContent, null, false);
  content.setDisposer(serversContent);
  
  contentManager.addContent(content);
}
 
Example 4
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 5
Source File: UsageViewImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
void setContent(@Nonnull Content content) {
  myContent = content;
  content.setDisposer(this);
}