Java 类com.intellij.ui.content.ContentManagerEvent 实例源码

项目:intellij-ce-playground    文件:ToggleToolbarAction.java   
private ToggleToolbarAction(@NotNull ToolWindow toolWindow, @NotNull PropertiesComponent propertiesComponent) {
  super("Show Toolbar");
  myPropertiesComponent = propertiesComponent;
  myToolWindow = toolWindow;
  myToolWindow.getContentManager().addContentManagerListener(new ContentManagerAdapter() {
    @Override
    public void contentAdded(ContentManagerEvent event) {
      JComponent component = event.getContent().getComponent();
      setContentToolbarVisible(component, getVisibilityValue());

      // support nested content managers, e.g. RunnerLayoutUi as content component
      ContentManager contentManager =
        component instanceof DataProvider ? PlatformDataKeys.CONTENT_MANAGER.getData((DataProvider)component) : null;
      if (contentManager != null) contentManager.addContentManagerListener(this);
    }
  });
}
项目:intellij-ocaml    文件:OCamlToolWindowComponent.java   
private void registerToolWindowIfNeeded() {
    if (myToolWindowWasRegistered || !toolWindowShouldBeRegistered()) return;

    final ToolWindow toolWindow = myToolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.BOTTOM, false);
    toolWindow.setIcon(OCamlIconUtil.getSmallOCamlIcon());
    toolWindow.setTitle(TOOL_WINDOW_ID);

    myToolWindowWasRegistered = true;

    final ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addContentManagerListener(new ContentManagerAdapter() {
        @Override
        public void contentRemoved(@NotNull final ContentManagerEvent event) {
            if (contentManager.getContentCount() == 0) {
                OCamlToolWindowUtil.addAndSelectStartContent(myProject, contentManager);
            }
        }
    });

    OCamlToolWindowUtil.addAndSelectStartContent(myProject, contentManager);
}
项目:tools-idea    文件:PanelWithActionsAndCloseButton.java   
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);
        }
      }
    });
  }

}
项目:tools-idea    文件:LogConsoleManagerBase.java   
private void doAddLogConsole(final LogConsoleBase log,
                             final String id,
                             Icon icon) {
  if (myEnvironment != null && myEnvironment.getRunProfile() instanceof RunConfigurationBase) {
    ((RunConfigurationBase)myEnvironment.getRunProfile()).customizeLogConsole(log);
  }
  log.attachStopLogConsoleTrackingListener(getProcessHandler());
  addAdditionalTabComponent(log, id, icon);

  getUi().addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(final ContentManagerEvent event) {
      log.activate();
    }
  }, log);
}
项目:consulo    文件:ToggleToolbarAction.java   
private ToggleToolbarAction(@Nonnull ToolWindow toolWindow, @Nonnull PropertiesComponent propertiesComponent) {
  super("Show Toolbar");
  myPropertiesComponent = propertiesComponent;
  myToolWindow = toolWindow;
  myToolWindow.getContentManager().addContentManagerListener(new ContentManagerAdapter() {
    @Override
    public void contentAdded(ContentManagerEvent event) {
      JComponent component = event.getContent().getComponent();
      setContentToolbarVisible(component, getVisibilityValue());

      // support nested content managers, e.g. RunnerLayoutUi as content component
      ContentManager contentManager =
              component instanceof DataProvider ? ((DataProvider)component).getDataUnchecked(PlatformDataKeys.CONTENT_MANAGER) : null;
      if (contentManager != null) contentManager.addContentManagerListener(this);
    }
  });
}
项目:consulo    文件:XDebugSessionTab.java   
private XDebugSessionTab(@Nonnull XDebugSessionImpl session, @Nullable Icon icon, @Nullable ExecutionEnvironment environment) {
  super(session.getProject(), "Debug", session.getSessionName(), GlobalSearchScope.allScope(session.getProject()));

  setSession(session, environment, icon);

  myUi.addContent(createFramesContent(), 0, PlaceInGrid.left, false);
  addVariablesAndWatches(session);

  attachToSession(session);

  DefaultActionGroup focus = new DefaultActionGroup();
  focus.add(ActionManager.getInstance().getAction(XDebuggerActions.FOCUS_ON_BREAKPOINT));
  myUi.getOptions().setAdditionalFocusActions(focus);

  myUi.addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      Content content = event.getContent();
      if (mySession != null && content.isSelected() && getWatchesContentId().equals(ViewImpl.ID.get(content))) {
        myRebuildWatchesRunnable.run();
      }
    }
  }, myRunContentDescriptor);

  rebuildViews();
}
项目:intellij-ce-playground    文件:TabContentLayout.java   
@Override
public void init() {
  reset();

  myIdLabel = new BaseLabel(myUi, false) {
    @Override
    protected boolean allowEngravement() {
      return myUi.myWindow.isActive();
    }
  };
  for (int i = 0; i < myUi.myManager.getContentCount(); i++) {
    contentAdded(new ContentManagerEvent(this, myUi.myManager.getContent(i), i));
  }
}
项目:intellij-ce-playground    文件:TabContentLayout.java   
@Override
public void contentAdded(ContentManagerEvent event) {
  final Content content = event.getContent();
  final ContentTabLabel tab;
  if (content instanceof TabbedContent) {
    tab = new TabbedContentTabLabel((TabbedContent)content, this);
  } else {
    tab = new ContentTabLabel(content, this);
  }
  myTabs.add(event.getIndex(), tab);
  myContent2Tabs.put(content, tab);

  myCached.clear();
}
项目:intellij-ce-playground    文件:TabContentLayout.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
  final ContentTabLabel tab = myContent2Tabs.get(event.getContent());
  if (tab != null) {
    myTabs.remove(tab);
    myContent2Tabs.remove(event.getContent());
  }

  myCached.clear();
}
项目:intellij-ce-playground    文件:ProjectViewImpl.java   
public synchronized void setupImpl(@NotNull ToolWindow toolWindow, final boolean loadPaneExtensions) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  myActionGroup = new DefaultActionGroup();

  myAutoScrollFromSourceHandler.install();

  myContentManager = toolWindow.getContentManager();
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    toolWindow.setDefaultContentUiType(ToolWindowContentUiType.COMBO);
    ((ToolWindowEx)toolWindow).setAdditionalGearActions(myActionGroup);
    toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
  }

  GuiUtils.replaceJSplitPaneWithIDEASplitter(myPanel);
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      splitterProportions.restoreSplitterProportions(myPanel);
    }
  });

  if (loadPaneExtensions) {
    ensurePanesLoaded();
  }
  isInitialized = true;
  doAddUninitializedPanes();

  myContentManager.addContentManagerListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
        viewSelectionChanged();
      }
    }
  });
  viewSelectionChanged();
}
项目:intellij-ce-playground    文件:LogConsoleManagerBase.java   
private void doAddLogConsole(@NotNull final LogConsoleBase log, String id,  Icon icon, @Nullable RunProfile runProfile) {
  if (runProfile instanceof RunConfigurationBase) {
    ((RunConfigurationBase)runProfile).customizeLogConsole(log);
  }
  log.attachStopLogConsoleTrackingListener(getProcessHandler());
  addAdditionalTabComponent(log, id, icon);

  getUi().addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(final ContentManagerEvent event) {
      log.activate();
    }
  }, log);
}
项目:intellij-ce-playground    文件:CvsTabbedWindow.java   
public CvsTabbedWindow(Project project) {
  myProject = project;
  Disposer.register(project, this);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      final ToolWindow toolWindow = getToolWindow();
      final ContentManager contentManager = toolWindow.getContentManager();
      contentManager.addContentManagerListener(new ContentManagerAdapter() {
        public void contentRemoved(ContentManagerEvent event) {
          final JComponent component = event.getContent().getComponent();
          final 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;
          }
        }
      });
      toolWindow.installWatcher(contentManager);
    }
  });
}
项目:tools-idea    文件:TabContentLayout.java   
@Override
public void init() {
  reset();

  myIdLabel = new BaseLabel(myUi, false) {
    @Override
    protected boolean allowEngravement() {
      return myUi.myWindow.isActive();
    }
  };
  for (int i = 0; i < myUi.myManager.getContentCount(); i++) {
    contentAdded(new ContentManagerEvent(this, myUi.myManager.getContent(i), i));
  }
}
项目:tools-idea    文件:TabContentLayout.java   
@Override
public void contentAdded(ContentManagerEvent event) {
  final ContentTabLabel tab = new ContentTabLabel(event.getContent(), this);
  myTabs.add(event.getIndex(), tab);
  myContent2Tabs.put(event.getContent(), tab);

  myCached.clear();
}
项目:tools-idea    文件:TabContentLayout.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
  final ContentTabLabel tab = myContent2Tabs.get(event.getContent());
  if (tab != null) {
    myTabs.remove(tab);
    myContent2Tabs.remove(event.getContent());
  }

  myCached.clear();
}
项目:ali-idea-plugin    文件:EntityEditManager.java   
@Override
public synchronized void contentRemoveQuery(ContentManagerEvent contentManagerEvent) {
    Entity entity = ((HasEntity)contentManagerEvent.getContent().getComponent()).getEntity();
    if(!edited.containsKey(entity))  {
        // not edited
        return;
    }
    if(!Boolean.TRUE.equals(edited.get(entity))) {
        // not dirty
        return;
    }
    if(closeContentsCanceled) {
        // dirty and canceled
        contentManagerEvent.consume();
        return;
    }
    switch (askUser()) {
        case Messages.YES:
            // approve
            return;

        case Messages.CANCEL:
            closeContentsCanceled = true;
    }
    // dirty and rejected or canceled
    contentManagerEvent.consume();
}
项目:ali-idea-plugin    文件:DevMotiveAnnotationGutter.java   
@Override
public void contentAdded(ContentManagerEvent event) {
    if (devMotivePanel == null && event.getContent().getComponent() instanceof DevMotivePanel) {
        DevMotivePanel panel = (DevMotivePanel) event.getContent().getComponent();
        if (annotation.getFile().equals(panel.getFile())) {
            devMotivePanel = panel;
            devMotivePanel.addChangeListener(this);
        }
    }
}
项目:ali-idea-plugin    文件:DevMotiveAnnotationGutter.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
    if (devMotivePanel != null && devMotivePanel.equals(event.getContent().getComponent())) {
        releasePanel();
        updateAnnotations();
    }
}
项目:ali-idea-plugin    文件:EntityDetail.java   
@Override
public void contentRemoved(ContentManagerEvent contentManagerEvent) {
    if(this.equals(contentManagerEvent.getContent().getComponent())) {
        contentManagerEvent.getContent().getManager().removeContentManagerListener(this);
        _unregister();
    }
}
项目:consulo-apache-ant    文件:AntBuildMessageView.java   
public void contentRemoved(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    myContentManager.removeContentManagerListener(this);
    AntBuildMessageView buildMessageView = myContent.getUserData(KEY);
    if (!myCloseAllowed) {
      buildMessageView.stopProcess();
    }
    ProjectManager.getInstance().removeProjectManagerListener(myProject, this);
    myContent.release();
    myContent = null;
    buildMessageView.myBuildFile = null;
    buildMessageView.myPlainTextView.dispose();
  }
}
项目:consulo-apache-ant    文件:AntBuildMessageView.java   
public void contentRemoveQuery(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    boolean canClose = closeQuery();
    if (!canClose) {
      event.consume();
    }
  }
}
项目:consulo    文件:ToolWindowHeadlessManagerImpl.java   
@Override
public void addContent(@Nonnull final Content content) {
  myContents.add(content);
  Disposer.register(this, content);
  ContentManagerEvent e = new ContentManagerEvent(this, content, myContents.indexOf(content), ContentManagerEvent.ContentOperation.add);
  myDispatcher.getMulticaster().contentAdded(e);
  if (mySelected == null) setSelectedContent(content);
}
项目:consulo    文件:ToolWindowHeadlessManagerImpl.java   
@Override
public void addContent(@Nonnull Content content, int order) {
  myContents.add(order, content);
  Disposer.register(this, content);
  ContentManagerEvent e = new ContentManagerEvent(this, content, myContents.indexOf(content), ContentManagerEvent.ContentOperation.add);
  myDispatcher.getMulticaster().contentAdded(e);
  if (mySelected == null) setSelectedContent(content);
}
项目:consulo    文件:ToolWindowHeadlessManagerImpl.java   
@Override
public boolean removeContent(@Nonnull final Content content, final boolean dispose) {
  boolean wasSelected = mySelected == content;
  int oldIndex = myContents.indexOf(content);
  if (wasSelected) {
    removeFromSelection(content);
  }
  boolean result = myContents.remove(content);
  if (dispose) Disposer.dispose(content);
  ContentManagerEvent e = new ContentManagerEvent(this, content, oldIndex, ContentManagerEvent.ContentOperation.remove);
  myDispatcher.getMulticaster().contentRemoved(e);
  Content item = ContainerUtil.getFirstItem(myContents);
  if (item != null) setSelectedContent(item);
  return result;
}
项目:consulo    文件:ToolWindowHeadlessManagerImpl.java   
@Override
public void setSelectedContent(@Nonnull final Content content) {
  if (mySelected != null) {
    removeFromSelection(mySelected);
  }
  mySelected = content;
  ContentManagerEvent e = new ContentManagerEvent(this, content, myContents.indexOf(content), ContentManagerEvent.ContentOperation.add);
  myDispatcher.getMulticaster().selectionChanged(e);
}
项目:consulo    文件:CompilerTask.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    myContentManager.removeContentManagerListener(this);
    myContent.release();
    myContent = null;
  }
}
项目:consulo    文件:CompilerTask.java   
@Override
public void contentRemoveQuery(ContentManagerEvent event) {
  if (event.getContent() == myContent) {
    if (!myIndicator.isCanceled() && shouldAskUser()) {
      int result = Messages.showOkCancelDialog(myProject, CompilerBundle.message("warning.compiler.running.on.toolwindow.close"),
                                               CompilerBundle.message("compiler.running.dialog.title"), Messages.getQuestionIcon());
      if (result != 0) {
        event.consume(); // veto closing
      }
      myUserAcceptedCancel = true;
    }
  }
}
项目:consulo    文件:VcsLogTabsWatcher.java   
@Override
public void contentAdded(ContentManagerEvent event) {
  Content content = event.getContent();
  if (content instanceof TabbedContent) {
    content.addPropertyChangeListener(this);
  }
}
项目:consulo    文件:VcsLogTabsWatcher.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
  Content content = event.getContent();
  if (content instanceof TabbedContent) {
    content.removePropertyChangeListener(this);
  }
}
项目:consulo    文件:ProjectViewImpl.java   
@RequiredUIAccess
@Override
public void setupToolWindow(@Nonnull ToolWindow toolWindow, final boolean loadPaneExtensions) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  myActionGroup = new DefaultActionGroup();

  myAutoScrollFromSourceHandler.install();

  myContentManager = toolWindow.getContentManager();
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    toolWindow.setDefaultContentUiType(ToolWindowContentUiType.COMBO);
    ((ToolWindowEx)toolWindow).setAdditionalGearActions(myActionGroup);
    toolWindow.getComponent().putClientProperty(ToolWindowContentUI.HIDE_ID_LABEL, "true");
  }

  GuiUtils.replaceJSplitPaneWithIDEASplitter(myPanel);
  SwingUtilities.invokeLater(() -> splitterProportions.restoreSplitterProportions(myPanel));

  if (loadPaneExtensions) {
    ensurePanesLoaded();
  }
  isInitialized = true;
  doAddUninitializedPanes();

  getContentManager().addContentManagerListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
        viewSelectionChanged();
      }
    }
  });
  viewSelectionChanged();
}
项目:consulo    文件:LogConsoleManagerBase.java   
private void doAddLogConsole(@Nonnull final LogConsoleBase log, String id, Icon icon, @Nullable RunProfile runProfile) {
  if (runProfile instanceof RunConfigurationBase) {
    ((RunConfigurationBase)runProfile).customizeLogConsole(log);
  }
  log.attachStopLogConsoleTrackingListener(getProcessHandler());
  addAdditionalTabComponent(log, id, icon);

  getUi().addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(final ContentManagerEvent event) {
      log.activate();
    }
  }, log);
}
项目:consulo    文件:TabContentLayout.java   
@Override
public void init() {
  reset();

  myIdLabel = new BaseLabel(myUi, false) {
    @Override
    protected boolean allowEngravement() {
      return myUi.myWindow.isActive();
    }
  };
  for (int i = 0; i < myUi.myManager.getContentCount(); i++) {
    contentAdded(new ContentManagerEvent(this, myUi.myManager.getContent(i), i));
  }
}
项目:consulo    文件:TabContentLayout.java   
@Override
public void contentAdded(ContentManagerEvent event) {
  final Content content = event.getContent();
  final ContentTabLabel tab;
  if (content instanceof TabbedContent) {
    tab = new TabbedContentTabLabel((TabbedContent)content, this);
  }
  else {
    tab = new ContentTabLabel(content, this);
  }
  myTabs.add(event.getIndex(), tab);
  myContent2Tabs.put(content, tab);

  myCached.clear();
}
项目:consulo    文件:TabContentLayout.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
  final ContentTabLabel tab = myContent2Tabs.get(event.getContent());
  if (tab != null) {
    myTabs.remove(tab);
    myContent2Tabs.remove(event.getContent());
  }

  myCached.clear();
}
项目:intellij-ce-playground    文件:VcsLogManager.java   
@Override
public void selectionChanged(ContentManagerEvent event) {
  refreshRootsIfNeeded();
}
项目:intellij-ce-playground    文件:ComboContentLayout.java   
@Override
public void contentAdded(ContentManagerEvent event) {
}
项目:intellij-ce-playground    文件:ComboContentLayout.java   
@Override
public void contentRemoved(ContentManagerEvent event) {
}
项目:intellij-ce-playground    文件:PreviewManagerImpl.java   
protected void checkGlobalState() {
  ToolWindowManagerImpl toolWindowManager = (ToolWindowManagerImpl)ToolWindowManager.getInstance(myProject);
  if (!isAvailable() && toolWindowManager.getToolWindow(ToolWindowId.PREVIEW) != null) {
    myHistory.clear();
    myContentManager.removeAllContents(true);
    toolWindowManager.unregisterToolWindow(ToolWindowId.PREVIEW);
    return;
  }
  if (isAvailable() && toolWindowManager.getToolWindow(ToolWindowId.PREVIEW) == null) {
    myToolWindow = (ToolWindowImpl)toolWindowManager
      .registerToolWindow(ToolWindowId.PREVIEW, myEmptyStatePanel, ToolWindowAnchor.RIGHT, myProject, false);
    myContentManager = myToolWindow.getContentManager();
    myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowPreview);
    myToolWindow.setContentUiType(ToolWindowContentUiType.COMBO, null);
    myToolWindow.setAutoHide(true);
    myEmptyStateContent = myContentManager.getContent(0);
    final MoveToStandardViewAction moveToStandardViewAction = new MoveToStandardViewAction();
    myContentManager.addContentManagerListener(new ContentManagerAdapter() {
      @Override
      public void selectionChanged(ContentManagerEvent event) {
        if (myInnerSelectionChange || event.getOperation() != ContentManagerEvent.ContentOperation.add) return;
        PreviewInfo previewInfo = event.getContent().getUserData(INFO_KEY);
        if (previewInfo != null) {
          preview(previewInfo, false);
          myToolWindow.setTitleActions(previewInfo.supportsStandardPlace() ? moveToStandardViewAction : null);
        }
      }
    });

    moveToStandardViewAction.registerCustomShortcutSet(new ShortcutSet() {
      @NotNull
      @Override
      public Shortcut[] getShortcuts() {
        Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
        return keymap.getShortcuts("ShowContent");
      }
    }, myToolWindow.getComponent());

    myToolWindow.setTitleActions(moveToStandardViewAction);
    ArrayList<AnAction> myGearActions = new ArrayList<AnAction>();
    for (PreviewPanelProvider provider : myProviders) {
      myGearActions.add(new ContentTypeToggleAction(provider));
    }
    myToolWindow.setAdditionalGearActions(new DefaultActionGroup("Preview", myGearActions));
    myToolWindow.activate(new Runnable() {
      @Override
      public void run() {
        myToolWindow.activate(null);
      }
    });
  }
}
项目:railways    文件:RoutesView.java   
/**
 * Initializes tool window.
 *
 * @param toolWindow Tool window to initialize.
 */
