diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java index e686273c151a..3bcae0962ca0 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java @@ -127,7 +127,7 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur myMessagePanel = new JPanel(new BorderLayout()); - myErrorViewStructure = new ErrorViewStructure(project, canHideWarnings()); + myErrorViewStructure = createErrorViewStructure(project, canHideWarnings()); DefaultMutableTreeNode root = new DefaultMutableTreeNode(); root.setUserObject(myErrorViewStructure.createDescriptor(myErrorViewStructure.getRootElement(), null)); final DefaultTreeModel treeModel = new DefaultTreeModel(root); @@ -180,6 +180,10 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur EditSourceOnDoubleClickHandler.install(myTree); } + protected ErrorViewStructure createErrorViewStructure(Project project, boolean canHideWarnings) { + return new ErrorViewStructure(project, canHideWarnings); + } + @Override public void dispose() { myIsDisposed = true; diff --git a/platform/platform-impl/src/com/intellij/ui/errorView/impl/ErrorViewFactoryImpl.java b/platform/platform-impl/src/com/intellij/ui/errorView/impl/ErrorViewFactoryImpl.java index cc4a6c72d238..3a39fa8b9309 100644 --- a/platform/platform-impl/src/com/intellij/ui/errorView/impl/ErrorViewFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/errorView/impl/ErrorViewFactoryImpl.java @@ -25,6 +25,8 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel; +import javax.swing.*; + public class ErrorViewFactoryImpl implements ErrorViewFactory { public ErrorTreeView createErrorTreeView(Project project, String helpId, @@ -52,12 +54,17 @@ public class ErrorViewFactoryImpl implements ErrorViewFactory { } public void close() { - ContentManager contentManager = contentManagerProvider.getParentContent(); - Content content = contentManager.getContent(this); - if (content != null) { - contentManager.removeContent(content, true); - } + removeFromContentManager(contentManagerProvider.getParentContent(), this); } }; } + + public static void removeFromContentManager(ContentManager contentManager, ErrorTreeView view) { + if (view instanceof JComponent) { + Content content = contentManager.getContent((JComponent)view); + if (content != null) { + contentManager.removeContent(content, true); + } + } + } }