From e1dfe30b59680c7d21daea2dc3a975900cd77da9 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Wed, 7 Sep 2016 14:20:47 +0300 Subject: [PATCH] unused declaration: remove problems count from view (IDEA-160870) --- .../deadCode/UnusedDeclarationPresentation.java | 5 +++++ .../codeInspection/ui/InspectionToolPresentation.java | 4 ++++ .../codeInspection/ui/QuickFixPreviewPanelFactory.java | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java index 2853f90278a8..cdd76d872b00 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java @@ -684,4 +684,9 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta SingleInspectionProfilePanel.readHTML(htmlView, SingleInspectionProfilePanel.toHTML(htmlView, text, false)); return ScrollPaneFactory.createScrollPane(htmlView, true); } + + @Override + public int getProblemsCount(InspectionTree tree) { + return 0; + } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java index be718f0fb4c6..c447a4f4dd5f 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionToolPresentation.java @@ -114,4 +114,8 @@ public interface InspectionToolPresentation extends ProblemDescriptionsProcessor default boolean isDummy() { return false; } + + default int getProblemsCount(InspectionTree tree) { + return tree.getSelectedDescriptors().length; + } } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewPanelFactory.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewPanelFactory.java index 442defee7642..cf30a35d92f9 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewPanelFactory.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/QuickFixPreviewPanelFactory.java @@ -82,7 +82,7 @@ public class QuickFixPreviewPanelFactory { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); boolean hasComponents = false; - final int actualProblemCount = myView.getTree().getSelectedDescriptors().length; + final int actualProblemCount = myView.getTree().getContext().getPresentation(myWrapper).getProblemsCount(myView.getTree()); if (actualProblemCount > 1 || (actualProblemCount == 1 && problemCount > 1)) { add(getLabel(actualProblemCount)); hasComponents = true;