inspection toolwindow: more granulating calls of read actions

This commit is contained in:
Dmitry Batkovich
2016-07-06 18:25:39 +03:00
parent 20dcaac966
commit b58dc57487
2 changed files with 13 additions and 9 deletions
@@ -659,7 +659,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
}
createViewIfNeed();
if (!myView.isDisposed()) {
ReadAction.run(() -> myView.addTools(globalTools));
myView.addTools(globalTools);
}
}
}
@@ -39,6 +39,7 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.EditorColors;
@@ -367,7 +368,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
private JComponent createToolbar(final DefaultActionGroup specialGroup) {
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CODE_INSPECTION, specialGroup, false);
toolbar.setTargetComponent(this);
//toolbar.setTargetComponent(this);
return toolbar.getComponent();
}
@@ -670,7 +671,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
if (app.isUnitTestMode()) {
buildAction.run();
} else {
app.executeOnPooledThread(() -> app.runReadAction(buildAction));
app.executeOnPooledThread(buildAction);
}
}
@@ -721,12 +722,15 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName());
for (ScopeToolState state : myProvider.getTools(currentTools)) {
InspectionToolWrapper toolWrapper = state.getTool();
if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
addTool(toolWrapper,
profile.getErrorLevel(key, state.getScope(myProject), myProject),
isGroupedBySeverity,
singleInspectionRun);
}
LOG.assertTrue(!ApplicationManager.getApplication().isReadAccessAllowed());
ReadAction.run(() -> {
if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
addTool(toolWrapper,
profile.getErrorLevel(key, state.getScope(myProject), myProject),
isGroupedBySeverity,
singleInspectionRun);
}
});
}
}
}