Commit 0dec8432 authored by Anna Kozlova's avatar Anna Kozlova
Browse files

unused declaration: check before deletion if element had a problem and not...

unused declaration: check before deletion if element had a problem and not just to support hierarchy here
parent 03a35a3f
Showing with 2 additions and 1 deletion
+2 -1
...@@ -217,10 +217,11 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta ...@@ -217,10 +217,11 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
if (!super.applyFix(refElements)) return false; if (!super.applyFix(refElements)) return false;
final PsiElement[] psiElements = Arrays final PsiElement[] psiElements = Arrays
.stream(refElements) .stream(refElements)
.filter(RefElement.class::isInstance) .filter((obj) -> obj instanceof RefJavaElement && getFilter().accepts((RefJavaElement)obj))
.map(e -> ((RefElement) e).getElement()) .map(e -> ((RefElement) e).getElement())
.filter(e -> e != null) .filter(e -> e != null)
.toArray(PsiElement[]::new); .toArray(PsiElement[]::new);
if (psiElements.length == 0) return false;
ApplicationManager.getApplication().invokeLater(() -> { ApplicationManager.getApplication().invokeLater(() -> {
final Project project = getContext().getProject(); final Project project = getContext().getProject();
if (isDisposed() || project.isDisposed()) return; if (isDisposed() || project.isDisposed()) return;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment