From 037be986b3e87ce36bae3cd173271ecb2aea6672 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 7 Jun 2016 12:36:49 +0200 Subject: [PATCH] remove ApplicationProfileManager --- .../ex/EntryPointsManagerBase.java | 4 +- .../util/SpecialAnnotationsUtilBase.java | 4 +- .../javaDoc/JavaDocLocalInspection.java | 4 +- .../impl/DaemonRespondToChangesTest.java | 4 +- .../ex/InspectionProfileTest.java | 7 +- .../MisspelledHeaderInspection.java | 4 +- .../daemon/InspectionProfileConvertor.java | 4 +- .../daemon/impl/HighlightInfoType.java | 4 +- .../daemon/impl/SeverityRegistrar.java | 7 +- .../codeInspection/InspectionManagerBase.java | 4 +- .../ex/GlobalInspectionContextBase.java | 4 +- .../ex/InspectionProfileImpl.java | 12 +- .../profile/ApplicationProfileManager.java | 58 ------- .../InspectionProfileManager.java | 42 ++++- .../InspectionProjectProfileManager.java | 3 +- .../ProjectInspectionProfileManagerImpl.kt | 2 +- .../actions/CodeInspectionAction.java | 6 +- ...plicationInspectionProfileManagerImpl.java | 5 +- .../QuickChangeInspectionProfileAction.java | 2 +- ...PlatformInspectionProfileConfigurator.java | 2 +- .../codeInspection/ui/ProfilesComboBox.java | 161 ------------------ .../ProjectInspectionToolsConfigurable.java | 4 +- .../ui/SingleInspectionProfilePanel.java | 7 +- .../header/InspectionToolsConfigurable.java | 8 +- .../testFramework/LightPlatformTestCase.java | 4 +- .../impl/CodeInsightTestFixtureImpl.java | 5 +- .../SuppressionAnnotationInspection.java | 4 +- .../inspection/DependsOnGroupsInspection.java | 4 +- .../rest/quickfixes/AddIgnoredRoleFix.java | 4 +- .../DomElementAnnotationsManagerImpl.java | 4 +- 30 files changed, 98 insertions(+), 289 deletions(-) delete mode 100644 platform/analysis-impl/src/com/intellij/profile/ApplicationProfileManager.java delete mode 100644 platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProfilesComboBox.java diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java index f9696573b6fc..9d23670141dd 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerBase.java @@ -31,7 +31,7 @@ import com.intellij.openapi.extensions.impl.ExtensionPointImpl; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.JDOMExternalizableStringList; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.psi.PsiDocCommentOwner; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiManager; @@ -98,7 +98,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen ADDITIONAL_ANNOS = null; UIUtil.invokeLaterIfNeeded(() -> { if (ApplicationManager.getApplication().isDisposed()) return; - ApplicationProfileManager.getInstance().fireProfileChanged(null); + InspectionProfileManager.getInstance().fireProfileChanged(null); }); } DaemonCodeAnalyzer.getInstance(project).restart(); // annotations changed diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/util/SpecialAnnotationsUtilBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/util/SpecialAnnotationsUtilBase.java index 15290186a224..dff7bdb91b7d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/util/SpecialAnnotationsUtilBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/util/SpecialAnnotationsUtilBase.java @@ -21,7 +21,7 @@ import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiAnnotation; import com.intellij.psi.PsiElement; @@ -67,7 +67,7 @@ public class SpecialAnnotationsUtilBase { //correct save settings //TODO lesya - ApplicationProfileManager.getInstance().fireProfileChanged(inspectionProfile); + InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile); /* try { inspectionProfile.save(); diff --git a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java index e4243a1a19f8..19483d3ba301 100644 --- a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavaDocLocalInspection.java @@ -11,7 +11,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.pom.Navigatable; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; @@ -398,7 +398,7 @@ public class JavaDocLocalInspection extends JavaDocLocalInspectionBase { public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { myInspection.registerAdditionalTag(myTag); InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); - ApplicationProfileManager.getInstance().fireProfileChanged(profile); + InspectionProfileManager.getInstance().fireProfileChanged(profile); } @Override diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java index a2db867a8d36..7dc205e74202 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java @@ -109,7 +109,7 @@ import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; import com.intellij.psi.impl.DebugUtil; @@ -1199,7 +1199,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { public void testDaemonIgnoresFrameDeactivation() throws Throwable { DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true); // return default value to avoid unnecessary save - ApplicationProfileManager.getInstance().setRootProfile(InspectionProfileImpl.getDefaultProfile().getName()); // reset to default profile from the custom one to avoid unnecessary save + InspectionProfileManager.getInstance().setRootProfile(InspectionProfileImpl.getDefaultProfile().getName()); // reset to default profile from the custom one to avoid unnecessary save String text = "class S { ArrayListXXX x;}"; configureByText(StdFileTypes.JAVA, text); 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 eac77fa7de28..a8b9c38b38a9 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java @@ -25,7 +25,6 @@ import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase; import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspectionBase; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.WriteExternalException; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; @@ -82,10 +81,10 @@ public class InspectionProfileTest extends LightIdeaTestCase { } private static InspectionProfileImpl createProfile() { - return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), ApplicationProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile(), null); + return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile(), null); } private static InspectionProfileImpl createProfile(@NotNull InspectionProfileImpl base) { - return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), ApplicationProfileManager.getInstance(), base, null); + return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), base, null); } public void testSameNameSharedProfile() throws Exception { @@ -100,7 +99,7 @@ public class InspectionProfileTest extends LightIdeaTestCase { InspectionProfileImpl profile = new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), projectProfileManager, InspectionProfileImpl.getDefaultProfile(), null); projectProfileManager.updateProfile(profile); - projectProfileManager.setProjectProfile(profile.getName()); + projectProfileManager.setRootProfile(profile.getName()); assertTrue(projectProfileManager.getCurrentProfile() == profile); } diff --git a/java/manifest/src/org/jetbrains/lang/manifest/highlighting/MisspelledHeaderInspection.java b/java/manifest/src/org/jetbrains/lang/manifest/highlighting/MisspelledHeaderInspection.java index 54ebcd672ac4..e84d1310c6da 100644 --- a/java/manifest/src/org/jetbrains/lang/manifest/highlighting/MisspelledHeaderInspection.java +++ b/java/manifest/src/org/jetbrains/lang/manifest/highlighting/MisspelledHeaderInspection.java @@ -27,7 +27,7 @@ package org.jetbrains.lang.manifest.highlighting; import com.intellij.codeInspection.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElementVisitor; @@ -185,7 +185,7 @@ public class MisspelledHeaderInspection extends LocalInspectionTool { myHeaders.add(myHeaderName); InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); - ApplicationProfileManager.getInstance().fireProfileChanged(profile); + InspectionProfileManager.getInstance().fireProfileChanged(profile); } } } diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java index 3e563c966ae0..6464bfe1cc4f 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java @@ -24,7 +24,7 @@ import com.intellij.openapi.application.PathManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.SeverityProvider; import org.jdom.Document; import org.jdom.Element; @@ -130,7 +130,7 @@ public class InspectionProfileConvertor { } private static void renameOldDefaultsProfile() { - String directoryPath = PathManager.getConfigPath() + File.separator + ApplicationProfileManager.INSPECTION_DIR; + String directoryPath = PathManager.getConfigPath() + File.separator + InspectionProfileManager.INSPECTION_DIR; File profileDirectory = new File(directoryPath); if (!profileDirectory.exists()) { return; diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java index 23d1ca856f98..6c8c94fcd51a 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java @@ -27,7 +27,7 @@ import com.intellij.openapi.editor.colors.EditorColors; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.WriteExternalException; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiElement; import org.jdom.Element; @@ -341,7 +341,7 @@ public interface HighlightInfoType { @NotNull public HighlightSeverity getSeverity(final PsiElement psiElement) { InspectionProfile profile = psiElement == null - ? ApplicationProfileManager.getInstance().getCurrentProfile() + ? InspectionProfileManager.getInstance().getCurrentProfile() : InspectionProjectProfileManager.getInstance(psiElement.getProject()).getCurrentProfile(); HighlightDisplayLevel level = profile.getErrorLevel(myToolKey, psiElement); LOG.assertTrue(level != HighlightDisplayLevel.DO_NOT_SHOW); diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java index cb038292f76e..b773c60aa146 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java @@ -23,8 +23,7 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.JDOMExternalizableStringList; -import com.intellij.profile.ApplicationProfileManager; -import com.intellij.profile.codeInspection.InspectionProjectProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.util.IncorrectOperationException; import com.intellij.util.concurrency.AtomicFieldUpdater; import com.intellij.util.containers.ContainerUtil; @@ -82,8 +81,8 @@ public class SeverityRegistrar implements Comparator { @NotNull public static SeverityRegistrar getSeverityRegistrar(@Nullable Project project) { return project == null - ? ApplicationProfileManager.getInstance().getSeverityRegistrar() - : InspectionProjectProfileManager.getInstance(project).getSeverityRegistrar(); + ? InspectionProfileManager.getInstance().getSeverityRegistrar() + : InspectionProfileManager.getInstance(project).getSeverityRegistrar(); } public void registerSeverity(@NotNull SeverityBasedTextAttributes info, Color renderColor) { diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/InspectionManagerBase.java b/platform/analysis-impl/src/com/intellij/codeInspection/InspectionManagerBase.java index ac69af318d62..082e127f34fe 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/InspectionManagerBase.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/InspectionManagerBase.java @@ -17,7 +17,7 @@ package com.intellij.codeInspection; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NonNls; @@ -177,7 +177,7 @@ public abstract class InspectionManagerBase extends InspectionManager { if (myCurrentProfileName == null) { myCurrentProfileName = ProjectInspectionProfileManagerImpl.getInstanceImpl(getProject()).getProjectProfile(); if (myCurrentProfileName == null) { - myCurrentProfileName = ApplicationProfileManager.getInstance().getCurrentProfile().getName(); + myCurrentProfileName = InspectionProfileManager.getInstance().getCurrentProfile().getName(); } } return myCurrentProfileName; 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 eeeb574f0b57..d17301e536a5 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java @@ -33,8 +33,8 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.UserDataHolderBase; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; import com.intellij.psi.search.LocalSearchScope; @@ -113,7 +113,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G final InspectionProjectProfileManager inspectionProfileManager = InspectionProjectProfileManager.getInstance(myProject); Profile profile = inspectionProfileManager.getProfile(currentProfile, false); if (profile == null) { - profile = ApplicationProfileManager.getInstance().getProfile(currentProfile); + profile = InspectionProfileManager.getInstance().getProfile(currentProfile); if (profile != null) return (InspectionProfile)profile; final String[] availableProfileNames = inspectionProfileManager.getAvailableProfileNames(); 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 018c2957a69d..4d807c2e957a 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -32,9 +32,9 @@ import com.intellij.openapi.options.ExternalizableScheme; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.ProfileEx; import com.intellij.profile.ProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImplKt; import com.intellij.profile.codeInspection.SeverityProvider; import com.intellij.psi.PsiElement; @@ -110,7 +110,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, } public InspectionProfileImpl(@NotNull @NonNls String profileName) { - this(profileName, InspectionToolRegistrar.getInstance(), ApplicationProfileManager.getInstance(), null, null); + this(profileName, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), null, null); } public InspectionProfileImpl(@NotNull String profileName, @@ -148,7 +148,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, return Arrays.asList(toolWrappers); } }; - final InspectionProfileImpl profile = new InspectionProfileImpl(name, registrar, ApplicationProfileManager.getInstance()); + final InspectionProfileImpl profile = new InspectionProfileImpl(name, registrar, InspectionProfileManager.getInstance()); initAndDo((Computable)() -> { profile.initInspectionTools(project); return null; @@ -455,7 +455,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, @Override public void save() { - ApplicationProfileManager.getInstance().fireProfileChanged(this); + InspectionProfileManager.getInstance().fireProfileChanged(this); } @Nullable @@ -480,7 +480,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, for (ScopeToolState toolState : getAllTools(null)) { toolState.scopesChanged(); } - ApplicationProfileManager.getInstance().fireProfileChanged(this); + InspectionProfileManager.getInstance().fireProfileChanged(this); } @Override @@ -818,7 +818,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, myTools = model.myTools; myProfileManager = model.getProfileManager(); - ApplicationProfileManager.getInstance().fireProfileChanged(model); + InspectionProfileManager.getInstance().fireProfileChanged(model); } @Tag diff --git a/platform/analysis-impl/src/com/intellij/profile/ApplicationProfileManager.java b/platform/analysis-impl/src/com/intellij/profile/ApplicationProfileManager.java deleted file mode 100644 index 537354b2588b..000000000000 --- a/platform/analysis-impl/src/com/intellij/profile/ApplicationProfileManager.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.profile; - -import com.intellij.openapi.components.ServiceManager; -import com.intellij.profile.codeInspection.SeverityProvider; -import com.intellij.psi.search.scope.packageSet.NamedScope; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public interface ApplicationProfileManager extends ProfileManager, SeverityProvider { - String INSPECTION_DIR = "inspection"; - - @NotNull - static ApplicationProfileManager getInstance() { - return ServiceManager.getService(ApplicationProfileManager.class); - } - - @Deprecated - @SuppressWarnings("unused") - Profile createProfile(); - - @Deprecated - @SuppressWarnings("unused") - void addProfileChangeListener(@NotNull ProfileChangeAdapter listener); - - @Deprecated - @SuppressWarnings("unused") - void removeProfileChangeListener(@NotNull ProfileChangeAdapter listener); - - void fireProfileChanged(Profile profile); - - void fireProfileChanged(Profile oldProfile, Profile profile, @Nullable NamedScope scope); - - void setRootProfile(@Nullable String profileName); - - @SuppressWarnings("unused") - @NotNull - @Deprecated - default Profile getRootProfile() { - return getCurrentProfile(); - } - - void addProfile(@NotNull Profile profile); -} 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 ae17bb9c2911..918697282625 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java @@ -15,10 +15,46 @@ */ package com.intellij.profile.codeInspection; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.project.Project; +import com.intellij.profile.Profile; +import com.intellij.profile.ProfileChangeAdapter; +import com.intellij.profile.ProfileManager; +import com.intellij.psi.search.scope.packageSet.NamedScope; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public interface InspectionProfileManager extends ApplicationProfileManager { +public interface InspectionProfileManager extends ProfileManager, SeverityProvider { + String INSPECTION_DIR = "inspection"; + + @NotNull static InspectionProfileManager getInstance() { - return (InspectionProfileManager)ApplicationProfileManager.getInstance(); + return ServiceManager.getService(InspectionProfileManager.class); + } + + @NotNull + static InspectionProfileManager getInstance(@NotNull Project project) { + return InspectionProjectProfileManager.getInstance(project); + } + + @Deprecated + @SuppressWarnings("unused") + void addProfileChangeListener(@NotNull ProfileChangeAdapter listener); + + @Deprecated + @SuppressWarnings("unused") + void removeProfileChangeListener(@NotNull ProfileChangeAdapter listener); + + void fireProfileChanged(@NotNull Profile profile); + + void fireProfileChanged(@NotNull Profile oldProfile, Profile profile, @Nullable NamedScope scope); + + void setRootProfile(@Nullable String profileName); + + @SuppressWarnings("unused") + @NotNull + @Deprecated + default Profile getRootProfile() { + return getCurrentProfile(); } } \ No newline at end of file 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 52125915db30..14575cb3a94a 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java @@ -17,7 +17,6 @@ package com.intellij.profile.codeInspection; import com.intellij.codeInspection.InspectionProfile; import com.intellij.openapi.project.Project; -import com.intellij.profile.ProfileManager; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; @@ -25,7 +24,7 @@ import org.jetbrains.annotations.NotNull; * User: anna * Date: 30-Nov-2005 */ -public interface InspectionProjectProfileManager extends ProfileManager, SeverityProvider { +public interface InspectionProjectProfileManager extends InspectionProfileManager { static InspectionProjectProfileManager getInstance(@NotNull Project project){ return project.getComponent(InspectionProjectProfileManager.class); } diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt index 5f8c4b04fca4..33b690eef2ff 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt @@ -282,7 +282,7 @@ class ProjectInspectionProfileManagerImpl(val project: Project, val projectProfile: String? get() = state.projectProfile - @Synchronized fun setProjectProfile(newProfile: String?) { + @Synchronized override fun setRootProfile(newProfile: String?) { if (newProfile == state.projectProfile) { return } 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 9771ff1a19aa..9bf2aa673e11 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java @@ -29,9 +29,9 @@ import com.intellij.icons.AllIcons; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.options.ex.SingleConfigurableEditor; import com.intellij.openapi.project.Project; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.ProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.profile.codeInspection.ui.ErrorsConfigurable; @@ -114,7 +114,7 @@ public class CodeInspectionAction extends BaseAnalysisAction { } } }); - final ApplicationProfileManager profileManager = ApplicationProfileManager.getInstance(); + final InspectionProfileManager profileManager = InspectionProfileManager.getInstance(); final ProjectInspectionProfileManagerImpl projectProfileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project); reloadProfiles(profiles, profileManager, projectProfileManager, manager); panel.myBrowseProfilesCombo.addActionListener(new ActionListener() { @@ -186,7 +186,7 @@ public class CodeInspectionAction extends BaseAnalysisAction { private void reloadProfiles(JComboBox profiles, - ApplicationProfileManager inspectionProfileManager, + InspectionProfileManager inspectionProfileManager, InspectionProjectProfileManager inspectionProjectProfileManager, InspectionManagerEx inspectionManager) { final InspectionProfile selectedProfile = getGlobalInspectionContext(inspectionManager.getProject()).getCurrentProfile(); diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManagerImpl.java index 2d546ececd12..d4f93fbf4a34 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManagerImpl.java @@ -38,7 +38,6 @@ import com.intellij.openapi.options.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.codeInspection.*; import com.intellij.util.ArrayUtil; @@ -67,7 +66,7 @@ import static com.intellij.codeInspection.ex.InspectionProfileImpl.getDefaultPro @Storage("editor.xml"), @Storage(value = "other.xml", deprecated = true) }, - additionalExportFile = ApplicationProfileManager.INSPECTION_DIR + additionalExportFile = InspectionProfileManager.INSPECTION_DIR ) public class ApplicationInspectionProfileManagerImpl extends BaseInspectionProfileManager implements InspectionProfileManager, SeverityProvider, @@ -233,7 +232,6 @@ public class ApplicationInspectionProfileManagerImpl extends BaseInspectionProfi return new InspectionProfileConvertor(this); } - @Override public InspectionProfileImpl createProfile() { return createSampleProfile(InspectionProfileImpl.DEFAULT_PROFILE_NAME, getDefaultProfile()); } @@ -278,7 +276,6 @@ public class ApplicationInspectionProfileManagerImpl extends BaseInspectionProfi } } - @Override public void addProfile(@NotNull Profile profile) { mySchemeManager.addScheme((InspectionProfile)profile); } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeInspectionProfileAction.java b/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeInspectionProfileAction.java index 9adfc0701ecc..a0f895af9213 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeInspectionProfileAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/QuickChangeInspectionProfileAction.java @@ -44,7 +44,7 @@ public class QuickChangeInspectionProfileAction extends QuickSwitchSchemeAction group.add(new DumbAwareAction(scheme.getName(), "", scheme == current ? ourCurrentAction : ourNotCurrentAction) { @Override public void actionPerformed(@Nullable AnActionEvent e) { - projectProfileManager.setProjectProfile(scheme.getName()); + projectProfileManager.setRootProfile(scheme.getName()); } }); } diff --git a/platform/lang-impl/src/com/intellij/platform/PlatformInspectionProfileConfigurator.java b/platform/lang-impl/src/com/intellij/platform/PlatformInspectionProfileConfigurator.java index 9aea12f8d342..c54bd2f5f885 100644 --- a/platform/lang-impl/src/com/intellij/platform/PlatformInspectionProfileConfigurator.java +++ b/platform/lang-impl/src/com/intellij/platform/PlatformInspectionProfileConfigurator.java @@ -28,6 +28,6 @@ import org.jetbrains.annotations.NotNull; public class PlatformInspectionProfileConfigurator implements DirectoryProjectConfigurator { @Override public void configureProject(Project project, @NotNull VirtualFile baseDir, Ref moduleRef) { - ProjectInspectionProfileManagerImpl.getInstanceImpl(project).setProjectProfile(null); + ProjectInspectionProfileManagerImpl.getInstanceImpl(project).setRootProfile(null); } } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProfilesComboBox.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProfilesComboBox.java deleted file mode 100644 index a48e9645ee7c..000000000000 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProfilesComboBox.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.profile.codeInspection.ui; - -import com.intellij.codeInspection.InspectionsBundle; -import com.intellij.codeInspection.ModifiableModel; -import com.intellij.codeInspection.ex.InspectionProfileImpl; -import com.intellij.codeInspection.ex.InspectionToolRegistrar; -import com.intellij.icons.AllIcons; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.Condition; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; -import com.intellij.profile.Profile; -import com.intellij.profile.ProfileManager; -import com.intellij.profile.codeInspection.InspectionProfileManager; -import com.intellij.profile.codeInspection.InspectionProjectProfileManager; -import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.util.Set; - -/** - * User: anna - * Date: 30-May-2006 - */ -public class ProfilesComboBox extends JComboBox { - - public static final String USE_GLOBAL_PROFILE = InspectionsBundle.message("profile.project.settings.disable.text"); - private boolean myFrozenProfilesCombo; - - private Condition myUpdateCallback; - - - public void setUpdateCallback(final Condition updateCallback) { - myUpdateCallback = updateCallback; - } - - public void createProfilesCombo(final Profile selectedProfile, final Set availableProfiles, final ProfileManager profileManager) { - reloadProfiles(profileManager, availableProfiles, selectedProfile); - - setRenderer(new DefaultListCellRenderer() { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (value instanceof Profile) { - final Profile profile = (Profile)value; - setText(profile.getName()); - setIcon(profile.isProjectLevel() ? AllIcons.General.ProjectSettings : AllIcons.General.Settings); - } - else if (value instanceof String) { - setText((String)value); - } - return rendererComponent; - } - }); - addItemListener(new ItemListener() { - private Object myDeselectedItem = null; - - @Override - public void itemStateChanged(@NotNull ItemEvent e) { - if (myFrozenProfilesCombo) { - // do not update during reloading - return; - } - else if (ItemEvent.SELECTED == e.getStateChange()) { - final Object item = e.getItem(); - if (profileManager instanceof InspectionProjectProfileManager && item instanceof Profile && !((Profile)item).isProjectLevel()) { - if (Messages.showOkCancelDialog(InspectionsBundle.message("inspection.new.profile.ide.to.project.warning.message"), - InspectionsBundle.message("inspection.new.profile.ide.to.project.warning.title"), - Messages.getErrorIcon()) == Messages.OK) { - final String newName = Messages.showInputDialog(InspectionsBundle.message("inspection.new.profile.text"), - InspectionsBundle.message("inspection.new.profile.dialog.title"), - Messages.getInformationIcon()); - final Object selectedItem = getSelectedItem(); - if (!StringUtil.isEmpty(newName) && selectedItem instanceof Profile) { - if (ArrayUtil.find(profileManager.getAvailableProfileNames(), newName) == -1 && - ArrayUtil.find(InspectionProfileManager.getInstance().getAvailableProfileNames(), newName) == -1) { - saveNewProjectProfile(newName, (Profile)selectedItem, profileManager); - return; - } - else { - Messages.showErrorDialog(InspectionsBundle.message("inspection.unable.to.create.profile.message", newName), - InspectionsBundle.message("inspection.unable.to.create.profile.dialog.title")); - } - } - } - setSelectedItem(myDeselectedItem); - } - } - else { - myDeselectedItem = e.getItem(); - } - } - }); - } - - private void saveNewProjectProfile(final String newName, final Profile profile, ProfileManager profileManager) { - InspectionProfileImpl inspectionProfile = new InspectionProfileImpl(newName, InspectionToolRegistrar.getInstance(), profileManager); - final ModifiableModel profileModifiableModel = inspectionProfile.getModifiableModel(); - profileModifiableModel.copyFrom(profile); - profileModifiableModel.setProjectLevel(true); - profileModifiableModel.setName(newName); - ((DefaultComboBoxModel)getModel()).addElement(profileModifiableModel); - setSelectedItem(profileModifiableModel); - if (myUpdateCallback != null){ - myUpdateCallback.value(profileModifiableModel); - } - } - - - public void reloadProfiles(final ProfileManager profileManager, final Set availableProfiles, final Profile selectedProfile) { - reloadProfiles(profileManager, true, availableProfiles, selectedProfile); - } - - - public void reloadProfiles(final ProfileManager profileManager, final boolean noneItemAppearance, final Set availableProfiles, final Profile selectedProfile) { - myFrozenProfilesCombo = true; - Object oldSelection = getSelectedItem(); - final DefaultComboBoxModel model = (DefaultComboBoxModel)getModel(); - model.removeAllElements(); - if (noneItemAppearance && profileManager instanceof InspectionProjectProfileManager) { - model.addElement(USE_GLOBAL_PROFILE); - } - for (Profile profile : availableProfiles) { - model.addElement(profile); - } - if (selectedProfile != null && ((!selectedProfile.isProjectLevel() && profileManager instanceof ApplicationProfileManager) || - (selectedProfile.isProjectLevel() && profileManager instanceof InspectionProjectProfileManager))) { - setSelectedItem(selectedProfile); - } - else { - final int index = model.getIndexOf(oldSelection); - if (index != -1) { - setSelectedIndex(index); - } - else if (model.getSize() > 0) { - setSelectedIndex(0); - } - } - myFrozenProfilesCombo = false; - } -} diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProjectInspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProjectInspectionToolsConfigurable.java index cd269b2f859a..9dd138743bd4 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProjectInspectionToolsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ProjectInspectionToolsConfigurable.java @@ -39,11 +39,11 @@ public class ProjectInspectionToolsConfigurable extends InspectionToolsConfigura @Override protected void applyRootProfile(@NotNull String name, boolean isProjectLevel) { if (isProjectLevel) { - myProjectProfileManager.setProjectProfile(name); + myProjectProfileManager.setRootProfile(name); } else { myApplicationProfileManager.setRootProfile(name); - myProjectProfileManager.setProjectProfile(null); + myProjectProfileManager.setRootProfile(null); } ApplicationInspectionProfileManagerImpl.onProfilesChanged(); } 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 46e520336b90..a8a3f0566bba 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 @@ -45,7 +45,6 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.ProfileManager; import com.intellij.profile.codeInspection.InspectionProfileManager; @@ -150,11 +149,11 @@ public class SingleInspectionProfilePanel extends JPanel { } private static VisibleTreeState getExpandedNodes(InspectionProfileImpl profile) { - if (profile.getProfileManager() instanceof ApplicationProfileManager) { - return AppInspectionProfilesVisibleTreeState.getInstance().getVisibleTreeState(profile); + if (profile.isProjectLevel()) { + return ProjectInspectionProfilesVisibleTreeState.getInstance(((ProjectInspectionProfileManagerImpl)profile.getProfileManager()).getProject()).getVisibleTreeState(profile); } else { - return ProjectInspectionProfilesVisibleTreeState.getInstance(((ProjectInspectionProfileManagerImpl)profile.getProfileManager()).getProject()).getVisibleTreeState(profile); + return AppInspectionProfilesVisibleTreeState.getInstance().getVisibleTreeState(profile); } } 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 c02afddca752..a74b5ef17ad8 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 @@ -46,9 +46,9 @@ 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.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.ProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.profile.codeInspection.ui.ErrorsConfigurable; import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel; @@ -79,7 +79,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable private static final Logger LOG = Logger.getInstance(InspectionToolsConfigurable.class); private static final String COPY_SUFFIX = "copy"; - protected final ApplicationProfileManager myApplicationProfileManager; + protected final InspectionProfileManager myApplicationProfileManager; protected final ProjectInspectionProfileManagerImpl myProjectProfileManager; private final CardLayout myLayout = new CardLayout(); private final Map myPanels = @@ -92,7 +92,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable public InspectionToolsConfigurable(@NotNull ProjectInspectionProfileManagerImpl projectProfileManager) { myProjectProfileManager = projectProfileManager; - myApplicationProfileManager = ApplicationProfileManager.getInstance(); + myApplicationProfileManager = InspectionProfileManager.getInstance(); } private static JComponent withBorderOnTop(final JComponent component) { @@ -441,7 +441,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable } public static InspectionProfileImpl importInspectionProfile(@NotNull Element rootElement, - @NotNull ApplicationProfileManager profileManager, + @NotNull InspectionProfileManager profileManager, @NotNull Project project, @Nullable JPanel anchorPanel) throws JDOMException, IOException, InvalidDataException { diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java index bb0ea6090f13..42373bd2d800 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java @@ -77,7 +77,7 @@ import com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl; import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl; import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; @@ -453,7 +453,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da lookupManager.hideActiveLookup(); } ((StartupManagerImpl)StartupManager.getInstance(project)).prepareForNextTest(); - ApplicationProfileManager.getInstance().deleteProfile(PROFILE); + InspectionProfileManager.getInstance().deleteProfile(PROFILE); if (ProjectManager.getInstance() == null) { exceptions.add(new AssertionError("Application components damaged")); } 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 1206d8b683e0..eb705f1b2415 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -84,7 +84,6 @@ import com.intellij.openapi.util.*; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.*; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; @@ -202,7 +201,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig final InspectionProfileImpl profile = InspectionProfileImpl.createSimple(LightPlatformTestCase.PROFILE, project, wrapped); profile.disableToolByDefault(new ArrayList(disabledInspections), project); - final ApplicationProfileManager inspectionProfileManager = ApplicationProfileManager.getInstance(); + final ApplicationInspectionProfileManagerImpl inspectionProfileManager = ApplicationInspectionProfileManagerImpl.getInstanceImpl(); final Profile oldRootProfile = inspectionProfileManager.getCurrentProfile(); inspectionProfileManager.addProfile(profile); Disposer.register(parentDisposable, new Disposable() { @@ -216,7 +215,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig inspectionProfileManager.setRootProfile(profile.getName()); InspectionProfileImpl.initAndDo((Computable)() -> { InspectionProjectProfileManager.getInstance(project).updateProfile(profile); - ProjectInspectionProfileManagerImpl.getInstanceImpl(project).setProjectProfile(profile.getName()); + ProjectInspectionProfileManagerImpl.getInstanceImpl(project).setRootProfile(profile.getName()); return null; }); } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java index a222dc848a8d..347ea8484558 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java @@ -19,7 +19,7 @@ import com.intellij.codeInspection.*; import com.intellij.codeInspection.ui.ListEditForm; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.PsiAnnotation; import com.intellij.psi.PsiComment; @@ -109,7 +109,7 @@ public class SuppressionAnnotationInspection extends SuppressionAnnotationInspec private void saveProfile(Project project) { final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); - ApplicationProfileManager.getInstance().fireProfileChanged(inspectionProfile); + InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile); } @NotNull diff --git a/plugins/testng/src/com/theoryinpractice/testng/inspection/DependsOnGroupsInspection.java b/plugins/testng/src/com/theoryinpractice/testng/inspection/DependsOnGroupsInspection.java index 450981cef59f..3727a250d8a3 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/inspection/DependsOnGroupsInspection.java +++ b/plugins/testng/src/com/theoryinpractice/testng/inspection/DependsOnGroupsInspection.java @@ -21,7 +21,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.LabeledComponent; import com.intellij.openapi.util.JDOMExternalizableStringList; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; import com.intellij.ui.DocumentAdapter; @@ -165,7 +165,7 @@ public class DependsOnGroupsInspection extends BaseJavaLocalInspectionTool { final InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); //correct save settings - ApplicationProfileManager.getInstance().fireProfileChanged(inspectionProfile); + InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile); //TODO lesya /* try { diff --git a/python/python-rest/src/com/jetbrains/rest/quickfixes/AddIgnoredRoleFix.java b/python/python-rest/src/com/jetbrains/rest/quickfixes/AddIgnoredRoleFix.java index 2248ba450551..a2ae18f44195 100644 --- a/python/python-rest/src/com/jetbrains/rest/quickfixes/AddIgnoredRoleFix.java +++ b/python/python-rest/src/com/jetbrains/rest/quickfixes/AddIgnoredRoleFix.java @@ -20,7 +20,7 @@ import com.intellij.codeInspection.InspectionProfile; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.openapi.project.Project; -import com.intellij.profile.ApplicationProfileManager; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.jetbrains.rest.RestBundle; import com.jetbrains.rest.inspections.RestRoleInspection; @@ -55,7 +55,7 @@ public class AddIgnoredRoleFix implements LocalQuickFix, LowPriorityAction { if (!myInspection.ignoredRoles.contains(myRole)) { myInspection.ignoredRoles.add(myRole); final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); - ApplicationProfileManager.getInstance().fireProfileChanged(profile); + InspectionProfileManager.getInstance().fireProfileChanged(profile); } } } diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java index 3b160314f3a0..1bd43cc1ab42 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationsManagerImpl.java @@ -27,9 +27,9 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Key; -import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.Profile; import com.intellij.profile.ProfileChangeAdapter; +import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.util.CachedValue; import com.intellij.psi.util.CachedValueProvider; @@ -121,7 +121,7 @@ public class DomElementAnnotationsManagerImpl extends DomElementAnnotationsManag } }; - ApplicationProfileManager.getInstance().addProfileChangeListener(profileChangeAdapter, project); + InspectionProfileManager.getInstance().addProfileChangeListener(profileChangeAdapter, project); } @Override