diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java index 66fcefae01f7..ff706074942e 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java @@ -62,7 +62,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro @NotNull private final GlobalInspectionContextImpl myContext; protected static String ourOutputPath; - protected InspectionNode myToolNode; + private InspectionNode myToolNode; private static final Object lock = new Object(); private final Map myProblemElements = Collections.synchronizedMap(new THashMap()); @@ -77,6 +77,8 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro protected static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.DescriptorProviderInspection"); private boolean isDisposed; + private final Object myToolLock = new Object(); + public DefaultInspectionToolPresentation(@NotNull InspectionToolWrapper toolWrapper, @NotNull GlobalInspectionContextImpl context) { myToolWrapper = toolWrapper; myContext = context; @@ -226,14 +228,16 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro return; } final InspectionNode toolNode; - if (myToolNode == null) { - final HighlightSeverity currentSeverity = getSeverity((RefElement)refElement); - toolNode = view.addTool(myToolWrapper, HighlightDisplayLevel.find(currentSeverity), context.getUIOptions().GROUP_BY_SEVERITY); - } - else { - toolNode = myToolNode; - if (toolNode.isTooBigForOnlineRefresh()) { - return; + synchronized (myToolLock) { + if (myToolNode == null) { + final HighlightSeverity currentSeverity = getSeverity((RefElement)refElement); + toolNode = view.addTool(myToolWrapper, HighlightDisplayLevel.find(currentSeverity), context.getUIOptions().GROUP_BY_SEVERITY); + } + else { + toolNode = myToolNode; + if (toolNode.isTooBigForOnlineRefresh()) { + return; + } } } final Map problems = new HashMap(); @@ -262,6 +266,13 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro } } + + public void setToolNode(InspectionNode toolNode) { + synchronized (myToolLock) { + myToolNode = toolNode; + } + } + protected boolean isDisposed() { return isDisposed; } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index 85e660401fea..268e48a1b8b1 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -469,7 +469,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren myProvider.appendToolNodeContent(myGlobalInspectionContext, toolNode, parentNode, showStructure); InspectionToolPresentation presentation = myGlobalInspectionContext.getPresentation(toolWrapper); toolNode = presentation.createToolNode(myGlobalInspectionContext, toolNode, myProvider, parentNode, showStructure); - ((DefaultInspectionToolPresentation)presentation).myToolNode = toolNode; + ((DefaultInspectionToolPresentation)presentation).setToolNode(toolNode); registerActionShortcuts(presentation); return toolNode;