inspection tool window: results of global inspection are not shown on analysis is done IDEA-154015

This commit is contained in:
Dmitry Batkovich
2016-04-01 14:40:36 +03:00
parent 8f6e2cbf8b
commit 69c7044e22
2 changed files with 22 additions and 11 deletions
@@ -356,8 +356,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
final InspectionResultsView view;
if (myView == null) {
view = new InspectionResultsView(GlobalInspectionContextImpl.this,
new InspectionRVContentProviderImpl(getProject()));
view = new InspectionResultsView(GlobalInspectionContextImpl.this, createContentProvider());
} else {
view = null;
}
@@ -682,9 +681,12 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
}
}
if (!ApplicationManager.getApplication().isUnitTestMode()) {
final InspectionResultsView view = createViewIfNeed();
if (!view.isDisposed()) {
ReadAction.run(() -> view.addTools(globalTools));
if (myView == null && !InspectionResultsView.hasProblems(globalTools, this, createContentProvider())) {
return;
}
createViewIfNeed();
if (!myView.isDisposed()) {
ReadAction.run(() -> myView.addTools(globalTools));
}
}
}
@@ -698,7 +700,7 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
if (newView != null) {
return newView;
}
newView = new InspectionResultsView(this, new InspectionRVContentProviderImpl(getProject()));
newView = new InspectionResultsView(this, createContentProvider());
addView(newView);
return newView;
});
@@ -1037,4 +1039,8 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
public boolean isSingleInspectionRun() {
return mySingleInspectionRun;
}
private InspectionRVContentProvider createContentProvider() {
return new InspectionRVContentProviderImpl(getProject());
}
}
@@ -993,11 +993,16 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
}
public boolean hasProblems() {
final Map<String, Tools> tools = myGlobalInspectionContext.getTools();
for (Tools currentTools : tools.values()) {
for (ScopeToolState state : myProvider.getTools(currentTools)) {
return hasProblems(myGlobalInspectionContext.getTools().values(), myGlobalInspectionContext, myProvider);
}
public static boolean hasProblems(@NotNull Collection<Tools> tools,
@NotNull GlobalInspectionContextImpl context,
@NotNull InspectionRVContentProvider contentProvider) {
for (Tools currentTools : tools) {
for (ScopeToolState state : contentProvider.getTools(currentTools)) {
InspectionToolWrapper toolWrapper = state.getTool();
if (myProvider.checkReportedProblems(myGlobalInspectionContext, toolWrapper)) {
if (contentProvider.checkReportedProblems(context, toolWrapper)) {
return true;
}
}
@@ -1079,8 +1084,8 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
myRerun = true;
if (myScope.isValid()) {
AnalysisUIOptions.getInstance(myProject).save(myGlobalInspectionContext.getUIOptions());
myGlobalInspectionContext.doInspections(myScope);
myGlobalInspectionContext.setTreeState(getTree().getTreeState());
myGlobalInspectionContext.doInspections(myScope);
}
}
}