diff --git a/platform/lang-impl/src/com/intellij/analysis/AnalysisUIOptions.java b/platform/lang-impl/src/com/intellij/analysis/AnalysisUIOptions.java index 62f94776688b..3836da904d92 100644 --- a/platform/lang-impl/src/com/intellij/analysis/AnalysisUIOptions.java +++ b/platform/lang-impl/src/com/intellij/analysis/AnalysisUIOptions.java @@ -208,11 +208,6 @@ public class AnalysisUIOptions implements PersistentStateComponent { - myUpdating = isUpdating; - myTree.setPaintBusy(isUpdating); - if (!isUpdating && myLoadingProgressPreview != null) { + if (isUpdating) { + myUpdatingRequestors++; + } else { + myUpdatingRequestors--; + } + boolean hasUpdatingRequestors = myUpdatingRequestors > 0; + myTree.setPaintBusy(hasUpdatingRequestors); + if (!hasUpdatingRequestors && myLoadingProgressPreview != null) { myLoadingProgressPreview.treeLoaded(); } }; @@ -620,8 +626,8 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren } } - public Object getTreeWriteLock() { - return myTreeWriteLock; + public Object getTreeStructureUpdateLock() { + return myTreeStructureUpdateLock; } public void buildTree() { @@ -629,19 +635,21 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren final Runnable buildAction = () -> { try { setUpdating(true); - InspectionProfile profile = myInspectionProfile; - boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY; - boolean singleInspectionRun = myGlobalInspectionContext.isSingleInspectionRun(); - myGroups.clear(); - final Map tools = myGlobalInspectionContext.getTools(); - for (Tools currentTools : tools.values()) { - InspectionToolWrapper defaultToolWrapper = currentTools.getDefaultState().getTool(); - final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName()); - for (ScopeToolState state : myProvider.getTools(currentTools)) { - InspectionToolWrapper toolWrapper = state.getTool(); - if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) { - addTool(toolWrapper, ((InspectionProfileImpl)profile).getErrorLevel(key, state.getScope(myProject), myProject), - isGroupedBySeverity, singleInspectionRun); + synchronized (getTreeStructureUpdateLock()) { + InspectionProfile profile = myInspectionProfile; + boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY; + boolean singleInspectionRun = myGlobalInspectionContext.isSingleInspectionRun(); + myGroups.clear(); + final Map tools = myGlobalInspectionContext.getTools(); + for (Tools currentTools : tools.values()) { + InspectionToolWrapper defaultToolWrapper = currentTools.getDefaultState().getTool(); + final HighlightDisplayKey key = HighlightDisplayKey.find(defaultToolWrapper.getShortName()); + for (ScopeToolState state : myProvider.getTools(currentTools)) { + InspectionToolWrapper toolWrapper = state.getTool(); + if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) { + addTool(toolWrapper, ((InspectionProfileImpl)profile).getErrorLevel(key, state.getScope(myProject), myProject), + isGroupedBySeverity, singleInspectionRun); + } } } } @@ -964,7 +972,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren } public boolean isUpdating() { - return myUpdating; + return myUpdatingRequestors > 0; } public void updateRightPanelLoading() {