avoid InspectionProfileImpl class cast
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 27 Oct 2016 11:36:07 +0000 (13:36 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 27 Oct 2016 14:30:27 +0000 (16:30 +0200)
32 files changed:
java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java
java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java
java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionSchemeTest.kt
java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt
platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java
platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java
platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionOnEditorAction.java
platform/lang-impl/src/com/intellij/codeInspection/actions/GotoInspectionModel.java
platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java
platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java
platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java
platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsAction.java
platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsInSuppressedPlaceIntention.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNode.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNodeInfo.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java
platform/lang-impl/src/com/intellij/codeInspection/ui/actions/EditSettingsAction.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ErrorsConfigurable.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesComboBox.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java
plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java
plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspectionTest.java
python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java

index 0258718b5cc825574b3c1e1aff1825acd5c833b4..e562dfd65e32c96324e3406c75e3e7c6a71754b8 100644 (file)
@@ -22,7 +22,6 @@ package com.intellij.codeInsight.highlighting;
 
 import com.intellij.codeInsight.daemon.impl.*;
 import com.intellij.codeInspection.InspectionManager;
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.ex.*;
 import com.intellij.codeInspection.reference.RefManagerImpl;
 import com.intellij.openapi.diagnostic.Logger;
@@ -113,14 +112,13 @@ class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBase<PsiL
                                                                parent.getTextRange().getStartOffset(), parent.getTextRange().getEndOffset(),
                                                                myPriorityRange,
                                                                false, HighlightInfoProcessor.getEmpty());
-    final InspectionProfile inspectionProfile =
-      InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
+    InspectionProfileImpl inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
     for (PsiLiteralExpression target : targets) {
       final Object value = target.getValue();
       if (!(value instanceof String)) {
         continue;
       }
-      List<InspectionToolWrapper> tools = ((InspectionProfileImpl)inspectionProfile).findToolsById((String)value, target);
+      List<InspectionToolWrapper> tools = inspectionProfile.findToolsById((String)value, target);
       if (tools == null) {
         continue;
       }
index 75d618dd3a19cf3238f177dc75ac3851979e004c..b209a45345826ac2c1eda2c87c37a16f673c62d8 100644 (file)
@@ -24,7 +24,6 @@ import com.intellij.codeInspection.dataFlow.DataFlowInspection;
 import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
 import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase;
 import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.profile.Profile;
 import com.intellij.profile.codeInspection.BaseInspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.ProjectInspectionProfileManager;
@@ -220,7 +219,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
                                                   "</profile>");
     InspectionProfileImpl profile = createProfile(new InspectionProfileImpl("foo"));
     profile.readExternal(element);
-    ModifiableModel model = profile.getModifiableModel();
+    InspectionProfileImpl model = profile.getModifiableModel();
     model.commit();
     assertThat(profile.writeScheme()).isEqualTo(element);
 
@@ -268,7 +267,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
     profile = createProfile(new InspectionProfileImpl("foo"));
     profile.readExternal(unusedProfile);
     model = profile.getModifiableModel();
-    InspectionToolWrapper toolWrapper = ((InspectionProfileImpl)model).getInspectionTool("unused", getProject());
+    InspectionToolWrapper toolWrapper = model.getInspectionTool("unused", getProject());
     UnusedDeclarationInspectionBase tool = (UnusedDeclarationInspectionBase)toolWrapper.getTool();
     tool.ADD_NONJAVA_TO_ENTRIES = true;
     UnusedSymbolLocalInspectionBase inspectionTool = tool.getSharedLocalInspectionTool();
@@ -566,7 +565,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
     foo.initInspectionTools(getProject());
     assertEquals(0, countInitializedTools(foo));
 
-    ModifiableModel model = foo.getModifiableModel();
+    InspectionProfileImpl model = foo.getModifiableModel();
     assertEquals(0, countInitializedTools(model));
     model.commit();
     assertEquals(0, countInitializedTools(model));
@@ -574,7 +573,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
 
     model = foo.getModifiableModel();
     assertEquals(0, countInitializedTools(model));
