From 99a2d4b0e8f7944781fa7a31ef86fac588e727f3 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Mon, 8 Feb 2016 18:40:33 +0300 Subject: [PATCH 1/3] OC-11530 Hide "Included from" messages with warnings --- .../intellij/ide/errorTreeView/NewErrorTreeViewPanel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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..7ea2a724c56b 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); 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) { + return new ErrorViewStructure(project, canHideWarnings()); + } + @Override public void dispose() { myIsDisposed = true; From f4e067cf56ae41b797a9b352edbdb440e5265f61 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Wed, 10 Feb 2016 16:24:33 +0300 Subject: [PATCH 2/3] OC-11530 Pass canHideWarnings as parameter --- .../intellij/ide/errorTreeView/NewErrorTreeViewPanel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 7ea2a724c56b..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 = createErrorViewStructure(project); + myErrorViewStructure = createErrorViewStructure(project, canHideWarnings()); DefaultMutableTreeNode root = new DefaultMutableTreeNode(); root.setUserObject(myErrorViewStructure.createDescriptor(myErrorViewStructure.getRootElement(), null)); final DefaultTreeModel treeModel = new DefaultTreeModel(root); @@ -180,8 +180,8 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur EditSourceOnDoubleClickHandler.install(myTree); } - protected ErrorViewStructure createErrorViewStructure(Project project) { - return new ErrorViewStructure(project, canHideWarnings()); + protected ErrorViewStructure createErrorViewStructure(Project project, boolean canHideWarnings) { + return new ErrorViewStructure(project, canHideWarnings); } @Override From eeda89bfa6b5902bd264569ae035bf5fab003c44 Mon Sep 17 00:00:00 2001 From: Aleksandr Date: Fri, 12 Feb 2016 15:31:32 +0300 Subject: [PATCH 3/3] OC-11530 Pass "included from" as children for message + some review fixes --- .../ui/errorView/impl/ErrorViewFactoryImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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); + } + } + } }