mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
getDefaultProfile -> getBaseProfile
It is not default — it is base. Do not add default default profile if there is at least on bundled/custom global profile — as before.
This commit is contained in:
@@ -82,7 +82,7 @@ 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(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getBaseProfile(), null);
|
||||
}
|
||||
private static InspectionProfileImpl createProfile(@NotNull InspectionProfileImpl base) {
|
||||
return new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), base, null);
|
||||
@@ -98,7 +98,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
|
||||
//normally on open project profile wrappers are init for both managers
|
||||
profileManager.updateProfile(localProfile);
|
||||
InspectionProfileImpl profile = new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), projectProfileManager,
|
||||
InspectionProfileImpl.getDefaultProfile(), null);
|
||||
InspectionProfileImpl.getBaseProfile(), null);
|
||||
projectProfileManager.updateProfile(profile);
|
||||
projectProfileManager.setRootProfile(profile.getName());
|
||||
|
||||
@@ -579,7 +579,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
|
||||
}
|
||||
|
||||
public void testDoNotInstantiateOnSave() throws Exception {
|
||||
InspectionProfileImpl profile = new InspectionProfileImpl("profile", InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getDefaultProfile(), null);
|
||||
InspectionProfileImpl profile = new InspectionProfileImpl("profile", InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), InspectionProfileImpl.getBaseProfile(), null);
|
||||
assertEquals(0, countInitializedTools(profile));
|
||||
InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
|
||||
assertTrue(toolWrappers.length > 0);
|
||||
|
||||
@@ -51,7 +51,7 @@ class InspectionSchemeTest {
|
||||
profileManager.forceInitProfiles(true)
|
||||
profileManager.initProfiles()
|
||||
|
||||
assertThat(profileManager.profiles).hasSize(2)
|
||||
assertThat(profileManager.profiles).hasSize(1)
|
||||
val scheme = profileManager.profiles.first() as InspectionProfileImpl
|
||||
assertThat(scheme.name).isEqualTo("Bar")
|
||||
|
||||
@@ -61,5 +61,11 @@ class InspectionSchemeTest {
|
||||
|
||||
assertThat(schemeFile.readText()).isEqualTo(schemeData)
|
||||
profileManager.profiles
|
||||
|
||||
schemeManagerFactory.process {
|
||||
it.reload()
|
||||
}
|
||||
|
||||
assertThat(profileManager.profiles).hasSize(1)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -101,7 +101,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
|
||||
public InspectionProfileImpl(@NotNull String profileName,
|
||||
@NotNull InspectionToolRegistrar registrar,
|
||||
@NotNull ProfileManager profileManager) {
|
||||
this(profileName, registrar, profileManager, getDefaultProfile(), null);
|
||||
this(profileName, registrar, profileManager, getBaseProfile(), null);
|
||||
}
|
||||
|
||||
public InspectionProfileImpl(@NotNull @NonNls String profileName) {
|
||||
@@ -125,7 +125,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
|
||||
@NotNull InspectionToolRegistrar registrar,
|
||||
@NotNull ProfileManager profileManager,
|
||||
@Nullable SchemeDataHolder<? super InspectionProfileImpl> dataHolder) {
|
||||
this(profileName, registrar, profileManager, getDefaultProfile(), dataHolder);
|
||||
this(profileName, registrar, profileManager, getBaseProfile(), dataHolder);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -163,7 +163,7 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel,
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static InspectionProfileImpl getDefaultProfile() {
|
||||
public static InspectionProfileImpl getBaseProfile() {
|
||||
return InspectionProfileImplHolder.DEFAULT_PROFILE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -98,7 +98,7 @@ class ProjectInspectionProfileManager(val project: Project,
|
||||
attributeProvider: Function<String, String?>,
|
||||
isBundled: Boolean): InspectionProfileImpl {
|
||||
val profile = InspectionProfileImpl(name, InspectionToolRegistrar.getInstance(), this@ProjectInspectionProfileManager,
|
||||
InspectionProfileImpl.getDefaultProfile(), dataHolder)
|
||||
InspectionProfileImpl.getBaseProfile(), dataHolder)
|
||||
profile.isProjectLevel = true
|
||||
return profile
|
||||
}
|
||||
@@ -306,7 +306,7 @@ class ProjectInspectionProfileManager(val project: Project,
|
||||
currentScheme = schemeManager.allSchemes.firstOrNull()
|
||||
if (currentScheme == null) {
|
||||
currentScheme = InspectionProfileImpl(PROJECT_DEFAULT_PROFILE_NAME, InspectionToolRegistrar.getInstance(), this,
|
||||
InspectionProfileImpl.getDefaultProfile(), null)
|
||||
InspectionProfileImpl.getBaseProfile(), null)
|
||||
currentScheme.copyFrom(applicationProfileManager.currentProfile as ProfileEx)
|
||||
currentScheme.isProjectLevel = true
|
||||
currentScheme.name = PROJECT_DEFAULT_PROFILE_NAME
|
||||
|
||||
+3
-15
@@ -60,8 +60,6 @@ import java.util.Collections;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.intellij.codeInspection.ex.InspectionProfileImpl.getDefaultProfile;
|
||||
|
||||
@State(
|
||||
name = "InspectionProfileManager",
|
||||
storages = {
|
||||
@@ -92,7 +90,7 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
|
||||
mySchemeManager = schemeManagerFactory.create(INSPECTION_DIR, new InspectionProfileProcessor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName(@NotNull Function<String, String> attributeProvider, String fileNameWithoutExtension) {
|
||||
public String getName(@NotNull Function<String, String> attributeProvider, @NotNull String fileNameWithoutExtension) {
|
||||
return fileNameWithoutExtension;
|
||||
}
|
||||
|
||||
@@ -170,13 +168,9 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
|
||||
|
||||
loadBundledSchemes();
|
||||
mySchemeManager.loadSchemes();
|
||||
createDefaultProfile();
|
||||
}
|
||||
|
||||
private void createDefaultProfile() {
|
||||
final InspectionProfileImpl oldDefault = mySchemeManager.findSchemeByName(InspectionProfileImpl.DEFAULT_PROFILE_NAME);
|
||||
if (oldDefault == null || !oldDefault.isProfileLocked()) {
|
||||
getSchemeManager().addScheme(createSampleProfile(InspectionProfileImpl.DEFAULT_PROFILE_NAME, getDefaultProfile()));
|
||||
if (mySchemeManager.isEmpty()) {
|
||||
mySchemeManager.addScheme(createSampleProfile(InspectionProfileImpl.DEFAULT_PROFILE_NAME, InspectionProfileImpl.getBaseProfile()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,12 +233,6 @@ public class ApplicationInspectionProfileManager extends BaseInspectionProfileMa
|
||||
return new InspectionProfileConvertor(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Deprecated
|
||||
public InspectionProfileImpl createProfile() {
|
||||
return createSampleProfile(InspectionProfileImpl.DEFAULT_PROFILE_NAME, getDefaultProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRootProfile(@Nullable String profileName) {
|
||||
mySchemeManager.setCurrentSchemeName(profileName);
|
||||
|
||||
@@ -40,7 +40,7 @@ fun configureInspections(tools: Array<InspectionProfileEntry>,
|
||||
Disposer.register(parentDisposable, Disposable {
|
||||
profileManager.deleteProfile(profile)
|
||||
profileManager.setCurrentProfile(null)
|
||||
clearAllToolsIn(InspectionProfileImpl.getDefaultProfile())
|
||||
clearAllToolsIn(InspectionProfileImpl.getBaseProfile())
|
||||
})
|
||||
|
||||
profileManager.addProfile(profile)
|
||||
|
||||
Reference in New Issue
Block a user