/** * Return all validators for this preference; either every installed validator (global) or every * validator configured on the project (project). */ public ValidatorMetaData[] getValidators() throws InvocationTargetException { return convertToArray(_validators.keySet()); }
protected void copyTo(ValidationConfiguration up) throws InvocationTargetException { up.setVersion(getVersion()); up.setResource(getResource()); up.setValidators(getValidators()); up.setDisableAllValidation(isDisableAllValidation()); up.setEnabledValidators(getEnabledValidators()); up.setEnabledManualValidators(getManualEnabledValidators()); up.setEnabledBuildValidators(getBuildEnabledValidators()); up.setDelegatingValidators(getDelegatingValidators()); }
public void setEnabledBuildValidators(ValidatorMetaData[] vmds) throws InvocationTargetException { List buildEnabledVMDList = Arrays.asList(vmds); List allValidators = Arrays.asList(getValidators()); for(int i = 0; i < allValidators.size(); i++) { ValidatorMetaData data = (ValidatorMetaData) allValidators.get(i); if(buildEnabledVMDList.contains(data)) getBuildEnabledValidatorsMap().put(data, new Boolean(true)); else getBuildEnabledValidatorsMap().put(data, new Boolean(false)); } }
protected String serializeBuildSetting() throws InvocationTargetException { StringBuffer buffer = new StringBuffer(); buffer.append(ConfigurationConstants.ENABLED_BUILD_VALIDATORS); buffer.append(getEnabledElementsAsString(getBuildEnabledValidators())); return buffer.toString(); }
/** * @param prefs * @throws InvocationTargetException */ private void deserializeAllPrefs(Preferences prefs) throws InvocationTargetException { String storedConfig = prefs.getString(USER_PREFERENCE); deserialize(storedConfig); String storedManualConfig = prefs.getString(USER_MANUAL_PREFERENCE); deserializeManual(storedManualConfig); String storedBuildConfig = prefs.getString(USER_BUILD_PREFERENCE); deserializeBuild(storedBuildConfig); String storedDelegatesConfiguration = prefs.getString(DELEGATES_PREFERENCE); deserializeDelegates(storedDelegatesConfiguration); }
public ValidatorMetaData[] getEnabledFullBuildValidators(boolean fullBuild, boolean onlyReferenced) throws InvocationTargetException { int count = 0; ValidatorMetaData[] result = null; if( !isDisableAllValidation() ){ ValidatorMetaData[] temp = new ValidatorMetaData[numberOfValidators()]; Iterator iterator = getBuildEnabledValidatorsMap().keySet().iterator(); while (iterator.hasNext()) { ValidatorMetaData vmd = (ValidatorMetaData) iterator.next(); Boolean bvalue = (Boolean)(getBuildEnabledValidatorsMap().get(vmd)); if (bvalue.booleanValue() == true) { // If the validator is enabled if (vmd == null) continue; if ( vmd.isBuildValidation() ) { if (!onlyReferenced || vmd.isDependentValidator()) temp[count++] = vmd; } } } result = new ValidatorMetaData[count]; System.arraycopy(temp, 0, result, 0, count); }else{ result = new ValidatorMetaData[0]; } return result; }
public ValidatorMetaData[] getBuildEnabledValidators() throws InvocationTargetException { HashMap map = getBuildEnabledValidatorsMap(); Set set = getBuildEnabledValidatorsMap().keySet(); Iterator it = set.iterator(); List enabledBuildValidators = new ArrayList(); if (!set.isEmpty()) { while (it.hasNext()) { ValidatorMetaData data = (ValidatorMetaData) it.next(); Boolean obj = (Boolean) map.get(data); if (obj != null && obj.booleanValue() == true) { enabledBuildValidators.add(data); } } return (ValidatorMetaData[]) enabledBuildValidators.toArray(new ValidatorMetaData[enabledBuildValidators.size()]); } return getEnabledValidators(); }
public void propertyChange(PropertyChangeEvent event) { Preferences prefs = (Preferences) event.getSource(); if (prefs != null && !event.getOldValue().equals(event.getNewValue())) { try { deserializeAllPrefs(event); passivate(); } catch (InvocationTargetException ie) { Logger.getLogger().log(ie); } } }
public void disableSingleBuildValidator(ValidatorMetaData vmd){ Map buildVal = getBuildEnabledValidatorsMap(); buildVal.put(vmd, Boolean.FALSE); }
protected void copyTo(ProjectConfiguration prjp) throws InvocationTargetException { super.copyTo(prjp); // Need to have a distinct method for this child class (i.e., the parameter // is not a ValidationConfiguration) because if this initialization is // called as part of ValidationConfiguration's constructor, then the value of // this field is overwritten. Fields of this class are initialized to the // default after the ValidationConfiguration parent is created. prjp.setDoesProjectOverride(doesProjectOverride()); }
/** * @see org.eclipse.wst.validation.internal.operations.internal.attribute.ValidationConfiguration#deserialize(String) */ public void deserialize(String storedConfiguration) throws InvocationTargetException { super.deserialize(storedConfiguration); if (storedConfiguration != null && storedConfiguration.length() > 0) { // If it's null, then super.deserialize has already called resetToDefault to initialize // this instance. int canOverrideIndex = storedConfiguration.indexOf(ConfigurationConstants.PREF_PROJECTS_CAN_OVERRIDE); int disableAllValidationIndex = storedConfiguration.indexOf(ConfigurationConstants.DISABLE_ALL_VALIDATION_SETTING); int saveAutomaticallyIndex = storedConfiguration.indexOf(ConfigurationConstants.SAVE_AUTOMATICALLY_SETTING); if (disableAllValidationIndex != -1) { String canOverride = storedConfiguration.substring(canOverrideIndex + ConfigurationConstants.PREF_PROJECTS_CAN_OVERRIDE.length(), disableAllValidationIndex); setCanProjectsOverride(Boolean.valueOf(canOverride).booleanValue()); } if(saveAutomaticallyIndex != -1) { String saveAutomatically = storedConfiguration.substring(saveAutomaticallyIndex + ConfigurationConstants.SAVE_AUTOMATICALLY_SETTING.length(), canOverrideIndex); setSaveAutomatically(Boolean.valueOf(saveAutomatically).booleanValue()); } } }
protected void loadPreference() throws InvocationTargetException { // This method will be called in one of two situations: // 1. This is a new workspace and no preferences exist. // 2. This is a migrated workspace and the old preferences have already been created as // persistent properties. Preferences prefs = ValidationPlugin.getPlugin().getPluginPreferences(); if (prefs != null) { deserializeAllPrefs(prefs); } }
public ValidatorDelegateDescriptor getDelegateDescriptor(ValidatorMetaData vmd) throws InvocationTargetException { if (useGlobalPreference()) { return ConfigurationManager.getManager().getGlobalConfiguration().getDelegateDescriptor(vmd); } return super.getDelegateDescriptor(vmd); }
public ValidatorMetaData[] getBuildEnabledValidators() throws InvocationTargetException { if (useGlobalPreference()) { return extractProjectValidators(ConfigurationManager.getManager().getGlobalConfiguration().getBuildEnabledValidators(), getResource()); } return super.getBuildEnabledValidators(); }
private void deserializeAllPrefs(PropertyChangeEvent event) throws InvocationTargetException { String storedConfig = (String)event.getNewValue(); if( event.getProperty().equals(USER_PREFERENCE) ){ deserialize(storedConfig); }else if(event.getProperty().equals(USER_MANUAL_PREFERENCE)){ deserializeManual(storedConfig); }else if(event.getProperty().equals(USER_BUILD_PREFERENCE)){ deserializeBuild(storedConfig); }else if(event.getProperty().equals(DELEGATES_PREFERENCE)){ deserializeDelegates(storedConfig); } }
public void enableSingleBuildValidator(ValidatorMetaData vmd){ Map buildVal = getBuildEnabledValidatorsMap(); buildVal.put(vmd, Boolean.TRUE); }
protected void copyTo(GlobalConfiguration gp) throws InvocationTargetException { super.copyTo(gp); // Need to have a distinct method for this child class (i.e., the parameter // is not a ValidationConfiguration) because if this initialization is // called as part of ValidationConfiguration's constructor, then the value of // this field is overwritten. Fields of this class are initialized to the // default after the ValidationConfiguration parent is created. gp.setCanProjectsOverride(canProjectsOverride()); gp.setSaveAutomatically(getSaveAutomatically()); }
public boolean isBuildEnabled(ValidatorMetaData vmd) { if (vmd == null) { return false; } Boolean value = (Boolean) getBuildEnabledValidatorsMap().get(vmd); if (value == null) return false; return value.booleanValue(); }