mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inspection view: initialize only visible nodes
This commit is contained in:
+1
-2
@@ -17,12 +17,11 @@ public class OfflineProblemDescriptorNode extends ProblemDescriptionNode {
|
||||
private OfflineProblemDescriptorNode(OfflineDescriptorResolveResult descriptorResolveResult,
|
||||
@NotNull InspectionToolPresentation presentation,
|
||||
@NotNull OfflineProblemDescriptor offlineDescriptor) {
|
||||
super(descriptorResolveResult.getResolvedEntity(), descriptorResolveResult.getResolvedDescriptor(), presentation, false, offlineDescriptor::getLine);
|
||||
super(descriptorResolveResult.getResolvedEntity(), descriptorResolveResult.getResolvedDescriptor(), presentation, offlineDescriptor::getLine);
|
||||
myDescriptorResolveResult = descriptorResolveResult;
|
||||
if (descriptorResolveResult.getResolvedDescriptor() == null) {
|
||||
setUserObject(offlineDescriptor);
|
||||
}
|
||||
init(presentation.getContext().getProject());
|
||||
}
|
||||
|
||||
static OfflineProblemDescriptorNode create(@NotNull OfflineProblemDescriptor offlineDescriptor,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
@@ -193,6 +195,9 @@ public abstract class InspectionTreeNode extends DefaultMutableTreeNode {
|
||||
}
|
||||
}
|
||||
|
||||
protected void nodeAddedToTree() {
|
||||
}
|
||||
|
||||
private void propagateUpdater(InspectionTreeUpdater updater) {
|
||||
if (myUpdater != null) return;
|
||||
myUpdater = updater;
|
||||
@@ -200,6 +205,7 @@ public abstract class InspectionTreeNode extends DefaultMutableTreeNode {
|
||||
while (enumeration.hasMoreElements()) {
|
||||
InspectionTreeNode child = (InspectionTreeNode)enumeration.nextElement();
|
||||
child.propagateUpdater(updater);
|
||||
child.nodeAddedToTree();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
@@ -33,13 +35,12 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode {
|
||||
public ProblemDescriptionNode(RefEntity element,
|
||||
CommonProblemDescriptor descriptor,
|
||||
@NotNull InspectionToolPresentation presentation) {
|
||||
this(element, descriptor, presentation, true, null);
|
||||
this(element, descriptor, presentation, null);
|
||||
}
|
||||
|
||||
protected ProblemDescriptionNode(@Nullable RefEntity element,
|
||||
CommonProblemDescriptor descriptor,
|
||||
@NotNull InspectionToolPresentation presentation,
|
||||
boolean doInit,
|
||||
@Nullable IntSupplier lineNumberCounter) {
|
||||
super(descriptor, presentation);
|
||||
myElement = element;
|
||||
@@ -49,9 +50,6 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode {
|
||||
myLevel = descriptor instanceof ProblemDescriptor
|
||||
? profile.getErrorLevel(HighlightDisplayKey.find(shortName), ((ProblemDescriptor)descriptor).getStartElement())
|
||||
: profile.getTools(shortName, presentation.getContext().getProject()).getLevel();
|
||||
if (doInit) {
|
||||
init(presentation.getContext().getProject());
|
||||
}
|
||||
myLineNumber = myDescriptor instanceof ProblemDescriptor ? ((ProblemDescriptor)myDescriptor).getLineNumber() : (lineNumberCounter == null ? -1 : lineNumberCounter.getAsInt());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
@@ -26,7 +28,6 @@ public class RefElementNode extends SuppressableInspectionTreeNode {
|
||||
private final Icon myIcon;
|
||||
public RefElementNode(@Nullable RefEntity userObject, @NotNull InspectionToolPresentation presentation) {
|
||||
super(userObject, presentation);
|
||||
init(presentation.getContext().getProject());
|
||||
final RefEntity refEntity = getElement();
|
||||
myIcon = refEntity == null ? null : refEntity.getIcon(false);
|
||||
}
|
||||
|
||||
+12
-10
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
import com.intellij.codeInspection.CommonProblemDescriptor;
|
||||
@@ -76,15 +78,6 @@ public abstract class SuppressableInspectionTreeNode extends InspectionTreeNode
|
||||
myAvailableSuppressActions.remove(action);
|
||||
}
|
||||
|
||||
protected void init(Project project) {
|
||||
myPresentableName = calculatePresentableName();
|
||||
myValid = calculateIsValid();
|
||||
myAvailableSuppressActions = getElement() == null
|
||||
? Collections.emptySet()
|
||||
: calculateAvailableSuppressActions(project);
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public abstract RefEntity getElement();
|
||||
|
||||
@@ -123,6 +116,15 @@ public abstract class SuppressableInspectionTreeNode extends InspectionTreeNode
|
||||
return !isValid() ? "No longer valid" : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void nodeAddedToTree() {
|
||||
myPresentableName = calculatePresentableName();
|
||||
myValid = calculateIsValid();
|
||||
myAvailableSuppressActions = getElement() == null
|
||||
? Collections.emptySet()
|
||||
: calculateAvailableSuppressActions(myPresentation.getContext().getProject());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final Pair<PsiElement, CommonProblemDescriptor> getSuppressContent() {
|
||||
RefEntity refElement = getElement();
|
||||
|
||||
Reference in New Issue
Block a user