mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove getProject from InspectionProjectProfileManager
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
+2
-2
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
+2
-3
@@ -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 { ArrayList<caret>XXX x;}";
|
||||
configureByText(StdFileTypes.JAVA, text);
|
||||
|
||||
+4
-3
@@ -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);
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+2
-2
@@ -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<HighlightSeverity> {
|
||||
@NotNull
|
||||
public static SeverityRegistrar getSeverityRegistrar(@Nullable Project project) {
|
||||
return project == null
|
||||
? InspectionProfileManager.getInstance().getSeverityRegistrar()
|
||||
? ApplicationProfileManager.getInstance().getSeverityRegistrar()
|
||||
: InspectionProjectProfileManager.getInstance(project).getSeverityRegistrar();
|
||||
}
|
||||
|
||||
|
||||
-5
@@ -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();
|
||||
}
|
||||
|
||||
+2
-4
@@ -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)
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
+2
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user