use of com.intellij.profile.codeInspection.BaseInspectionProfileManager in project intellij-community by JetBrains.
the class SingleInspectionProfilePanel method apply.
public void apply() {
final boolean modified = isModified();
if (!modified) {
return;
}
InspectionProfileModifiableModel selectedProfile = myProfile;
BaseInspectionProfileManager profileManager = selectedProfile.isProjectLevel() ? myProjectProfileManager : (BaseInspectionProfileManager) InspectionProfileManager.getInstance();
InspectionProfileImpl source = selectedProfile.getSource();
if (source.getProfileManager() != profileManager) {
source.getProfileManager().deleteProfile(source);
}
if (selectedProfile.getProfileManager() != profileManager) {
copyUsedSeveritiesIfUndefined(selectedProfile, profileManager);
selectedProfile.setProfileManager(profileManager);
}
selectedProfile.commit();
profileManager.addProfile(source);
profileManager.fireProfileChanged(source);
myModified = false;
myRoot.dropCache();
initToolStates();
updateOptionsAndDescriptionPanel();
}
use of com.intellij.profile.codeInspection.BaseInspectionProfileManager in project intellij-community by JetBrains.
the class InspectionProfileTest method testSameNameSharedProfile.
public void testSameNameSharedProfile() throws Exception {
BaseInspectionProfileManager profileManager = getApplicationProfileManager();
InspectionProfileImpl localProfile = createProfile();
updateProfile(profileManager, localProfile);
ProjectInspectionProfileManager projectProfileManager = ProjectInspectionProfileManager.getInstance(getProject());
try {
//normally on open project profile wrappers are init for both managers
updateProfile(profileManager, localProfile);
InspectionProfileImpl profile = new InspectionProfileImpl(PROFILE, InspectionToolRegistrar.getInstance(), projectProfileManager, null);
updateProfile(projectProfileManager, profile);
projectProfileManager.setRootProfile(profile.getName());
assertTrue(projectProfileManager.getCurrentProfile() == profile);
} finally {
projectProfileManager.deleteProfile(PROFILE);
}
}
use of com.intellij.profile.codeInspection.BaseInspectionProfileManager in project intellij-community by JetBrains.
the class InspectionProfileSchemesPanel method copyToNewProfile.
@NotNull
private InspectionProfileModifiableModel copyToNewProfile(@NotNull InspectionProfileImpl selectedProfile, @NotNull Project project, @NotNull String newName, boolean modifyLevel) {
final boolean isProjectLevel = selectedProfile.isProjectLevel() ^ modifyLevel;
BaseInspectionProfileManager profileManager = isProjectLevel ? myProjectProfileManager : myAppProfileManager;
InspectionProfileImpl inspectionProfile = new InspectionProfileImpl(newName, InspectionToolRegistrar.getInstance(), profileManager);
inspectionProfile.copyFrom(selectedProfile);
inspectionProfile.setName(newName);
inspectionProfile.initInspectionTools(project);
inspectionProfile.setProjectLevel(isProjectLevel);
InspectionProfileModifiableModel modifiableModel = new InspectionProfileModifiableModel(inspectionProfile);
modifiableModel.setModified(true);
return modifiableModel;
}
Aggregations