inspection toolwindow: do not use obsolete event IDEA-156354 idea/162.541
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Fri, 27 May 2016 17:06:15 +0000 (20:06 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Fri, 27 May 2016 17:16:05 +0000 (20:16 +0300)
platform/lang-impl/src/com/intellij/codeInspection/ex/QuickFixAction.java

index ad1a307a029fc88648fcefbe056f6221e3762713..a06f2ae328c1879b2054370c2819c1e7327e313d 100644 (file)
@@ -130,7 +130,7 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
       if (isProblemDescriptorsAcceptable() && descriptors.get().length > 0) {
         doApplyFix(view.getProject(), descriptors.get(), readOnlyFiles, tree.getContext());
       } else {
-        doApplyFix(getSelectedElements(e), view);
+        doApplyFix(getSelectedElements(view), view);
       }
     } finally {
       view.setApplyingFix(false);
@@ -222,11 +222,10 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
     return readOnlyFiles;
   }
 
-  private static RefEntity[] getSelectedElements(AnActionEvent e) {
-    final InspectionResultsView invoker = getInvoker(e);
-    if (invoker == null) return new RefElement[0];
-    List<RefEntity> selection = new ArrayList<>(Arrays.asList(invoker.getTree().getSelectedElements()));
-    PsiDocumentManager.getInstance(invoker.getProject()).commitAllDocuments();
+  private static RefEntity[] getSelectedElements(InspectionResultsView view) {
+    if (view == null) return new RefElement[0];
+    List<RefEntity> selection = new ArrayList<>(Arrays.asList(view.getTree().getSelectedElements()));
+    PsiDocumentManager.getInstance(view.getProject()).commitAllDocuments();
     Collections.sort(selection, (o1, o2) -> {
       if (o1 instanceof RefElement && o2 instanceof RefElement) {
         RefElement r1 = (RefElement)o1;