inspection tool window: do not massively update ui when quick fix is applying

This commit is contained in:
Dmitry Batkovich
2016-04-26 09:16:44 +03:00
parent 2d59fd6bdc
commit d21581eb9b
6 changed files with 22 additions and 28 deletions
@@ -443,12 +443,7 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
@Override
public boolean isElementIgnored(final RefEntity element) {
for (RefEntity entity : myIgnoreElements) {
if (Comparing.equal(entity, element)) {
return true;
}
}
return false;
return myIgnoreElements.contains(element);
}
@@ -113,12 +113,17 @@ public class QuickFixAction extends AnAction implements CustomComponentAction {
final InspectionResultsView view = getInvoker(e);
final InspectionTree tree = view.getTree();
final CommonProblemDescriptor[] descriptors;
if (isProblemDescriptorsAcceptable() && (descriptors = tree.getSelectedDescriptors(true)).length > 0) {
doApplyFix(view.getProject(), descriptors, tree.getContext());
} else {
doApplyFix(getSelectedElements(e), view);
try {
view.setUpdating(true);
view.syncRightPanel();
if (isProblemDescriptorsAcceptable() && (descriptors = tree.getSelectedDescriptors(true)).length > 0) {
doApplyFix(view.getProject(), descriptors, tree.getContext());
} else {
doApplyFix(getSelectedElements(e), view);
}
} finally {
view.setUpdating(false);
}
view.syncRightPanel();
}
@@ -735,24 +735,14 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
@Override
public boolean isElementIgnored(final RefEntity element) {
for (RefEntity entity : getIgnoredElements().keySet()) {
if (Comparing.equal(entity, element)) {
return true;
}
}
return false;
return getIgnoredElements().containsKey(element);
}
@Override
public boolean isProblemResolved(RefEntity refEntity, CommonProblemDescriptor descriptor) {
if (descriptor == null) return true;
for (RefEntity entity : getIgnoredElements().keySet()) {
if (Comparing.equal(entity, refEntity)) {
final CommonProblemDescriptor[] descriptors = getIgnoredElements().get(refEntity);
return ArrayUtil.contains(descriptor, descriptors);
}
}
return false;
CommonProblemDescriptor[] descriptors = getIgnoredElements().get(refEntity);
return descriptors != null && ArrayUtil.contains(descriptor, descriptors);
}
@Override
@@ -52,7 +52,7 @@ class InspectionViewPsiTreeChangeAdapter extends PsiTreeChangeAdapter {
myView = view;
myExecutor = new BoundedTaskExecutor(AppExecutorUtil.getAppExecutorService(), JobSchedulerImpl.CORES_COUNT, myView);
myUpdater = new MergingUpdateQueue("inspection.view.psi.update.listener",
200,
300,
true,
myView,
myView,
@@ -114,7 +114,11 @@ class InspectionViewPsiTreeChangeAdapter extends PsiTreeChangeAdapter {
UIUtil.invokeLaterIfNeeded(() -> {
myView.invalidate();
myView.repaint();
myView.syncRightPanel();
if (myView.isUpdating()) {
myView.updateRightPanelLoading();
} else {
myView.syncRightPanel();
}
});
}
}
@@ -81,7 +81,7 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode {
@Override
public int getProblemCount() {
return 1;
return myPresentation.isProblemResolved(getElement(), myDescriptor) ? 0 : 1;
}
@Override
@@ -181,7 +181,7 @@ public class QuickFixPreviewPanelFactory {
setBorder(IdeBorderFactory.createEmptyBorder(16, 9, 13, 0));
AsyncProcessIcon waitingIcon = new AsyncProcessIcon("Inspection preview panel updating...");
Disposer.register(this, waitingIcon);
myWaitingLabel = getLabel(1);
myWaitingLabel = getLabel(myView.getTree().getSelectedProblemCount());
add(myWaitingLabel);
add(waitingIcon);
}