synchronized void initToolWindow(final ToolWindow toolWindow) {
    myToolWindow = toolWindow;
    myContentManager = toolWindow.getContentManager();

    if (!ApplicationManager.getApplication().isUnitTestMode()) {
        toolWindow.setContentUiType(ToolWindowContentUiType.getInstance("combo"), null);
        toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
    }

    // Add all modules that are already added till this moment.
    Module[] modules = ModuleManager.getInstance(myProject).getModules();
    for (Module m : modules)
        addModulePane(m);

    // Add listener to update mainPanel when a module is selected from
    // tool window header.
    myContentManager.addContentManagerListener(new ContentManagerAdapter() {
        @Override
        public void selectionChanged(ContentManagerEvent event) {
            // When user selects a module from tool window combo,
            // selectionChanges is called twice:
            // 1. With 'remove' operation -  for previously selected item,
            // 2. With 'add' operation - for newly selected item.
            if (event.getOperation() == ContentManagerEvent.ContentOperation.add) {
                viewSelectionChanged();
                refreshRouteActionsStatus();
            }
        }
    });


    // Open tab that was active in previous IDE session
    Content savedContent = myContentManager.getContent(myState.selectedTabId);
    if (savedContent != null)
        myContentManager.setSelectedContent(savedContent);

    mainPanel.getRouteFilter().setMountedRoutesVisible(!myState.hideMountedRoutes);


    ToolWindowManagerEx toolManager = ToolWindowManagerEx.getInstanceEx(myProject);
    toolManager.addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        /**
         * This method is called when ToolWindow changes its state, i.e.
         * expanded/collapsed, docked to another panel, etc.
         */
        @Override
        public void stateChanged() {
            // We have to check if our tool window is still registered, as
            // otherwise it will raise an exception when project is closed.
            if (ToolWindowManagerEx.getInstanceEx(myProject).getToolWindow("Routes") == null)
                return;

            updateToolWindowOrientation(toolWindow);

            if (toolWindow.isVisible())
                if (currentPane != null && currentPane.isRoutesInvalidated())
                    currentPane.updateRoutes();

            refreshRouteActionsStatus();
        }
    });

    updateToolWindowOrientation(toolWindow);
}
项目:tools-idea    文件:ComboContentLayout.java   
@Override
public void contentAdded(ContentManagerEvent event) {
}