mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inspections tool window: NPEs refixed
This commit is contained in:
+7
-4
@@ -77,10 +77,13 @@ public class OfflineInspectionRVContentProvider extends InspectionRVContentProvi
|
||||
final OfflineProblemDescriptorNode descriptorNode = (OfflineProblemDescriptorNode)node;
|
||||
final RefEntity element = descriptorNode.getElement();
|
||||
selectedElements.add(element);
|
||||
CommonProblemDescriptor[] quickFixes = actions.get(element);
|
||||
actions.put(element, quickFixes == null ?
|
||||
new CommonProblemDescriptor[]{descriptorNode.getDescriptor()} :
|
||||
DefaultInspectionToolPresentation.mergeDescriptors(quickFixes, new CommonProblemDescriptor[]{descriptorNode.getDescriptor()}));
|
||||
CommonProblemDescriptor[] descriptors = actions.get(element);
|
||||
final CommonProblemDescriptor descriptor = descriptorNode.getDescriptor();
|
||||
final CommonProblemDescriptor[] descriptorAsArray = descriptor == null ? CommonProblemDescriptor.EMPTY_ARRAY
|
||||
: new CommonProblemDescriptor[]{descriptor};
|
||||
actions.put(element, descriptors == null ?
|
||||
descriptorAsArray :
|
||||
DefaultInspectionToolPresentation.mergeDescriptors(descriptors, descriptorAsArray));
|
||||
}
|
||||
else if (node instanceof RefElementNode) {
|
||||
selectedElements.add(((RefElementNode)node).getElement());
|
||||
|
||||
-4
@@ -274,9 +274,6 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
Equality<CommonProblemDescriptor> equality = new Equality<CommonProblemDescriptor>() {
|
||||
@Override
|
||||
public boolean equals(CommonProblemDescriptor o1, CommonProblemDescriptor o2) {
|
||||
if (o1 == o2) {
|
||||
return true;
|
||||
}
|
||||
if (o1 instanceof ProblemDescriptor) {
|
||||
ProblemDescriptorBase p1 = (ProblemDescriptorBase)o1;
|
||||
ProblemDescriptorBase p2 = (ProblemDescriptorBase)o2;
|
||||
@@ -663,7 +660,6 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
if (allowedDescriptorSet != null && !allowedDescriptorSet.contains(d)) {
|
||||
continue;
|
||||
}
|
||||
if (d == null) continue;
|
||||
QuickFix[] fixes = d.getFixes();
|
||||
if (fixes != null) {
|
||||
if (isFirst) {
|
||||
|
||||
@@ -453,11 +453,13 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
PsiElement selectedElement = ((RefElement)selectedEntity).getElement();
|
||||
if (problemCount == 1) {
|
||||
CommonProblemDescriptor[] descriptors = myTree.getSelectedDescriptors();
|
||||
final CommonProblemDescriptor descriptor = descriptors[0];
|
||||
if (descriptor instanceof ProblemDescriptorBase) {
|
||||
final PsiElement element = ((ProblemDescriptorBase)descriptor).getPsiElement();
|
||||
if (element != null) {
|
||||
selectedElement = element;
|
||||
if (descriptors.length != 0) {
|
||||
final CommonProblemDescriptor descriptor = descriptors[0];
|
||||
if (descriptor instanceof ProblemDescriptorBase) {
|
||||
final PsiElement element = ((ProblemDescriptorBase)descriptor).getPsiElement();
|
||||
if (element != null) {
|
||||
selectedElement = element;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +247,10 @@ public class InspectionTree extends Tree {
|
||||
private static void traverseDescriptors(InspectionTreeNode node, LinkedHashSet<CommonProblemDescriptor> descriptors){
|
||||
if (node instanceof ProblemDescriptionNode) {
|
||||
if (node.isValid() && !node.isResolved()) {
|
||||
descriptors.add(((ProblemDescriptionNode)node).getDescriptor());
|
||||
final CommonProblemDescriptor descriptor = ((ProblemDescriptionNode)node).getDescriptor();
|
||||
if (descriptor != null) {
|
||||
descriptors.add(descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i = node.getChildCount() - 1; i >= 0; i--){
|
||||
|
||||
Reference in New Issue
Block a user