Search in sources :

Example 6 with InspectionResultsView

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);
    }
}
Also used : InspectionResultsView(com.intellij.codeInspection.ui.InspectionResultsView) InspectionTree(com.intellij.codeInspection.ui.InspectionTree)

Example 7 with InspectionResultsView

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();
            }
        }
    });
}
Also used : InspectionResultsView(com.intellij.codeInspection.ui.InspectionResultsView)

Example 8 with InspectionResultsView

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;
}
Also used : InspectionResultsView(com.intellij.codeInspection.ui.InspectionResultsView) InspectionToolWrapper(com.intellij.codeInspection.ex.InspectionToolWrapper) QuickFixAction(com.intellij.codeInspection.ex.QuickFixAction) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with InspectionResultsView

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;
}
Also used : AnalysisScope(com.intellij.analysis.AnalysisScope) GlobalInspectionContextImpl(com.intellij.codeInspection.ex.GlobalInspectionContextImpl) OfflineInspectionRVContentProvider(com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvider) RefManagerImpl(com.intellij.codeInspection.reference.RefManagerImpl) InspectionManagerEx(com.intellij.codeInspection.ex.InspectionManagerEx) InspectionResultsView(com.intellij.codeInspection.ui.InspectionResultsView) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with InspectionResultsView

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);
        }
    });
}
Also used : InspectionResultsView(com.intellij.codeInspection.ui.InspectionResultsView)

Aggregations

InspectionResultsView (com.intellij.codeInspection.ui.InspectionResultsView)10 InspectionToolWrapper (com.intellij.codeInspection.ex.InspectionToolWrapper)3 NotNull (org.jetbrains.annotations.NotNull)3 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)2 InspectionTree (com.intellij.codeInspection.ui.InspectionTree)2 AnalysisScope (com.intellij.analysis.AnalysisScope)1 SuppressIntentionAction (com.intellij.codeInspection.SuppressIntentionAction)1 EditInspectionToolsSettingsAction (com.intellij.codeInspection.ex.EditInspectionToolsSettingsAction)1 GlobalInspectionContextImpl (com.intellij.codeInspection.ex.GlobalInspectionContextImpl)1 InspectionManagerEx (com.intellij.codeInspection.ex.InspectionManagerEx)1 InspectionProfileImpl (com.intellij.codeInspection.ex.InspectionProfileImpl)1 QuickFixAction (com.intellij.codeInspection.ex.QuickFixAction)1 OfflineInspectionRVContentProvider (com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvider)1 RefManagerImpl (com.intellij.codeInspection.reference.RefManagerImpl)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 DialogBuilder (com.intellij.openapi.ui.DialogBuilder)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1