public static DevMotivePanel addDevMotiveContent(Project project, VirtualFile file, List<VcsFileRevision> revisions, String vcsName, ContentManagerListener listener, boolean select) { ApplicationManager.getApplication().assertIsDispatchThread(); ToolWindowManager toolWindowManager = project.getComponent(ToolWindowManager.class); ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_MAIN); ContentManager contentManager = toolWindow.getContentManager(); Content content = findDevMotiveContent(toolWindow, file); if (content == null) { contentManager = toolWindow.getContentManager(); int idx = contentManager.getContentCount(); DevMotivePanel devMotivePanel = new DevMotivePanel(project, file, revisions, vcsName); content = ContentFactory.SERVICE.getInstance().createContent(devMotivePanel, devMotivePanel.getName(), false); contentManager.addContent(content, idx); } else if (revisions != null) { ((DevMotive) content.getComponent()).load(revisions); } if (select) { contentManager.setSelectedContent(content); } if (listener != null) { contentManager.addContentManagerListener(listener); } return (DevMotivePanel) content.getComponent(); }
@NotNull @Override public RunnerLayoutUi addListener(@NotNull final ContentManagerListener listener, @NotNull final Disposable parent) { final ContentManager mgr = getContentManager(); mgr.addContentManagerListener(listener); Disposer.register(parent, new Disposable() { @Override public void dispose() { mgr.removeContentManagerListener(listener); } }); return this; }
@Nonnull @Override public RunnerLayoutUi addListener(@Nonnull final ContentManagerListener listener, @Nonnull final Disposable parent) { final ContentManager mgr = getContentManager(); mgr.addContentManagerListener(listener); Disposer.register(parent, new Disposable() { @Override public void dispose() { mgr.removeContentManagerListener(listener); } }); return this; }
@NotNull RunnerLayoutUi addListener(@NotNull ContentManagerListener listener, @NotNull Disposable parent);
@Override public void removeListener(@NotNull final ContentManagerListener listener) { getContentManager().removeContentManagerListener(listener); }
@Override public void addContentManagerListener(@NotNull final ContentManagerListener l) { }
@Override public void removeContentManagerListener(@NotNull final ContentManagerListener l) { }
@Override public void addContentManagerListener(@Nonnull final ContentManagerListener l) { myDispatcher.getListeners().add(0, l); }
@Override public void removeContentManagerListener(@Nonnull final ContentManagerListener l) { myDispatcher.removeListener(l); }
@Nonnull RunnerLayoutUi addListener(@Nonnull ContentManagerListener listener, @Nonnull Disposable parent);
@Override public void removeListener(@Nonnull final ContentManagerListener listener) { getContentManager().removeContentManagerListener(listener); }
void removeListener(@NotNull final ContentManagerListener listener);
void removeListener(@Nonnull final ContentManagerListener listener);