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 9d23670141dd..f9696573b6fc 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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; 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; - InspectionProfileManager.getInstance().fireProfileChanged(null); + ApplicationProfileManager.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 dff7bdb91b7d..15290186a224 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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; 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 - InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile); + ApplicationProfileManager.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 19483d3ba301..e4243a1a19f8 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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; 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(); - InspectionProfileManager.getInstance().fireProfileChanged(profile); + ApplicationProfileManager.getInstance().fireProfileChanged(profile); } @Override diff --git a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavadocHtmlLintAnnotator.kt b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavadocHtmlLintAnnotator.kt index 1f3a138fea47..3252c3e6e8b9 100644 --- a/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavadocHtmlLintAnnotator.kt +++ b/java/java-impl/src/com/intellij/codeInspection/javaDoc/JavadocHtmlLintAnnotator.kt @@ -118,7 +118,7 @@ class JavadocHtmlLintAnnotator(private val manual: Boolean = false) : file.virtualFile != null && ProjectFileIndex.SERVICE.getInstance(file.project).isInSourceContent(file.virtualFile) private fun isToolEnabled(file: PsiFile) = - manual || InspectionProjectProfileManager.getInstance(file.project).inspectionProfile.isToolEnabled(key.value, file) + manual || InspectionProjectProfileManager.getInstance(file.project).currentProfile.isToolEnabled(key.value, file) private fun createTempFile(bytes: ByteArray): File { val tempFile = FileUtil.createTempFile(File(PathManager.getTempPath()), "javadocHtmlLint", ".java") 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 72833e69965d..a2db867a8d36 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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; import com.intellij.psi.impl.DebugUtil; @@ -1199,8 +1199,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase { public void testDaemonIgnoresFrameDeactivation() throws Throwable { DaemonCodeAnalyzerSettings.getInstance().setImportHintEnabled(true); // return default value to avoid unnecessary save - final InspectionProfileManager inspectionProfileManager = InspectionProfileManager.getInstance(); - inspectionProfileManager.setRootProfile(InspectionProfileImpl.getDefaultProfile().getName()); // reset to default profile from the custom one to avoid unnecessary save + ApplicationProfileManager.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/SingleInspectionProfilePanelTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.java index f1ebda035c50..5cee91173548 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/SingleInspectionProfilePanelTest.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. @@ -22,6 +22,7 @@ import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel; import com.intellij.testFramework.LightIdeaTestCase; import org.jetbrains.annotations.NotNull; @@ -34,7 +35,7 @@ public class SingleInspectionProfilePanelTest extends LightIdeaTestCase { // see IDEA-85700 public void testSettingsModification() throws Exception { Project project = ProjectManager.getInstance().getDefaultProject(); - InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project); + ProjectInspectionProfileManagerImpl profileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project); InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE); profile.initInspectionTools(project); @@ -56,7 +57,7 @@ public class SingleInspectionProfilePanelTest extends LightIdeaTestCase { public void testModifyInstantiatedTool() throws Exception { Project project = ProjectManager.getInstance().getDefaultProject(); - InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project); + ProjectInspectionProfileManagerImpl profileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project); InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getProfile(PROFILE); profile.initInspectionTools(project); 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 48dc90fe23f3..eac77fa7de28 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java @@ -25,6 +25,7 @@ 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; @@ -81,10 +82,10 @@ public class InspectionProfileTest extends LightIdeaTestCase { } private static InspectionProfileImpl createProfile() { - return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile(), null); + return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), ApplicationProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile(), null); } private static InspectionProfileImpl createProfile(@NotNull InspectionProfileImpl base) { - return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), base, null); + return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), ApplicationProfileManager.getInstance(), base, null); } public void testSameNameSharedProfile() throws Exception { 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 8d7cf622ce43..cb038292f76e 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,7 +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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.util.IncorrectOperationException; import com.intellij.util.concurrency.AtomicFieldUpdater; @@ -82,7 +82,7 @@ public class SeverityRegistrar implements Comparator { @NotNull public static SeverityRegistrar getSeverityRegistrar(@Nullable Project project) { return project == null - ? InspectionProfileManager.getInstance().getSeverityRegistrar() + ? ApplicationProfileManager.getInstance().getSeverityRegistrar() : InspectionProjectProfileManager.getInstance(project).getSeverityRegistrar(); } 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 a82d1a6ce444..52125915db30 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProjectProfileManager.java @@ -30,9 +30,6 @@ public interface InspectionProjectProfileManager extends ProfileManager, Severit return project.getComponent(InspectionProjectProfileManager.class); } - @NotNull - Project getProject(); - @NotNull @Deprecated default InspectionProfile getInspectionProfile() { @@ -47,6 +44,4 @@ public interface InspectionProjectProfileManager extends ProfileManager, Severit default InspectionProfile getInspectionProfile(PsiElement element){ return getCurrentProfile(); } - - boolean isProfileLoaded(); } 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 78bad5d22f29..5f8c4b04fca4 100644 --- a/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt +++ b/platform/analysis-impl/src/com/intellij/profile/codeInspection/ProjectInspectionProfileManagerImpl.kt @@ -57,7 +57,7 @@ private const val NAME = "name" private const val PROJECT_DEFAULT_PROFILE_NAME = "Project Default" @State(name = "InspectionProjectProfileManager", storages = arrayOf(Storage("inspectionProfiles/profiles_settings"))) -class ProjectInspectionProfileManagerImpl(private val project: Project, +class ProjectInspectionProfileManagerImpl(val project: Project, private val applicationProfileManager: InspectionProfileManager, private val scopeManager: DependencyValidationManager, private val localScopesHolder: NamedScopeManager, @@ -120,9 +120,7 @@ class ProjectInspectionProfileManagerImpl(private val project: Project, var useProjectProfile = true } - override fun getProject() = project - - override fun isProfileLoaded(): Boolean { + fun isProfileLoaded(): Boolean { val profile = currentProfile val name = profile.name return if (profile.profileManager === this) nameToProfile.containsKey(name) else appNameToProfile.containsKey(name) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPassFactory.java index 7ad937c7c934..2ee2d7fc6f2a 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPassFactory.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPassFactory.java @@ -28,7 +28,7 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; -import com.intellij.profile.codeInspection.InspectionProjectProfileManager; +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.ArrayUtil; @@ -60,7 +60,7 @@ public class LocalInspectionsPassFactory extends AbstractProjectComponent implem @Nullable public TextEditorHighlightingPass createHighlightingPass(@NotNull PsiFile file, @NotNull final Editor editor) { TextRange textRange = calculateRangeToProcess(editor); - if (textRange == null || !InspectionProjectProfileManager.getInstance(file.getProject()).isProfileLoaded()){ + if (textRange == null || !ProjectInspectionProfileManagerImpl.getInstanceImpl(file.getProject()).isProfileLoaded()){ return new ProgressableTextEditorHighlightingPass.EmptyPass(myProject, editor.getDocument()); } TextRange visibleRange = VisibleHighlightingPassFactory.calculateVisibleRange(editor); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java index 807be3c189f8..876607e612a1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/WholeFileLocalInspectionsPassFactory.java @@ -32,6 +32,7 @@ import com.intellij.openapi.util.Disposer; import com.intellij.profile.Profile; import com.intellij.profile.ProfileChangeAdapter; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; @@ -92,7 +93,7 @@ public class WholeFileLocalInspectionsPassFactory extends AbstractProjectCompone return null; //optimization } - if (!InspectionProjectProfileManager.getInstance(file.getProject()).isProfileLoaded() || + if (!ProjectInspectionProfileManagerImpl.getInstanceImpl(file.getProject()).isProfileLoaded() || myFileToolsCache.containsKey(file) && !myFileToolsCache.get(file)) { return null; } 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 cba45fb0bcbd..46e520336b90 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 @@ -49,7 +49,7 @@ 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.SeverityProvider; import com.intellij.profile.codeInspection.ui.filter.InspectionFilterAction; import com.intellij.profile.codeInspection.ui.filter.InspectionsFilter; @@ -108,7 +108,7 @@ public class SingleInspectionProfilePanel extends JPanel { private final InspectionConfigTreeNode myRoot = new InspectionConfigTreeNode(InspectionsBundle.message("inspection.root.node.title")); private final Alarm myAlarm = new Alarm(); - private final InspectionProjectProfileManager myProjectProfileManager; + private final ProjectInspectionProfileManagerImpl myProjectProfileManager; @NotNull private Profile myOriginal; private InspectionProfileImpl mySelectedProfile; private JEditorPane myBrowser; @@ -137,7 +137,7 @@ public class SingleInspectionProfilePanel extends JPanel { public void dispose() {} }; - public SingleInspectionProfilePanel(@NotNull InspectionProjectProfileManager projectProfileManager, + public SingleInspectionProfilePanel(@NotNull ProjectInspectionProfileManagerImpl projectProfileManager, @NotNull String inspectionProfileName, @NotNull ModifiableModel profile, @NotNull Profile original) { @@ -154,7 +154,7 @@ public class SingleInspectionProfilePanel extends JPanel { return AppInspectionProfilesVisibleTreeState.getInstance().getVisibleTreeState(profile); } else { - return ProjectInspectionProfilesVisibleTreeState.getInstance(((InspectionProjectProfileManager)profile.getProfileManager()).getProject()).getVisibleTreeState(profile); + return ProjectInspectionProfilesVisibleTreeState.getInstance(((ProjectInspectionProfileManagerImpl)profile.getProfileManager()).getProject()).getVisibleTreeState(profile); } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/maturity/SuppressionAnnotationInspection.java index 347ea8484558..a222dc848a8d 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.codeInspection.InspectionProfileManager; +import com.intellij.profile.ApplicationProfileManager; 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(); - InspectionProfileManager.getInstance().fireProfileChanged(inspectionProfile); + ApplicationProfileManager.getInstance().fireProfileChanged(inspectionProfile); } @NotNull 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 7dc382d6db5c..3b160314f3a0 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,8 +121,7 @@ public class DomElementAnnotationsManagerImpl extends DomElementAnnotationsManag } }; - final InspectionProfileManager inspectionProfileManager = InspectionProfileManager.getInstance(); - inspectionProfileManager.addProfileChangeListener(profileChangeAdapter, project); + ApplicationProfileManager.getInstance().addProfileChangeListener(profileChangeAdapter, project); } @Override