Search in sources :

Example 1 with ValidatorMutable

use of org.eclipse.wst.validation.internal.ValidatorMutable in project sling by apache.

the class SightlyFacetInstallDelegate method execute.

@Override
public void execute(IProject project, IProjectFacetVersion version, Object config, IProgressMonitor monitor) throws CoreException {
    Logger logger = Activator.getDefault().getLogger();
    Validator[] validators = ValManager.getDefault().getValidators(project);
    ValidatorMutable[] mutis = new ValidatorMutable[validators.length];
    for (int i = 0; i < validators.length; i++) {
        mutis[i] = new ValidatorMutable(validators[i]);
    }
    boolean changed = false;
    for (ValidatorMutable validator : mutis) {
        if (HTML_VALIDATOR_ID.equals(validator.getId())) {
            if (validator.isManualValidation() || validator.isBuildValidation()) {
                validator.setBuildValidation(false);
                validator.setManualValidation(false);
                changed = true;
                logger.trace("Disabled {0} for project {1}", validator, project.getName());
                break;
            }
        }
    }
    ProjectPreferences projectPreferences = ValManager.getDefault().getProjectPreferences(project);
    if (!projectPreferences.getOverride()) {
        projectPreferences = new ProjectPreferences(project, true, projectPreferences.getSuspend(), null);
    }
    if (changed || !projectPreferences.getOverride()) {
        ValPrefManagerProject prefManager = new ValPrefManagerProject(project);
        prefManager.savePreferences(projectPreferences, mutis);
    }
}
Also used : ValidatorMutable(org.eclipse.wst.validation.internal.ValidatorMutable) ProjectPreferences(org.eclipse.wst.validation.internal.model.ProjectPreferences) Logger(org.apache.sling.ide.log.Logger) ValPrefManagerProject(org.eclipse.wst.validation.internal.ValPrefManagerProject) Validator(org.eclipse.wst.validation.Validator)

Aggregations

Logger (org.apache.sling.ide.log.Logger)1 Validator (org.eclipse.wst.validation.Validator)1 ValPrefManagerProject (org.eclipse.wst.validation.internal.ValPrefManagerProject)1 ValidatorMutable (org.eclipse.wst.validation.internal.ValidatorMutable)1 ProjectPreferences (org.eclipse.wst.validation.internal.model.ProjectPreferences)1