-    List<ScopeToolState> tools = ((InspectionProfileImpl)model).getAllTools(getProject());
+    List<ScopeToolState> tools = model.getAllTools(getProject());
     for (ScopeToolState tool : tools) {
       if (!tool.isEnabled()) {
         tool.setEnabled(true);
@@ -623,8 +622,8 @@ public class InspectionProfileTest extends LightIdeaTestCase {
     assertEquals(1, countInitializedTools(foo));
   }
 
-  public static int countInitializedTools(@NotNull Profile foo) {
-    return getInitializedTools((InspectionProfileImpl)foo).size();
+  public static int countInitializedTools(@NotNull InspectionProfileImpl foo) {
+    return getInitializedTools(foo).size();
   }
 
   @NotNull
index 58880e3e19fcba6fb7674f1e0f8e0e0da0205ac5..80557c15ec0bc651773d2e3e39d908286e9dbdb4 100644 (file)
@@ -52,7 +52,7 @@ class InspectionSchemeTest {
     profileManager.initProfiles()
 
     assertThat(profileManager.profiles).hasSize(1)
-    val scheme = profileManager.profiles.first() as InspectionProfileImpl
+    val scheme = profileManager.profiles.first()
     assertThat(scheme.name).isEqualTo("Bar")
 
     runInInitMode { scheme.initInspectionTools(null) }
index 1b9d4c6cfc09cdfd270907bf1296258820f05621..43423bdfaeb69123252b1ce007df817330ba0211 100644 (file)
@@ -24,7 +24,6 @@ import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
 import com.intellij.codeInsight.intention.IntentionAction;
 import com.intellij.codeInsight.intention.IntentionManager;
 import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.InspectionProfileEntry;
 import com.intellij.codeInspection.InspectionToolProvider;
 import com.intellij.codeInspection.LocalInspectionTool;
@@ -152,9 +151,9 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
   }
 
   protected void disableInspectionTool(@NotNull String shortName){
-    InspectionProfile profile = InspectionProjectProfileManager.getInstance(getProject()).getCurrentProfile();
+    InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(getProject()).getCurrentProfile();
     if (profile.getInspectionTool(shortName, getProject()) != null) {
-      ((InspectionProfileImpl)profile).disableTool(shortName, getProject());
+      profile.disableTool(shortName, getProject());
     }
   }
 
index d854fb100a665a276065b0e8714b8ffdf2bd7adf..30830e3d985295dce5ebb8fc484ee8ad9f81b8a6 100644 (file)
@@ -116,7 +116,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
     ProjectInspectionProfileManager profileManager = ProjectInspectionProfileManager.getInstanceImpl(myProject);
     InspectionProfileImpl profile = profileManager.getProfile(currentProfile, false);
     if (profile == null) {
-      profile = (InspectionProfileImpl)InspectionProfileManager.getInstance().getProfile(currentProfile);
+      profile = InspectionProfileManager.getInstance().getProfile(currentProfile);
       if (profile != null) {
         return profile;
       }
index 610d2790f5f38ee432dd63f522d313b5bcec921e..71c4dc58987cd55f318dda9aee30b625cad4d94a 100644 (file)
@@ -195,7 +195,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
   }
 
   @Override
-  public InspectionProfile getParentProfile() {
+  public InspectionProfileImpl getParentProfile() {
     return mySource;
   }
 
@@ -878,7 +878,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
 
     for (Element scopeElement : scopes.getChildren(SCOPE)) {
       final String profile = scopeElement.getAttributeValue(PROFILE);
-      InspectionProfileImpl inspectionProfile = profile == null ? null : (InspectionProfileImpl)getProfileManager().getProfile(profile);
+      InspectionProfileImpl inspectionProfile = profile == null ? null : getProfileManager().getProfile(profile);
       NamedScope scope = inspectionProfile == null ? null : getProfileManager().getScopesManager().getScope(scopeElement.getAttributeValue(NAME));
       if (scope == null) {
         continue;
index d8eba51572cc45ded2759563caea866931bf5d74..72d2a47abb9db64ca6d1e2ac8dda9e30675f5916 100644 (file)
@@ -16,7 +16,7 @@
 package com.intellij.profile.codeInspection;
 
 import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
-import com.intellij.codeInspection.InspectionProfile;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.project.Project;
@@ -32,7 +32,7 @@ public interface InspectionProfileManager {
   String INSPECTION_DIR = "inspection";
 
   @NotNull
-  Collection<InspectionProfile> getProfiles();
+  Collection<InspectionProfileImpl> getProfiles();
 
   default NamedScopesHolder getScopesManager() {
     return null;
@@ -61,11 +61,11 @@ public interface InspectionProfileManager {
   }
 
   @NotNull
-  InspectionProfile getCurrentProfile();
+  InspectionProfileImpl getCurrentProfile();
 
-  InspectionProfile getProfile(@NotNull String name, boolean returnRootProfileIfNamedIsAbsent);
+  InspectionProfileImpl getProfile(@NotNull String name, boolean returnRootProfileIfNamedIsAbsent);
 
-  default InspectionProfile getProfile(@NotNull String name) {
+  default InspectionProfileImpl getProfile(@NotNull String name) {
     return getProfile(name, true);
   }
 
index 319801f46a08f3482d321e1c73cbc00e66bf30d8..7a7b0004ade5722d74d75e37d0911d766a4f888a 100644 (file)
@@ -36,10 +36,10 @@ public abstract class InspectionProjectProfileManager implements InspectionProfi
   }
 
   /**
-   * @deprecated  use {@link #getCurrentProfile()} instead
+   * @deprecated use {@link #getCurrentProfile()} instead
    */
   @NotNull
-  public InspectionProfile getInspectionProfile(PsiElement element){
+  public InspectionProfile getInspectionProfile(PsiElement element) {
     return getCurrentProfile();
   }
 
index 96fbe275d64b27723ba7c121fabd3091140ad362..7b29d03577309c898c67bc9b74a58022ce8e9586 100644 (file)
@@ -263,7 +263,7 @@ class ProjectInspectionProfileManager(val project: Project,
 
   override fun getScopesManager() = scopeManager
 
-  @Synchronized override fun getProfiles(): Collection<InspectionProfile> {
+  @Synchronized override fun getProfiles(): Collection<InspectionProfileImpl> {
     currentProfile
     return schemeManager.allSchemes
   }
@@ -297,7 +297,7 @@ class ProjectInspectionProfileManager(val project: Project,
     if (!state.useProjectProfile) {
       return (state.projectProfile?.let {
         applicationProfileManager.getProfile(it, false)
-      } ?: applicationProfileManager.currentProfile) as InspectionProfileImpl
+      } ?: applicationProfileManager.currentProfile)
     }
 
     var currentScheme = schemeManager.currentScheme
@@ -330,6 +330,6 @@ class ProjectInspectionProfileManager(val project: Project,
 
   @Synchronized override fun getProfile(name: String, returnRootProfileIfNamedIsAbsent: Boolean): InspectionProfileImpl? {
     val profile = schemeManager.findSchemeByName(name)
-    return profile ?: applicationProfileManager.getProfile(name, returnRootProfileIfNamedIsAbsent) as InspectionProfileImpl?
+    return profile ?: applicationProfileManager.getProfile(name, returnRootProfileIfNamedIsAbsent)
   }
 }
\ No newline at end of file
index ef75dc963b62c987a3ae01c331b45d0dcd40dd9f..cd26c2acced02243dd67712574982cfed742483d 100644 (file)
@@ -36,7 +36,6 @@ import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.vfs.LocalFileSystem;
 import com.intellij.openapi.vfs.VirtualFile;
 import com.intellij.openapi.vfs.VirtualFileManager;
-import com.intellij.profile.Profile;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.PsiDirectory;
 import com.intellij.psi.PsiManager;
@@ -149,12 +148,12 @@ public class InspectionApplication {
       logMessageLn(1, InspectionsBundle.message("inspection.done"));
       logMessage(1, InspectionsBundle.message("inspection.application.initializing.project"));
 
-      Profile inspectionProfile = loadInspectionProfile();
+      InspectionProfileImpl inspectionProfile = loadInspectionProfile();
       if (inspectionProfile == null) return;
 
       final InspectionManagerEx im = (InspectionManagerEx)InspectionManager.getInstance(myProject);
 
-      im.createNewGlobalContext(true).setExternalProfile((InspectionProfileImpl)inspectionProfile);
+      im.createNewGlobalContext(true).setExternalProfile(inspectionProfile);
       im.setProfile(inspectionProfile.getName());
 
       final AnalysisScope scope;
@@ -257,7 +256,7 @@ public class InspectionApplication {
       final String descriptionsFile = resultsDataPath + File.separatorChar + DESCRIPTIONS + XML_EXTENSION;
       describeInspections(descriptionsFile,
                           myRunWithEditorSettings ? null : inspectionProfile.getName(),
-                          (InspectionProfile)inspectionProfile);
+                          inspectionProfile);
       inspectionsResults.add(new File(descriptionsFile));
       // convert report
       if (reportConverter != null) {
@@ -339,7 +338,7 @@ public class InspectionApplication {
         if (inspectionProfile != null) return inspectionProfile;
       }
 
-      inspectionProfile = (InspectionProfileImpl)InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
+      inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getCurrentProfile();
       logError("Using default project profile");
     }
     return inspectionProfile;
@@ -356,16 +355,15 @@ public class InspectionApplication {
 
   @Nullable
   private InspectionProfileImpl loadProfileByName(final String profileName) {
-    InspectionProfileImpl inspectionProfile =
-      (InspectionProfileImpl)InspectionProjectProfileManager.getInstance(myProject).getProfile(profileName, false);
+    InspectionProfileImpl inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getProfile(profileName, false);
     if (inspectionProfile != null) {
       logMessageLn(1, "Loaded shared project profile \'" + profileName + "\'");
     }
     else {
       //check if ide profile is used for project
-      for (InspectionProfile profile : InspectionProjectProfileManager.getInstance(myProject).getProfiles()) {
+      for (InspectionProfileImpl profile : InspectionProjectProfileManager.getInstance(myProject).getProfiles()) {
         if (Comparing.strEqual(profile.getName(), profileName)) {
-          inspectionProfile = (InspectionProfileImpl)profile;
+          inspectionProfile = profile;
           logMessageLn(1, "Loaded local profile \'" + profileName + "\'");
           break;
         }
index 5ff9a24633919bbd5f71be799926ec53542cd5c6..ee5b263b6451a5e075ca3f0cd3f5b9d39d09bbaf 100644 (file)
@@ -158,7 +158,7 @@ public class CodeInspectionAction extends BaseAnalysisAction {
     @Override
     protected void addProfile(InspectionProfileImpl model) {
       super.addProfile(model);
-      myProfilesCombo.addProfile((InspectionProfileImpl)model.getParentProfile());
+      myProfilesCombo.addProfile(model.getParentProfile());
     }
 
     @Override
@@ -178,12 +178,12 @@ public class CodeInspectionAction extends BaseAnalysisAction {
                               InspectionProfileManager inspectionProfileManager,
                               InspectionProjectProfileManager inspectionProjectProfileManager,
                               InspectionManagerEx inspectionManager) {
-    final InspectionProfile selectedProfile = getGlobalInspectionContext(inspectionManager.getProject()).getCurrentProfile();
-    List<Profile> profiles = new ArrayList<>();
+    InspectionProfileImpl selectedProfile = getGlobalInspectionContext(inspectionManager.getProject()).getCurrentProfile();
+    List<InspectionProfileImpl> profiles = new ArrayList<>();
     profiles.addAll(inspectionProfileManager.getProfiles());
     profiles.addAll(inspectionProjectProfileManager.getProfiles());
     profilesCombo.reset(profiles);
-    profilesCombo.selectProfile((InspectionProfileImpl)selectedProfile);
+    profilesCombo.selectProfile(selectedProfile);
   }
 
   private static class AdditionalPanel {
index 43bd164f37262e7a4dba160d49b16fb6859fd442..465bad9193240a078d613df2cf2834632782b87a 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
 import com.intellij.codeInspection.InspectionManager;
 import com.intellij.codeInspection.ex.GlobalInspectionContextImpl;
 import com.intellij.codeInspection.ex.InspectionManagerEx;
-import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.openapi.actionSystem.AnAction;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -50,7 +49,7 @@ public class CodeInspectionOnEditorAction extends AnAction {
     final AnalysisScope scope = new AnalysisScope(psiFile);
     final GlobalInspectionContextImpl inspectionContext = inspectionManagerEx.createNewGlobalContext(false);
     inspectionContext.setCurrentScope(scope);
-    inspectionContext.setExternalProfile((InspectionProfileImpl)InspectionProjectProfileManager.getInstance(project).getCurrentProfile());
+    inspectionContext.setExternalProfile(InspectionProjectProfileManager.getInstance(project).getCurrentProfile());
     inspectionContext.doInspections(scope);
   }
 
index 72ef14ea9216ba3af58a25d638c4194742475a0a..900d784ee6cc92ff44c68fb8e188de0514a1fa04 100644 (file)
@@ -42,7 +42,7 @@ public class GotoInspectionModel extends SimpleChooseByNameModel {
 
   public GotoInspectionModel(Project project) {
     super(project, IdeBundle.message("prompt.goto.inspection.enter.name"), "goto.inspection.help.id");
-    final InspectionProfileImpl rootProfile = (InspectionProfileImpl)InspectionProfileManager.getInstance().getCurrentProfile();
+    final InspectionProfileImpl rootProfile = InspectionProfileManager.getInstance().getCurrentProfile();
     for (ScopeToolState state : rootProfile.getAllTools(project)) {
       InspectionToolWrapper tool = LocalInspectionToolWrapper.findTool2RunInBatch(project, null, rootProfile, state.getTool());
       if (tool != null) {
index ed36af601c51e43aea1e30c60628e2e4d73c7990..a5d3d175d5d8e9ec6788a691b4b5ca7cfaf764ab 100644 (file)
@@ -135,7 +135,7 @@ public class RunInspectionIntention implements IntentionAction, HighPriorityActi
   public static InspectionProfileImpl createProfile(@NotNull InspectionToolWrapper toolWrapper,
                                                     @NotNull InspectionManagerEx managerEx,
                                                     @Nullable PsiElement psiElement) {
-    InspectionProfileImpl rootProfile = (InspectionProfileImpl)InspectionProfileManager.getInstance().getCurrentProfile();
+    InspectionProfileImpl rootProfile = InspectionProfileManager.getInstance().getCurrentProfile();
     LinkedHashSet<InspectionToolWrapper> allWrappers = new LinkedHashSet<>();
     allWrappers.add(toolWrapper);
     rootProfile.collectDependentInspections(toolWrapper, allWrappers, managerEx.getProject());
index 28efc417b0c25c0691e6b2f826a9ce742d132cbb..8dd5d6e50acfa653dea69a577414ec639c9ef939 100644 (file)
@@ -49,7 +49,6 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.ui.Messages;
 import com.intellij.openapi.util.Computable;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.profile.Profile;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 import com.intellij.psi.PsiElement;
@@ -146,7 +145,7 @@ public class ViewOfflineResultsAction extends AnAction {
                                                       final String profileName,
                                                       @NotNull final Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap,
                                                       @NotNull String title) {
-    Profile profile;
+    InspectionProfileImpl profile;
     if (profileName != null) {
       profile = InspectionProjectProfileManager.getInstance(project).getProfile(profileName, false);
       if (profile == null) {
@@ -158,7 +157,7 @@ public class ViewOfflineResultsAction extends AnAction {
     }
     final InspectionProfileImpl inspectionProfile;
     if (profile != null) {
-      inspectionProfile = (InspectionProfileImpl)profile;
+      inspectionProfile = profile;
     }
     else {
       inspectionProfile = new InspectionProfileImpl(profileName != null ? profileName : "Server Side") {
index 15a470a8e598134c9e7f7f2fa25615610b237384..5369ddebe33500c5e71ebaae6cb0ffcfd406a8fa 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
 import com.intellij.codeInsight.daemon.impl.SeveritiesProvider;
 import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
 import com.intellij.codeInsight.daemon.impl.analysis.HighlightingSettingsPerFile;
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.InspectionsBundle;
 import com.intellij.configurationStore.BundledSchemeEP;
 import com.intellij.configurationStore.SchemeDataHolder;
@@ -149,7 +148,7 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
 
   @Override
   @NotNull
-  public Collection<InspectionProfile> getProfiles() {
+  public Collection<InspectionProfileImpl> getProfiles() {
     initProfiles();
     return Collections.unmodifiableList(mySchemeManager.getAllSchemes());
   }
index 5ea208305cc18f563e96c77ddcf20ba79e09ce51..168a23178fe09517ae7345b6ee51992d49689f22 100644 (file)
@@ -19,9 +19,7 @@ package com.intellij.codeInspection.ex;
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInsight.intention.HighPriorityAction;
 import com.intellij.codeInsight.intention.IntentionAction;
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.icons.AllIcons;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.editor.Editor;
@@ -46,10 +44,6 @@ import java.util.function.Consumer;
 public class EditInspectionToolsSettingsAction implements IntentionAction, Iconable, HighPriorityAction {
   private final String myShortName;
 
-  public EditInspectionToolsSettingsAction(@NotNull LocalInspectionTool tool) {
-    myShortName = tool.getShortName();
-  }
-
   public EditInspectionToolsSettingsAction(@NotNull HighlightDisplayKey key) {
     myShortName = key.toString();
   }
@@ -74,31 +68,27 @@ public class EditInspectionToolsSettingsAction implements IntentionAction, Icona
   @Override
   public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
     final InspectionProjectProfileManager projectProfileManager = InspectionProjectProfileManager.getInstance(file.getProject());
-    InspectionProfile inspectionProfile = projectProfileManager.getCurrentProfile();
+    InspectionProfileImpl inspectionProfile = projectProfileManager.getCurrentProfile();
     editToolSettings(project,
-                     inspectionProfile, true,
+                     inspectionProfile,
                      myShortName);
   }
 
   public boolean editToolSettings(final Project project,
-                                  final InspectionProfileImpl inspectionProfile,
-                                  final boolean canChooseDifferentProfiles) {
+                                  final InspectionProfileImpl inspectionProfile) {
     return editToolSettings(project,
                             inspectionProfile,
-                            canChooseDifferentProfiles,
                             myShortName);
   }
 
   public static boolean editToolSettings(final Project project,
-                                         final InspectionProfile inspectionProfile,
-                                         final boolean canChooseDifferentProfile,
+                                         final InspectionProfileImpl inspectionProfile,
                                          final String selectedToolShortName) {
-    return editSettings(project, inspectionProfile, canChooseDifferentProfile, c -> c.selectInspectionTool(selectedToolShortName));
+    return editSettings(project, inspectionProfile, c -> c.selectInspectionTool(selectedToolShortName));
   }
 
   public static boolean editSettings(final Project project,
-                                     final InspectionProfile inspectionProfile,
-                                     final boolean canChooseDifferentProfile,
+                                     final InspectionProfileImpl inspectionProfile,
                                      final Consumer<ErrorsConfigurable> configurableAction) {
     final ShowSettingsUtil settingsUtil = ShowSettingsUtil.getInstance();
     final ErrorsConfigurable errorsConfigurable = new ProjectInspectionToolsConfigurable(ProjectInspectionProfileManager.getInstanceImpl(project)) {
index 7e25100a12317b0919d2ace50caf743ac2520fe3..d6a69e715d49bdb96b99ab304bba463ce8dddecb 100644 (file)
@@ -90,7 +90,7 @@ public class EditInspectionToolsSettingsInSuppressedPlaceIntention implements In
   @Nullable
   private InspectionToolWrapper getTool(final Project project, final PsiFile file) {
     final InspectionProjectProfileManager projectProfileManager = InspectionProjectProfileManager.getInstance(project);
-    final InspectionProfileImpl inspectionProfile = (InspectionProfileImpl)projectProfileManager.getCurrentProfile();
+    final InspectionProfileImpl inspectionProfile = projectProfileManager.getCurrentProfile();
     return inspectionProfile.getToolById(myId, file);
   }
 
@@ -99,8 +99,8 @@ public class EditInspectionToolsSettingsInSuppressedPlaceIntention implements In
     InspectionToolWrapper toolWrapper = getTool(project, file);
     if (toolWrapper == null) return;
     final InspectionProjectProfileManager projectProfileManager = InspectionProjectProfileManager.getInstance(project);
-    final InspectionProfileImpl inspectionProfile = (InspectionProfileImpl)projectProfileManager.getCurrentProfile();
-    EditInspectionToolsSettingsAction.editToolSettings(project, inspectionProfile, false, toolWrapper.getShortName());
+    final InspectionProfileImpl inspectionProfile = projectProfileManager.getCurrentProfile();
+    EditInspectionToolsSettingsAction.editToolSettings(project, inspectionProfile, toolWrapper.getShortName());
   }
 
   @Override
index f09a2b6a88fd19c44588b05ffe00f545a67a2973..db942749c01df43f440fce11127298c5130ece40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
 
 package com.intellij.codeInspection.ui;
 
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.codeInspection.ex.InspectionToolWrapper;
 import com.intellij.codeInspection.ex.ToolsImpl;
@@ -29,9 +28,9 @@ import org.jetbrains.annotations.Nullable;
 public class InspectionNode extends InspectionTreeNode {
   @NotNull private final InspectionProfileImpl myProfile;
 
-  public InspectionNode(@NotNull InspectionToolWrapper toolWrapper, @NotNull InspectionProfile profile) {
+  public InspectionNode(@NotNull InspectionToolWrapper toolWrapper, @NotNull InspectionProfileImpl profile) {
     super(toolWrapper);
-    myProfile = (InspectionProfileImpl)profile;
+    myProfile = profile;
   }
 
   public String toString() {
index 95a45dcf046af68a2240603ecf1f6aafcdb4bffc..64f40d2298474a4ce944ebc779a81cb9a9f75d7b 100644 (file)
@@ -50,8 +50,7 @@ public class InspectionNodeInfo extends JPanel {
     setBorder(IdeBorderFactory.createEmptyBorder(11, 0, 0, 0));
     final InspectionToolWrapper toolWrapper = tree.getSelectedToolWrapper(false);
     LOG.assertTrue(toolWrapper != null);
-    InspectionProfileImpl currentProfile =
-      (InspectionProfileImpl)InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
+    InspectionProfileImpl currentProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
     final ToolsImpl tools = currentProfile.getTools(toolWrapper.getShortName(), project);
     boolean enabled = tools.isEnabled();
 
index 97051be0610cd3107adb7d78a642809b09e2e922..8d9ed0755f43ad9a7f4efddfae13cec27051ce78 100644 (file)
@@ -701,7 +701,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
     return myInspectionProfile == null ? null : myInspectionProfile.getDisplayName();
   }
 
-  public InspectionProfile getCurrentProfile() {
+  public InspectionProfileImpl getCurrentProfile() {
     return myInspectionProfile;
   }
 
@@ -1130,7 +1130,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
 
   public void updateCurrentProfile() {
     final String name = myInspectionProfile.getName();
-    myInspectionProfile = (InspectionProfileImpl)myInspectionProfile.getProfileManager().getProfile(name);
+    myInspectionProfile = myInspectionProfile.getProfileManager().getProfile(name);
   }
 
   private class RerunAction extends AnAction {
index f431cd7c79a4106315c28351cb870c10e8d09b10..f3c6406f8a6d6cdff6d299517cbcb2da45e92274 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -64,7 +64,7 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode {
     myElement = element;
     myDescriptor = descriptor;
     myToolWrapper = toolWrapper;
-    final InspectionProfileImpl profile = (InspectionProfileImpl)presentation.getContext().getCurrentProfile();
+    final InspectionProfileImpl profile = presentation.getContext().getCurrentProfile();
     myLevel = descriptor instanceof ProblemDescriptor
               ? profile
                 .getErrorLevel(HighlightDisplayKey.find(toolWrapper.getShortName()), ((ProblemDescriptor)descriptor).getStartElement())
index 7d62ba9d93e063196bbf4345b1d65cfaf20d636c..58e8c2db5663dd9139d2d9c8f1c9572343c4b73c 100644 (file)
@@ -16,7 +16,6 @@
 package com.intellij.codeInspection.ui.actions;
 
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
-import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.InspectionsBundle;
 import com.intellij.codeInspection.ex.EditInspectionToolsSettingsAction;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
@@ -44,7 +43,7 @@ public class EditSettingsAction extends InspectionViewActionBase {
   @Override
   public void actionPerformed(AnActionEvent e) {
     final InspectionResultsView view = getView(e);
-    InspectionProfile inspectionProfile = view.getCurrentProfile();
+    InspectionProfileImpl inspectionProfile = view.getCurrentProfile();
 
     if (view.isSingleInspectionRun()) {
       InspectionToolWrapper tool = inspectionProfile.getInspectionTool(inspectionProfile.getSingleTool(), view.getProject());
@@ -80,7 +79,7 @@ public class EditSettingsAction extends InspectionViewActionBase {
       if (toolWrapper != null) {
         final HighlightDisplayKey key = HighlightDisplayKey.find(toolWrapper.getShortName()); //do not search for dead code entry point tool
         if (key != null) {
-          if (new EditInspectionToolsSettingsAction(key).editToolSettings(view.getProject(), (InspectionProfileImpl)inspectionProfile, false)) {
+          if (new EditInspectionToolsSettingsAction(key).editToolSettings(view.getProject(), inspectionProfile)) {
             view.updateCurrentProfile();
           }
           return;
@@ -88,7 +87,7 @@ public class EditSettingsAction extends InspectionViewActionBase {
       }
 
       final String[] path = view.getTree().getSelectedGroupPath();
-      if (EditInspectionToolsSettingsAction.editSettings(view.getProject(), inspectionProfile, false, (c) -> {
+      if (EditInspectionToolsSettingsAction.editSettings(view.getProject(), inspectionProfile, (c) -> {
         if (path != null) {
           c.selectInspectionGroup(path);
         }
index 85c081114ed862ef8b80ce94d921fca4552c6035..89ebbdd07f080666079cf04eb9ae96d7a55cd6ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package com.intellij.profile.codeInspection.ui;
 
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.openapi.options.Configurable;
-import com.intellij.openapi.options.ex.ConfigurableExtensionPointUtil;
-import com.intellij.openapi.project.Project;
-import com.intellij.profile.Profile;
-import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
- * Marker interface for the configurable which is used to configure the current inspection profile. 
+ * Marker interface for the configurable which is used to configure the current inspection profile.
  *
  * @author yole
  */
 public interface ErrorsConfigurable extends Configurable {
-  void selectProfile(final Profile profile);
+  void selectProfile(InspectionProfileImpl profile);
+
   void selectInspectionTool(final String selectedToolShortName);
+
   void selectInspectionGroup(final String[] groupPath);
+
   @Nullable
   Object getSelectedObject();
 }
index 5d9d795c5f792d6a1696d69536df5bda524f5838..99be2c516e2f8ccdc38b7e6ba0e701a20de5fc33 100644 (file)
@@ -22,7 +22,6 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
 import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
 import com.intellij.codeInsight.hint.HintUtil;
 import com.intellij.codeInspection.InspectionsBundle;
-import com.intellij.codeInspection.ModifiableModel;
 import com.intellij.codeInspection.ex.*;
 import com.intellij.icons.AllIcons;
 import com.intellij.ide.CommonActionsManager;
@@ -124,10 +123,10 @@ public class SingleInspectionProfilePanel extends JPanel {
   };
 
   public SingleInspectionProfilePanel(@NotNull ProjectInspectionProfileManager projectProfileManager,
-                                      @NotNull ModifiableModel profile) {
+                                      @NotNull InspectionProfileImpl profile) {
     super(new BorderLayout());
     myProjectProfileManager = projectProfileManager;
-    myProfile = (InspectionProfileImpl)profile;
+    myProfile = profile;
   }
 
   public Map<HighlightDisplayKey, ToolDescriptors> getInitialToolDescriptors() {
@@ -608,7 +607,7 @@ public class SingleInspectionProfilePanel extends JPanel {
         if (!myIsInRestore) {
           InspectionProfileImpl selected = myProfile;
           if (selected != null) {
-            InspectionProfileImpl baseProfile = (InspectionProfileImpl)selected.getParentProfile();
+            InspectionProfileImpl baseProfile = selected.getParentProfile();
             if (baseProfile != null) {
               getExpandedNodes(baseProfile).setSelectionPaths(myTreeTable.getTree().getSelectionPaths());
             }
@@ -655,7 +654,7 @@ public class SingleInspectionProfilePanel extends JPanel {
       @Override
       public void treeCollapsed(TreeExpansionEvent event) {
         InspectionProfileImpl selected = myProfile;
-        final InspectionProfileImpl parentProfile = (InspectionProfileImpl)selected.getParentProfile();
+        final InspectionProfileImpl parentProfile = selected.getParentProfile();
         if (parentProfile != null) {
           getExpandedNodes(parentProfile).saveVisibleState(myTreeTable.getTree());
         }
@@ -667,7 +666,7 @@ public class SingleInspectionProfilePanel extends JPanel {
         InspectionProfileImpl selected = myProfile;
         if (selected != null) {
           final InspectionConfigTreeNode node = (InspectionConfigTreeNode)event.getPath().getLastPathComponent();
-          final InspectionProfileImpl parentProfile = (InspectionProfileImpl)selected.getParentProfile();
+          final InspectionProfileImpl parentProfile = selected.getParentProfile();
           if (parentProfile != null) {
             getExpandedNodes(parentProfile).expandNode(node);
           }
@@ -1018,9 +1017,11 @@ public class SingleInspectionProfilePanel extends JPanel {
     return myProfile;
   }
 
-  private void setProfile(final ModifiableModel modifiableModel) {
-    if (myProfile == modifiableModel) return;
-    myProfile = (InspectionProfileImpl)modifiableModel;
+  private void setProfile(InspectionProfileImpl modifiableModel) {
+    if (myProfile == modifiableModel) {
+      return;
+    }
+    myProfile = modifiableModel;
     initToolStates();
   }
 
@@ -1120,7 +1121,7 @@ public class SingleInspectionProfilePanel extends JPanel {
     final InspectionProfileImpl selectedProfile = getProfile();
 
     BaseInspectionProfileManager profileManager = selectedProfile.isProjectLevel() ? myProjectProfileManager : (BaseInspectionProfileManager)InspectionProfileManager.getInstance();
-    InspectionProfileImpl parentProfile = (InspectionProfileImpl)selectedProfile.getParentProfile();
+    InspectionProfileImpl parentProfile = selectedProfile.getParentProfile();
 
     if (parentProfile.getProfileManager().getProfile(parentProfile.getName(), false) == parentProfile) {
       parentProfile.getProfileManager().deleteProfile(parentProfile.getName());
index 35f64489ceb37ff936304cd53d52d5e43d0d31be..4f0fd6391cb2192e43769fabef79e1f2496a0e9a 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.profile.codeInspection.ui.header;
 
 import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
 import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
-import com.intellij.codeInspection.ModifiableModel;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.codeInspection.ex.InspectionToolRegistrar;
 import com.intellij.codeInspection.ex.InspectionToolWrapper;
@@ -46,7 +45,6 @@ import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.openapi.vfs.VfsUtilCore;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.profile.Profile;
 import com.intellij.profile.codeInspection.BaseInspectionProfileManager;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.intellij.profile.codeInspection.ProjectInspectionProfileManager;
@@ -380,9 +378,9 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
                 myProfiles.getProfilesComboBox().removeProfile(existed.getProfile());
                 myPanels.remove(existed);
               }
-              final ModifiableModel model = profile.getModifiableModel();
+              InspectionProfileImpl model = profile.getModifiableModel();
               model.setModified(true);
-              addProfile((InspectionProfileImpl)model);
+              addProfile(model);
               selectProfile(model);
 
               //TODO myDeletedProfiles ? really need this
@@ -539,11 +537,11 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
   private void doReset() {
     myDeletedProfiles.clear();
     disposeUIResources();
-    final Collection<Profile> profiles = getProfiles();
+    final Collection<InspectionProfileImpl> profiles = getProfiles();
     final List<InspectionProfileImpl> modifiableProfiles = new ArrayList<>(profiles.size());
-    for (Profile profile : profiles) {
-      final ModifiableModel modifiableProfile = ((InspectionProfileImpl)profile).getModifiableModel();
-      final InspectionProfileImpl inspectionProfile = (InspectionProfileImpl)modifiableProfile;
+    for (InspectionProfileImpl profile : profiles) {
+      InspectionProfileImpl modifiableProfile = profile.getModifiableModel();
+      final InspectionProfileImpl inspectionProfile = modifiableProfile;
       modifiableProfiles.add(inspectionProfile);
       final SingleInspectionProfilePanel panel = createPanel(inspectionProfile);
       myPanels.add(panel);
@@ -587,8 +585,8 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
     return inspectionProfile.getProfileManager() == myProjectProfileManager ? projectProfileFound : ideProfileFound;
   }
 
-  protected Collection<Profile> getProfiles() {
-    final Collection<Profile> result = new ArrayList<>();
+  protected Collection<InspectionProfileImpl> getProfiles() {
+    final Collection<InspectionProfileImpl> result = new ArrayList<>();
     result.addAll(new TreeSet<>(myApplicationProfileManager.getProfiles()));
     result.addAll(myProjectProfileManager.getProfiles());
     return result;
@@ -607,8 +605,8 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
   }
 
   @Override
-  public void selectProfile(Profile profile) {
-    myProfiles.getProfilesComboBox().selectProfile((InspectionProfileImpl)profile);
+  public void selectProfile(InspectionProfileImpl profile) {
+    myProfiles.getProfilesComboBox().selectProfile(profile);
   }
 
   private SingleInspectionProfilePanel getProfilePanel(InspectionProfileImpl profile) {
index d1b3046e52bb9689b62d8f49dc3064f4622a3bef..038d746e2228b3c8d1b3e021fbdb4cbc6eba8546 100644 (file)
@@ -18,7 +18,6 @@ package com.intellij.profile.codeInspection.ui.header;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.icons.AllIcons;
 import com.intellij.openapi.ui.ComboBox;
-import com.intellij.profile.Profile;
 import com.intellij.ui.IdeBorderFactory;
 import com.intellij.ui.ListCellRendererWrapper;
 import com.intellij.ui.SortedComboBoxModel;
@@ -50,7 +49,7 @@ public abstract class ProfilesComboBox extends ComboBox<InspectionProfileImpl> {
     myComboModel = new SortedComboBoxModel<>(comparator);
     setModel(myComboModel);
     //noinspection GtkPreferredJComboBoxRenderer
-    setRenderer(new ListCellRenderer<Object>() {
+    setRenderer(new ListCellRenderer<InspectionProfileImpl>() {
       ListCellRendererWrapper<InspectionProfileImpl> baseRenderer = new ListCellRendererWrapper<InspectionProfileImpl>() {
         @Override
         public void customize(final JList list,
@@ -67,25 +66,24 @@ public abstract class ProfilesComboBox extends ComboBox<InspectionProfileImpl> {
 
       @Override
       public Component getListCellRendererComponent(JList list,
-                                                    Object o,
+                                                    InspectionProfileImpl o,
                                                     int index,
                                                     boolean isSelected,
                                                     boolean cellHasFocus) {
-        InspectionProfileImpl value = (InspectionProfileImpl)o;
         TitledSeparator separator = null;
         if (index != -1) {
-          if (!value.isProjectLevel()) {
-            if (value == myFirstGlobalProfile) {
+          if (!o.isProjectLevel()) {
+            if (o == myFirstGlobalProfile) {
               separator = new TitledSeparator(GLOBAL_LEVEL_SEPARATOR_TEXT);
             }
           }
           else {
-            if (value == myComboModel.get(0)) {
+            if (o == myComboModel.get(0)) {
               separator = new TitledSeparator(PROJECT_LEVEL_SEPARATOR_TEXT);
             }
           }
         }
-        Component renderedComponent = baseRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+        Component renderedComponent = baseRenderer.getListCellRendererComponent(list, o, index, isSelected, cellHasFocus);
         if (separator == null) {
           return renderedComponent;
         }
@@ -119,10 +117,10 @@ public abstract class ProfilesComboBox extends ComboBox<InspectionProfileImpl> {
     setSelectedItem(inspectionProfile);
   }
 
-  public void reset(final Collection<? extends Profile> profiles) {
+  public void reset(final Collection<InspectionProfileImpl> profiles) {
     myComboModel.clear();
-    for (Profile profile : profiles) {
-      myComboModel.add((InspectionProfileImpl)profile);
+    for (InspectionProfileImpl profile : profiles) {
+      myComboModel.add(profile);
     }
     findFirstGlobalProfile();
     setSelectedIndex(0);
index cae84db238e3513a593aa22e1d838ee545eda35b..fa1b46ea522e7f5c60aaa8f77223ce4c5bd170ff 100644 (file)
@@ -58,7 +58,6 @@ import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.*;
 import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
-import com.intellij.openapi.application.AccessToken;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.application.Result;
 import com.intellij.openapi.application.WriteAction;
@@ -354,7 +353,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
 
   @Override
   public void disableInspections(@NotNull InspectionProfileEntry... inspections) {
-    InspectionProfileImpl profile = (InspectionProfileImpl)InspectionProjectProfileManager.getInstance(getProject()).getCurrentProfile();
+    InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(getProject()).getCurrentProfile();
     for (InspectionProfileEntry inspection : inspections) {
       profile.disableTool(inspection.getShortName(), getProject());
     }
index 26833e0a514f12eb05c38d751f0db970f70fed75..dd4361cb096280bb47999007fbc4c6c93fe4f873 100644 (file)
@@ -214,7 +214,7 @@ public abstract class BaseInspection extends BaseJavaBatchLocalInspectionTool {
 
   public static boolean isInspectionEnabled(@NonNls String shortName, PsiElement context) {
     final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(context.getProject());
-    final InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getCurrentProfile();
+    final InspectionProfileImpl profile = profileManager.getCurrentProfile();
     return profile.isToolEnabled(HighlightDisplayKey.find(shortName), context);
   }
 }
\ No newline at end of file
index fda4126917feba5cfb25efdf6a13a9150aef02c8..5bc14eacb10eb267fb985de98b9506a87dd6c820 100644 (file)
@@ -85,7 +85,7 @@ public class SuppressForTestsScopeFix extends InspectionGadgetsFix {
 
   private void addRemoveTestsScope(Project project, boolean add) {
     final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
-    final InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getCurrentProfile();
+    final InspectionProfileImpl profile = profileManager.getCurrentProfile();
     final String shortName = myInspection.getShortName();
     final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project);
     if (tool == null) {
index 27d6202dbcabd094de7c163ae8aa44f86db62269..199c06bbe40ebd012313b438f75754d53d50ae78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2015 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
 import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInspection.LocalInspectionTool;
 import com.intellij.codeInspection.ex.InspectionProfileImpl;
-import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
+import com.intellij.profile.codeInspection.InspectionProfileManager;
 import com.siyeh.ig.LightInspectionTestCase;
 import org.jetbrains.annotations.Nullable;
 
@@ -32,7 +32,7 @@ public class EqualsReplaceableByObjectsCallInspectionTest extends LightInspectio
   @Override
   public void setUp() throws Exception {
     super.setUp();
-    final InspectionProfileImpl profile = (InspectionProfileImpl)InspectionProjectProfileManager.getInstance(getProject()).getInspectionProfile();
+    final InspectionProfileImpl profile = InspectionProfileManager.getInstance(getProject()).getCurrentProfile();
     profile.setErrorLevel(HighlightDisplayKey.find("EqualsReplaceableByObjectsCall"), HighlightDisplayLevel.WARNING, getProject());
   }
 
index 7288228579b33bd5298df3ebf6df273e0315dbc8..37962c5280cfc4c40dcc4f3936f57fcb13f9032a 100644 (file)
@@ -158,7 +158,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator {
   }
 
   private static void enableVersions(@NotNull Project project, @NotNull PsiElement file, @NotNull List<LanguageLevel> versions) {
-    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
+    final InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
     final String shortName = getCompatibilityInspectionShortName();
     final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project);
     if (tool != null) {
@@ -166,7 +166,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator {
         final PyCompatibilityInspection inspection = (PyCompatibilityInspection)model.getUnwrappedTool(shortName, file);
         inspection.ourVersions.addAll(ContainerUtil.map(versions, LanguageLevel::toString));
       });
-      EditInspectionToolsSettingsAction.editToolSettings(project, profile, true, shortName);
+      EditInspectionToolsSettingsAction.editToolSettings(project, profile, shortName);
     }
   }
 
@@ -231,7 +231,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator {
   }
 
   private static void enableCompatibilityInspection(@NotNull Project project) {
-    final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
+    final InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile();
     final InspectionToolWrapper tool = profile.getInspectionTool(getCompatibilityInspectionShortName(), project);
     if (tool != null) {
       // Partially copied from JSLinterInspection 
@@ -241,7 +241,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator {
         state.setEnabled(true);
       }
       profile.modifyProfile(model -> model.enableTool(tool.getShortName(), null, project));
-      EditInspectionToolsSettingsAction.editToolSettings(project, profile, true, getCompatibilityInspectionShortName());
+      EditInspectionToolsSettingsAction.editToolSettings(project, profile, getCompatibilityInspectionShortName());
     }
   }