/** * @deprecated For use by the validation framework only. */ public ValidatorMetaData getValidatorMetaData(IValidator validator) { return ValidationRegistryReader.getReader().getValidatorMetaData(validator); }
private void addAnyRemainder() { Set anyProjVmds = (Set) _validators.get(UNKNOWN_PROJECT); if (anyProjVmds == null) { // no validators run on all projects return; } Set keys = _validators.keySet(); Iterator iterator = keys.iterator(); while (iterator.hasNext()) { String projId = (String) iterator.next(); if (projId.equals(UNKNOWN_PROJECT) || projId.equals(EXCLUDED_PROJECT)) { // Don't add list to itself or to a project nature which is excluded. continue; } add(projId, anyProjVmds); } }
private void addRemainder() { // First, add all "can-run-on-any-project-type" to every registered project nature type in // the cache. addAnyRemainder(); // Then add the "can-run-on-any-project-type-but-X" to every non-X registered project nature // type in the cache. addExcludedRemainder(); }
/** * Convenience method. Rather than store the is-this-vmd-configured-on-this-IProject algorithm * in two places, refer back to the reader's cache. */ public boolean isConfiguredOnProject(IProject project) { return ValidationRegistryReader.getReader().isConfiguredOnProject(this, project); }
ValidationRegistryReader.getReader().disableValidator(vmd);
ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator); if (vmd == null) { } catch (InstantiationException exc) { ValidationRegistryReader.getReader().disableValidator(vmd);
/** * Return true if the validator identified by validatorId will validate the given resource. If * either parameter is null, false is returned. If the validator is not registered with the * validation framework (i.e., either no validator in the activated plugins is identified by * that plugin id, or the given IResource's project does not run that particular validator), * then this method will return false. */ public boolean isApplicableTo(String validatorId, IResource res) { if ((validatorId == null) || (res == null)) { return false; } ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validatorId); if (vmd == null) { // validator not registered with the framework return false; } if (!ValidationRegistryReader.getReader().isConfiguredOnProject(vmd, res.getProject())) { return false; } return vmd.isApplicableTo(res); }
/** * Return true if the named validator is installed, otherwise false. */ public boolean isExistingValidator(String validatorClassName) { return (getValidatorMetaData(validatorClassName) != null); }
/** * This constructor should be used in all cases except for the Preference page's values. */ public GlobalConfiguration(IWorkspaceRoot root) throws InvocationTargetException { super(root, convertToArray(ValidationRegistryReader.getReader().getAllValidators())); // Can't put the call to load() and passivate() in the ValidationConfiguration constructor // due // to the order of initialization. // 1. First the ValidationConfiguration constructor is called, and that loads the stored // values. // 2. Then this class's <init> method is called, and that initializes the "override" field // to the default, // which may be different than the stored value. }
public IValidator getValidator(String validatorUniqueId) throws InstantiationException { ValidationRegistryReader reader = ValidationRegistryReader.getReader(); return reader.getValidator(validatorUniqueId); }
private void releaseCachedMaps() { if (ValidationRegistryReader.getReader().projectValidationMetaData != null) { ValidationRegistryReader.getReader().projectValidationMetaData.clear(); ValidationRegistryReader.getReader().projectValidationMetaData = null; } IProjectValidationHelper helper = ValidationHelperRegistryReader.getInstance().getValidationHelper(); if (helper != null) helper.disposeInstance(); }
/** * Traverse over the list of VMDs which have been added and create copies of it. The copies are * created to increase runtime performance. */ private void buildCache() { Iterator iterator = _indexedValidators.values().iterator(); while (iterator.hasNext()) { ValidatorMetaData vmd = (ValidatorMetaData) iterator.next(); buildProjectNatureCache(vmd); buildDefaultEnabledCache(vmd); } // Now add the validators which are configured on all projects, // and all projects but X. addRemainder(); // this temporary list isn't needed any more. All of the excluded // projects have been added to the project natures which they don't exlcude. _validators.remove(EXCLUDED_PROJECT); Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.FINEST)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceID("ValidationRegistryReader.buildCache()"); //$NON-NLS-1$ entry.setText(debug()); logger.write(Level.FINEST, entry); } }
ValidatorMetaData vmd = initializeValidator(element, label, pluginId); add(vmd);
/** * Returns the singleton ValidationRegistryReader. */ public static ValidationRegistryReader getReader() { if (inst == null) { inst = new ValidationRegistryReader(); EventManager.getManager().setActive(true); } return inst; }
ValidationRegistryReader.getReader().disableValidator(vmd);
ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator); if (vmd == null) { return; ValidationRegistryReader.getReader().disableValidator(vmd);
/** * @deprecated For use by the validation framework only. */ public boolean isConfigured(IProject project, ValidatorMetaData vmd) { return ValidationRegistryReader.getReader().isConfiguredOnProject(vmd, project); }
/** * Return a collection of Validators configured on a certain type of IProject (e.g. EJB Project * vs. Web Project). * * This is a long-running process. If you can, cache the result. */ public Set getValidatorMetaData(IProject project) { Set copy = new HashSet(); getValidatorMetaData(project, copy); return copy; }
/** * This constructor should be used in all cases except for the Properties page's values. */ protected ProjectConfiguration(IProject project) throws InvocationTargetException { // The extractProjectValidators method extracts just this project's validators from the // global list. super(project, extractProjectValidators(convertToArray(ValidationRegistryReader.getReader().getAllValidators()), project)); // Can't put the call to load() and passivate() in the ValidationConfiguration constructor // due // to the order of initialization. // 1. First the ValidationConfiguration constructor is called, and that loads the stored // values. // 2. Then this class's <init> method is called, and that initializes the "override" field // to the default, // which may be different than the stored value. }
protected static ValidatorMetaData getVMD(IValidator validator) throws IllegalArgumentException { ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator); if (vmd == null) { throw new IllegalArgumentException(); // already logged in the ValidationRegistryReader } return vmd; }