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);
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;