inspection view: do not insert problem node twice

This commit is contained in:
Dmitry Batkovich
2017-12-06 17:01:54 +03:00
parent 07fc70b084
commit c3105c7335
2 changed files with 10 additions and 17 deletions
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.codeInspection.ex;
@@ -126,8 +114,7 @@ public class InspectionRVContentProviderImpl extends InspectionRVContentProvider
final RefElementNode elemNode = addNodeToParent(container, presentation, pNode);
for (CommonProblemDescriptor problem : problems) {
assert problem != null;
elemNode
.insertByOrder(ReadAction.compute(() -> new ProblemDescriptionNode(refElement, problem, presentation)), true);
elemNode.insertByOrder(ReadAction.compute(() -> new ProblemDescriptionNode(refElement, problem, presentation)), false);
elemNode.setProblem(elemNode.getChildCount() == 1 ? problems[0] : null);
}
}
@@ -42,7 +42,10 @@ import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.pom.Navigatable;
import com.intellij.profile.ProfileChangeAdapter;
import com.intellij.profile.codeInspection.ProjectInspectionProfileManager;
import com.intellij.psi.*;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.ui.*;
import com.intellij.util.EditSourceOnDoubleClickHandler;
@@ -53,6 +56,7 @@ import com.intellij.util.containers.HashSet;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.vfs.AsyncVfsEventsPostProcessor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -212,7 +216,7 @@ public class InspectionResultsView extends JPanel implements Disposable, DataPro
}
};
createActionsToolbar();
PsiManager.getInstance(getProject()).addPsiTreeChangeListener(new InspectionViewPsiTreeChangeAdapter(this), this);
AsyncVfsEventsPostProcessor.getInstance().addListener(new InspectionViewPsiTreeChangeAdapter(this), this);
ProjectInspectionProfileManager profileManager = ProjectInspectionProfileManager.getInstance(getProject());
profileManager.addProfileChangeListener(new ProfileChangeAdapter() {
@@ -653,8 +657,10 @@ public class InspectionResultsView extends JPanel implements Disposable, DataPro
final AnalysisUIOptions uiOptions = myGlobalInspectionContext.getUIOptions();
final InspectionToolPresentation presentation = myGlobalInspectionContext.getPresentation(wrapper);
if (presentation.getToolNode() == null) {
presentation.updateContent();
addTool(wrapper, HighlightDisplayLevel.find(presentation.getSeverity((RefElement)refElement)),
uiOptions.GROUP_BY_SEVERITY, isSingleInspectionRun());
return;
}
final InspectionNode toolNode = presentation.getToolNode();
LOG.assertTrue(toolNode != null);