mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
inspection tool window: do not massively update ui when quick fix is applying
This commit is contained in:
+1
-6
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-13
@@ -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
|
||||
|
||||
+6
-2
@@ -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
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user