Search in sources :

Example 6 with InspectionManagerEx

use of com.intellij.codeInspection.ex.InspectionManagerEx in project android by JetBrains.

the class AndroidTestCase method doGlobalInspectionTest.

/**
   * Given an inspection and a path to a directory that contains an "expected.xml" file, run the
   * inspection on the current test project and verify that its output matches that of the
   * expected file.
   */
protected final void doGlobalInspectionTest(@NotNull GlobalInspectionToolWrapper wrapper, @NotNull String globalTestDir, @NotNull AnalysisScope scope) {
    myFixture.enableInspections(wrapper.getTool());
    scope.invalidate();
    InspectionManagerEx inspectionManager = (InspectionManagerEx) InspectionManager.getInstance(getProject());
    GlobalInspectionContextForTests globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, wrapper);
    InspectionTestUtil.runTool(wrapper, scope, globalContext);
    InspectionTestUtil.compareToolResults(globalContext, wrapper, false, getTestDataPath() + globalTestDir);
}
Also used : InspectionManagerEx(com.intellij.codeInspection.ex.InspectionManagerEx) GlobalInspectionContextForTests(com.intellij.testFramework.fixtures.impl.GlobalInspectionContextForTests)

Example 7 with InspectionManagerEx

use of com.intellij.codeInspection.ex.InspectionManagerEx 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)

Aggregations

InspectionManagerEx (com.intellij.codeInspection.ex.InspectionManagerEx)7 AnalysisScope (com.intellij.analysis.AnalysisScope)4 GlobalInspectionContextImpl (com.intellij.codeInspection.ex.GlobalInspectionContextImpl)3 InspectionProfile (com.intellij.codeInspection.InspectionProfile)2 InspectionProfileImpl (com.intellij.codeInspection.ex.InspectionProfileImpl)2 InspectionToolWrapper (com.intellij.codeInspection.ex.InspectionToolWrapper)2 Project (com.intellij.openapi.project.Project)2 GlobalInspectionContextForTests (com.intellij.testFramework.fixtures.impl.GlobalInspectionContextForTests)2 ActionEvent (java.awt.event.ActionEvent)2 NotNull (org.jetbrains.annotations.NotNull)2 AnalysisUIOptions (com.intellij.analysis.AnalysisUIOptions)1 BaseAnalysisActionDialog (com.intellij.analysis.BaseAnalysisActionDialog)1 SchemesCombo (com.intellij.application.options.schemes.SchemesCombo)1 CleanupLocalInspectionTool (com.intellij.codeInspection.CleanupLocalInspectionTool)1 OfflineInspectionRVContentProvider (com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvider)1 RefElement (com.intellij.codeInspection.reference.RefElement)1 RefEntity (com.intellij.codeInspection.reference.RefEntity)1 RefManagerImpl (com.intellij.codeInspection.reference.RefManagerImpl)1 InspectionResultsView (com.intellij.codeInspection.ui.InspectionResultsView)1 ProblemDescriptionNode (com.intellij.codeInspection.ui.ProblemDescriptionNode)1