diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java index 0258718b5cc8..e562dfd65e32 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java @@ -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 tools = ((InspectionProfileImpl)inspectionProfile).findToolsById((String)value, target); + List tools = inspectionProfile.findToolsById((String)value, target); if (tools == null) { continue; } diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java index 75d618dd3a19..b209a4534582 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java @@ -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 { ""); 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 tools = ((InspectionProfileImpl)model).getAllTools(getProject()); + List 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 diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionSchemeTest.kt b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionSchemeTest.kt index 58880e3e19fc..80557c15ec0b 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionSchemeTest.kt +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionSchemeTest.kt @@ -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) } diff --git a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java index 1b9d4c6cfc09..43423bdfaeb6 100644 --- a/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java +++ b/java/testFramework/src/com/intellij/codeInsight/daemon/DaemonAnalyzerTestCase.java @@ -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()); } } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java index d854fb100a66..30830e3d9852 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java @@ -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; } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java index 610d2790f5f3..71c4dc58987c 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -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; diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java index d8eba51572cc..72d2a47abb9d 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java @@ -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 getProfiles(); + Collection 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); } diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java index 319801f46a08..7a7b0004ade5 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java @@ -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(); } diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt index 96fbe275d64b..7b29d0357730 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManager.kt @@ -263,7 +263,7 @@ class ProjectInspectionProfileManager(val project: Project, override fun getScopesManager() = scopeManager - @Synchronized override fun getProfiles(): Collection { + @Synchronized override fun getProfiles(): Collection { 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 diff --git a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java index ef75dc963b62..cd26c2acced0 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/InspectionApplication.java @@ -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; } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java index 5ff9a2463391..ee5b263b6451 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java @@ -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 profiles = new ArrayList<>(); + InspectionProfileImpl selectedProfile = getGlobalInspectionContext(inspectionManager.getProject()).getCurrentProfile(); + List 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 { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionOnEditorAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionOnEditorAction.java index 43bd164f3726..465bad919324 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionOnEditorAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionOnEditorAction.java @@ -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); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/GotoInspectionModel.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/GotoInspectionModel.java index 72ef14ea9216..900d784ee6cc 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/GotoInspectionModel.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/GotoInspectionModel.java @@ -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) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java index ed36af601c51..a5d3d175d5d8 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/RunInspectionIntention.java @@ -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 allWrappers = new LinkedHashSet<>(); allWrappers.add(toolWrapper); rootProfile.collectDependentInspections(toolWrapper, allWrappers, managerEx.getProject()); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java b/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java index 28efc417b0c2..8dd5d6e50acf 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/ViewOfflineResultsAction.java @@ -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>> 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") { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java index 15a470a8e598..5369ddebe335 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java @@ -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 getProfiles() { + public Collection getProfiles() { initProfiles(); return Collections.unmodifiableList(mySchemeManager.getAllSchemes()); } diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsAction.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsAction.java index 5ea208305cc1..168a23178fe0 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsAction.java @@ -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 configurableAction) { final ShowSettingsUtil settingsUtil = ShowSettingsUtil.getInstance(); final ErrorsConfigurable errorsConfigurable = new ProjectInspectionToolsConfigurable(ProjectInspectionProfileManager.getInstanceImpl(project)) { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsInSuppressedPlaceIntention.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsInSuppressedPlaceIntention.java index 7e25100a1231..d6a69e715d49 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsInSuppressedPlaceIntention.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/EditInspectionToolsSettingsInSuppressedPlaceIntention.java @@ -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 diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNode.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNode.java index f09a2b6a88fd..db942749c01d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNode.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNode.java @@ -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() { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNodeInfo.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNodeInfo.java index 95a45dcf046a..64f40d229847 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNodeInfo.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionNodeInfo.java @@ -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(); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index 97051be0610c..8d9ed0755f43 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -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 { diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java index f431cd7c79a4..f3c6406f8a6d 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java @@ -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()) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/EditSettingsAction.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/EditSettingsAction.java index 7d62ba9d93e0..58e8c2db5663 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/EditSettingsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/actions/EditSettingsAction.java @@ -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); } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ErrorsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ErrorsConfigurable.java index 85c081114ed8..89ebbdd07f08 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ErrorsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ErrorsConfigurable.java @@ -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. @@ -16,22 +16,22 @@ 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(); } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index 5d9d795c5f79..99be2c516e2f 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -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 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()); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java index 35f64489ceb3..4f0fd6391cb2 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java @@ -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 profiles = getProfiles(); + final Collection profiles = getProfiles(); final List 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 getProfiles() { - final Collection result = new ArrayList<>(); + protected Collection getProfiles() { + final Collection 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) { diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesComboBox.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesComboBox.java index d1b3046e52bb..038d746e2228 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesComboBox.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/ProfilesComboBox.java @@ -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 { myComboModel = new SortedComboBoxModel<>(comparator); setModel(myComboModel); //noinspection GtkPreferredJComboBoxRenderer - setRenderer(new ListCellRenderer() { + setRenderer(new ListCellRenderer() { ListCellRendererWrapper baseRenderer = new ListCellRendererWrapper() { @Override public void customize(final JList list, @@ -67,25 +66,24 @@ public abstract class ProfilesComboBox extends ComboBox { @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 { setSelectedItem(inspectionProfile); } - public void reset(final Collection profiles) { + public void reset(final Collection profiles) { myComboModel.clear(); - for (Profile profile : profiles) { - myComboModel.add((InspectionProfileImpl)profile); + for (InspectionProfileImpl profile : profiles) { + myComboModel.add(profile); } findFirstGlobalProfile(); setSelectedIndex(0); diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index cae84db238e3..fa1b46ea522e 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -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()); } diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java index 26833e0a514f..dd4361cb0962 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/BaseInspection.java @@ -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 diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java index fda4126917fe..5bc14eacb10e 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/fixes/SuppressForTestsScopeFix.java @@ -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) { diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspectionTest.java index 27d6202dbcab..199c06bbe40e 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/migration/EqualsReplaceableByObjectsCallInspectionTest.java @@ -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()); } diff --git a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java index 7288228579b3..37962c5280cf 100644 --- a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java +++ b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java @@ -158,7 +158,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator { } private static void enableVersions(@NotNull Project project, @NotNull PsiElement file, @NotNull List 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()); } }