public int addTab( String s, JComponent component, boolean selectTab, boolean replaceContent, boolean lockable, boolean addDefaultToolbar, ActionGroup toolbarActions, String helpId) { int existing = getComponentNumNamed(s); ContentManager contentManager = getContentManager(); if (existing != -1) { Content existingContent = contentManager.getContent(existing); if (!replaceContent) { contentManager.setSelectedContent(existingContent); return existing; } // if (!existingContent.isPinned()) { // getContentManager().removeContent(existingContent); // existingContent.release(); // } } CommitLogWindowComponent newComponent = new CommitLogWindowComponent( component, addDefaultToolbar, toolbarActions, contentManager, helpId); Content content = ContentFactory.SERVICE .getInstance() .createContent(newComponent.getShownComponent(), s, lockable); newComponent.setContent(content); contentManager.addContent(content); return getComponentAt(contentManager.getContentCount() - 1, selectTab); }
private Content createNewContent( final ContentManager contentManager, final RunContentDescriptor descriptor, Executor executor) { final String processDisplayName = descriptor.getDisplayName(); final Content content = ContentFactory.SERVICE .getInstance() .createContent(descriptor.getComponent(), processDisplayName, true); content.putUserData(DESCRIPTOR_KEY, descriptor); content.putUserData(ToolWindow.SHOW_CONTENT_ICON, Boolean.TRUE); contentManager.addContent(content); new CloseListener(content, executor); return content; }