private void initialize() {
    if (myIsInitialized) {
      return;
    }

    myIsInitialized = true;
    myIsDisposed = false;

    myContentManager = ContentFactory.SERVICE.getInstance().createContentManager(true, myProject);
    myContentManager.addContentManagerListener(
        new ContentManagerAdapter() {
          public void contentRemoved(ContentManagerEvent event) {
            JComponent component = event.getContent().getComponent();
            JComponent removedComponent =
                component instanceof CvsTabbedWindowComponent
                    ? ((CvsTabbedWindowComponent) component).getComponent()
                    : component;
            if (removedComponent == myErrorsView) {
              myErrorsView.dispose();
              myErrorsView = null;
            } else if (myOutput != null && removedComponent == myOutput.getComponent()) {
              EditorFactory.getInstance().releaseEditor(myOutput);
              myOutput = null;
            }
          }
        });

    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
    ToolWindow toolWindow =
        toolWindowManager.registerToolWindow(
            ToolWindowId.CVS, myContentManager.getComponent(), ToolWindowAnchor.BOTTOM);
    toolWindow.setIcon(AllIcons.Providers.Cvs);
    toolWindow.installWatcher(myContentManager);
  }
 private CloseListener(Content content, ContentManager contentManager, Project project) {
   myContent = content;
   myContentManager = contentManager;
   myProject = project;
   contentManager.addContentManagerListener(this);
   ProjectManager.getInstance().addProjectManagerListener(myProject, this);
 }
  public PanelWithActionsAndCloseButton(
      ContentManager contentManager, @NonNls String helpId, final boolean verticalToolbar) {
    super(new BorderLayout());
    myContentManager = contentManager;
    myHelpId = helpId;
    myVerticalToolbar = verticalToolbar;
    myCloseEnabled = true;

    if (myContentManager != null) {
      myContentManager.addContentManagerListener(
          new ContentManagerAdapter() {
            public void contentRemoved(ContentManagerEvent event) {
              if (event.getContent().getComponent() == PanelWithActionsAndCloseButton.this) {
                dispose();
                myContentManager.removeContentManagerListener(this);
              }
            }
          });
    }
  }
 private void initialize() {
   if (!_isInitialized) {
     _isInitialized = true;
     _isDisposed = false;
     ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(_project);
     ToolWindow toolWindow =
         toolWindowManager.registerToolWindow(
             COMMIT_LOGS_TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM);
     toolWindow.setIcon(COMMIT_LOGS_SMALL_ICON);
     _contentManager = toolWindow.getContentManager();
     toolWindow.installWatcher(_contentManager);
     //      _contentManager =
     // PeerFactory.getInstance().getContentFactory().createContentManager(true, _project);
     _contentManager.addContentManagerListener(
         new ContentManagerAdapter() {
           @Override
           public void contentRemoved(ContentManagerEvent event) {
             JComponent component = event.getContent().getComponent();
             JComponent removedComponent =
                 (component instanceof CommitLogWindowComponent)
                     ? ((CommitLogWindowComponent) component).getComponent()
                     : component;
             //                    if (removedComponent == myErrorsView) {
             //                        myErrorsView.dispose();
             //                        myErrorsView = null;
             //                    } else
             for (Iterator iterator = _commitLogs.iterator(); iterator.hasNext(); ) {
               Editor editor = (Editor) iterator.next();
               if (removedComponent == editor.getComponent()) {
                 EditorFactory.getInstance().releaseEditor(editor);
                 iterator.remove();
               }
             }
           }
         });
     //      final JComponent component = _contentManager.getComponent();
   }
 }