mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inspection tool window: do not display useless nodes (inspection group, root) on run single inspection
This commit is contained in:
@@ -134,6 +134,7 @@ public class RunInspectionIntention implements IntentionAction, HighPriorityActi
|
||||
model.setEditable(toolWrapper.getDisplayName());
|
||||
final GlobalInspectionContextImpl inspectionContext = managerEx.createNewGlobalContext(false);
|
||||
inspectionContext.setExternalProfile(model);
|
||||
inspectionContext.setSingleInspectionRun(true);
|
||||
return inspectionContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
|
||||
private volatile InspectionResultsView myView;
|
||||
private Content myContent;
|
||||
private volatile boolean myViewClosed = true;
|
||||
private volatile boolean mySingleInspectionRun;
|
||||
|
||||
@NotNull
|
||||
private AnalysisUIOptions myUIOptions;
|
||||
@@ -988,4 +989,12 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
|
||||
public boolean isViewClosed() {
|
||||
return myViewClosed;
|
||||
}
|
||||
|
||||
public void setSingleInspectionRun(boolean singleInspectionRun) {
|
||||
mySingleInspectionRun = singleInspectionRun;
|
||||
}
|
||||
|
||||
public boolean isSingleInspectionRun() {
|
||||
return mySingleInspectionRun;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -247,7 +247,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
final InspectionNode toolNode;
|
||||
toolNode = myToolNode == null ?
|
||||
view.addTool(myToolWrapper, HighlightDisplayLevel.find(getSeverity((RefElement)refElement)),
|
||||
context.getUIOptions().GROUP_BY_SEVERITY) : myToolNode;
|
||||
context.getUIOptions().GROUP_BY_SEVERITY, context.isSingleInspectionRun()) : myToolNode;
|
||||
|
||||
final Map<RefEntity, CommonProblemDescriptor[]> problems = new HashMap<RefEntity, CommonProblemDescriptor[]>();
|
||||
problems.put(refElement, descriptors);
|
||||
|
||||
@@ -552,10 +552,11 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
@NotNull
|
||||
public InspectionNode addTool(@NotNull final InspectionToolWrapper toolWrapper,
|
||||
HighlightDisplayLevel errorLevel,
|
||||
boolean groupedBySeverity) {
|
||||
boolean groupedBySeverity,
|
||||
boolean isSingleInspectionRun) {
|
||||
String groupName =
|
||||
toolWrapper.getGroupDisplayName().isEmpty() ? InspectionProfileEntry.GENERAL_GROUP_NAME : toolWrapper.getGroupDisplayName();
|
||||
InspectionTreeNode parentNode = getToolParentNode(groupName, errorLevel, groupedBySeverity);
|
||||
InspectionTreeNode parentNode = getToolParentNode(groupName, errorLevel, groupedBySeverity, isSingleInspectionRun);
|
||||
InspectionNode toolNode = new InspectionNode(toolWrapper);
|
||||
boolean showStructure = myGlobalInspectionContext.getUIOptions().SHOW_STRUCTURE;
|
||||
myProvider.appendToolNodeContent(myGlobalInspectionContext, toolNode, parentNode, showStructure);
|
||||
@@ -628,6 +629,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
setUpdating(true);
|
||||
InspectionProfile profile = myInspectionProfile;
|
||||
boolean isGroupedBySeverity = myGlobalInspectionContext.getUIOptions().GROUP_BY_SEVERITY;
|
||||
boolean singleInspectionRun = myGlobalInspectionContext.isSingleInspectionRun();
|
||||
myGroups.clear();
|
||||
final Map<String, Tools> tools = myGlobalInspectionContext.getTools();
|
||||
for (Tools currentTools : tools.values()) {
|
||||
@@ -637,7 +639,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
InspectionToolWrapper toolWrapper = state.getTool();
|
||||
if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
|
||||
addTool(toolWrapper, ((InspectionProfileImpl)profile).getErrorLevel(key, state.getScope(myProject), myProject),
|
||||
isGroupedBySeverity);
|
||||
isGroupedBySeverity, singleInspectionRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -657,7 +659,13 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private InspectionTreeNode getToolParentNode(@NotNull String groupName, HighlightDisplayLevel errorLevel, boolean groupedBySeverity) {
|
||||
private InspectionTreeNode getToolParentNode(@NotNull String groupName,
|
||||
HighlightDisplayLevel errorLevel,
|
||||
boolean groupedBySeverity,
|
||||
boolean isSingleInspectionRun) {
|
||||
if (!groupedBySeverity && isSingleInspectionRun) {
|
||||
return getTree().getRoot();
|
||||
}
|
||||
if (groupName.isEmpty()) {
|
||||
return getRelativeRootNode(groupedBySeverity, errorLevel);
|
||||
}
|
||||
@@ -676,6 +684,9 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
}
|
||||
}
|
||||
if (group == null) {
|
||||
if (isSingleInspectionRun) {
|
||||
return getRelativeRootNode(true, errorLevel);
|
||||
}
|
||||
group = ConcurrencyUtil.cacheOrGet(map, groupName, new InspectionGroupNode(groupName));
|
||||
if (!myDisposed) {
|
||||
insertByIndex(group, getRelativeRootNode(groupedBySeverity, errorLevel));
|
||||
|
||||
@@ -63,6 +63,7 @@ public class InspectionTree extends Tree {
|
||||
myContext = context;
|
||||
|
||||
setCellRenderer(new CellRenderer());
|
||||
setRootVisible(!myContext.isSingleInspectionRun());
|
||||
setShowsRootHandles(true);
|
||||
UIUtil.setLineStyleAngled(this);
|
||||
addTreeWillExpandListener(new ExpandListener());
|
||||
|
||||
Reference in New Issue
Block a user