Search in sources :

Example 1 with BaseInspectionProfileManager

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();
}
Also used : BaseInspectionProfileManager(com.intellij.profile.codeInspection.BaseInspectionProfileManager)

Example 2 with BaseInspectionProfileManager

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);
    }
}
Also used : BaseInspectionProfileManager(com.intellij.profile.codeInspection.BaseInspectionProfileManager) ProjectInspectionProfileManager(com.intellij.profile.codeInspection.ProjectInspectionProfileManager)

Example 3 with BaseInspectionProfileManager

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;
}
Also used : BaseInspectionProfileManager(com.intellij.profile.codeInspection.BaseInspectionProfileManager) InspectionProfileImpl(com.intellij.codeInspection.ex.InspectionProfileImpl) InspectionProfileModifiableModel(com.intellij.codeInspection.ex.InspectionProfileModifiableModel) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BaseInspectionProfileManager (com.intellij.profile.codeInspection.BaseInspectionProfileManager)3 InspectionProfileImpl (com.intellij.codeInspection.ex.InspectionProfileImpl)1 InspectionProfileModifiableModel (com.intellij.codeInspection.ex.InspectionProfileModifiableModel)1 ProjectInspectionProfileManager (com.intellij.profile.codeInspection.ProjectInspectionProfileManager)1 NotNull (org.jetbrains.annotations.NotNull)1