@Override public UpdateInfoTree showUpdateProjectInfo( UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) { if (!myProject.isOpen() || myProject.isDisposed()) return null; ContentManager contentManager = getContentManager(); if (contentManager == null) { return null; // content manager is made null during dispose; flag is set later } final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo); Content content = ContentFactory.SERVICE .getInstance() .createContent( updateInfoTree, canceled ? VcsBundle.message( "toolwindow.title.update.action.canceled.info", displayActionName) : VcsBundle.message("toolwindow.title.update.action.info", displayActionName), true); Disposer.register(content, updateInfoTree); ContentsUtil.addContent(contentManager, content, true); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null); updateInfoTree.expandRootChildren(); return updateInfoTree; }
private Content getOrCreateConsoleContent(final ContentManager contentManager) { final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name"); Content content = contentManager.findContent(displayName); if (content == null) { releaseEditor(); final EditorFactory editorFactory = EditorFactory.getInstance(); final Editor editor = editorFactory.createViewer(editorFactory.createDocument(""), myProject); EditorSettings editorSettings = editor.getSettings(); editorSettings.setLineMarkerAreaShown(false); editorSettings.setIndentGuidesShown(false); editorSettings.setLineNumbersShown(false); editorSettings.setFoldingOutlineShown(false); ((EditorEx) editor).getScrollPane().setBorder(null); myEditorAdapter = new EditorAdapter(editor, myProject, false); final JPanel panel = new JPanel(new BorderLayout()); panel.add(editor.getComponent(), BorderLayout.CENTER); content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, true); contentManager.addContent(content); for (Pair<String, TextAttributes> pair : myPendingOutput) { myEditorAdapter.appendString(pair.first, pair.second); } myPendingOutput.clear(); } return content; }