use of com.intellij.codeInspection.ui.InspectionResultsView in project intellij-community by JetBrains.
the class QuickFixAction method update.
@Override
public void update(AnActionEvent e) {
final InspectionResultsView view = getInvoker(e);
if (view == null) {
e.getPresentation().setEnabled(false);
return;
}
e.getPresentation().setVisible(false);
e.getPresentation().setEnabled(false);
final InspectionTree tree = view.getTree();
final InspectionToolWrapper toolWrapper = tree.getSelectedToolWrapper(true);
if (!view.isSingleToolInSelection() || toolWrapper != myToolWrapper) {
return;
}
if (!isProblemDescriptorsAcceptable() && tree.getSelectedElements().length > 0 || isProblemDescriptorsAcceptable() && tree.getSelectedDescriptors().length > 0) {
e.getPresentation().setVisible(true);
e.getPresentation().setEnabled(true);
}
}
use of com.intellij.codeInspection.ui.InspectionResultsView in project android by JetBrains.
the class AndroidLintLintBaselineInspection method rerun.
private static void rerun() {
// Attempt to re-run tne analysis. This isn't a service we can access programmatically unless we
// have the inspections view itself. We could attempt to hold on to the GlobalInspectionContextImpl
// after each lint run, but that object points to a huge amount of state and I don't want to risk
// leaking it.
//
// Therefore, instead we fish around the JComponent hierarchy and look for the window itself;
// from there we can invoke it. There's one wrinkle: we need to persist the analysis scope. Luckily
// we only need to do this very temporarily (from the rerun action to the AndroidLintGlobalInspectionContext
// processes it.)
ApplicationManager.getApplication().assertIsDispatchThread();
ApplicationManager.getApplication().runWriteAction(() -> {
for (Frame frame : Frame.getFrames()) {
InspectionResultsView view = findInspectionView(frame);
if (view != null && view.isRerunAvailable() && !view.isDisposed()) {
ourRerunScope = view.getScope();
view.rerun();
}
}
});
}
use of com.intellij.codeInspection.ui.InspectionResultsView in project intellij-community by JetBrains.
the class QuickFixesViewActionGroup method getChildren.
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
final InspectionResultsView view = getView(e);
if (view == null || InvokeQuickFixAction.cantApplyFixes(view)) {
return AnAction.EMPTY_ARRAY;
}
InspectionToolWrapper toolWrapper = view.getTree().getSelectedToolWrapper(true);
if (toolWrapper == null)
return AnAction.EMPTY_ARRAY;
final QuickFixAction[] quickFixes = view.getProvider().getQuickFixes(toolWrapper, view.getTree());
if (quickFixes == null || quickFixes.length == 0) {
return AnAction.EMPTY_ARRAY;
}
return quickFixes;
}
use of com.intellij.codeInspection.ui.InspectionResultsView in project intellij-community by JetBrains.
the class ViewOfflineResultsAction method showOfflineView.
@NotNull
public static InspectionResultsView showOfflineView(@NotNull Project project, @NotNull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap, @NotNull InspectionProfileImpl inspectionProfile, @NotNull String title) {
final AnalysisScope scope = new AnalysisScope(project);
final InspectionManagerEx managerEx = (InspectionManagerEx) InspectionManager.getInstance(project);
final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false);
context.setExternalProfile(inspectionProfile);
context.setCurrentScope(scope);
context.initializeTools(new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
final InspectionResultsView view = new InspectionResultsView(context, new OfflineInspectionRVContentProvider(resMap, project));
((RefManagerImpl) context.getRefManager()).startOfflineView();
context.addView(view, title, true);
view.update();
return view;
}
use of com.intellij.codeInspection.ui.InspectionResultsView in project intellij-community by JetBrains.
the class GlobalInspectionContextImpl method notifyInspectionsFinished.
@Override
protected void notifyInspectionsFinished(final AnalysisScope scope) {
if (ApplicationManager.getApplication().isUnitTestMode())
return;
UIUtil.invokeLaterIfNeeded(() -> {
LOG.info("Code inspection finished");
if (getProject().isDisposed())
return;
InspectionResultsView view = myView == null ? new InspectionResultsView(this, createContentProvider()) : null;
if (!(myView == null ? view : myView).hasProblems()) {
NOTIFICATION_GROUP.createNotification(InspectionsBundle.message("inspection.no.problems.message", scope.getFileCount(), scope.getShortenName()), MessageType.INFO).notify(getProject());
close(true);
if (view != null) {
Disposer.dispose(view);
}
} else if (view != null) {
addView(view);
view.update();
}
if (myView != null) {
myView.setUpdating(false);
}
});
}
Aggregations