public static boolean isEARValidationAutoEnabled(IProject earProj) { return ValidatorManager.getManager().isAutoValidate(earProj) && ValidatorManager.getManager().isEnabled(earProj, UIEarValidator.VALIDATOR_ID); }
public static ValidatorManager getManager() { if (inst == null) { inst = new ValidatorManager(); } return inst; }
private ValidatorManager() { super(); _suspendedProjects = new HashSet(); _internalOwners = new String[0]; addInternalOwner(getMessageLimitOwner()); }
/** * Run all enabled validators on the project with the identified ruleGroup. * * IProject must exist and be open. * * If async is true, the validation will run all validators implementing IValidatorJob interface * in the background validation thread, if async is false, it would run in the main thread. * All validators implementing IValidator interface will run in in the main thread regardless of this flag. */ public EnabledValidatorsOperation(IProject project, IWorkbenchContext aWorkbenchContext, int ruleGroup, boolean force, boolean async) { this(project, aWorkbenchContext, ValidatorManager.getManager().getEnabledValidators(project), ruleGroup, force, async); }
public boolean canAutoValidateButtonBeEnabled(IProject project) { return canAutoValidateButtonBeEnabled(project, isGlobalAutoBuildEnabled()); }
valInstance = vmd.getValidator(); } catch (InstantiationException e1) { if(!ValidatorManager.getManager().getProblemValidators().contains(vmd)) { ValidatorManager.getManager().getProblemValidators().add(vmd); System.out.println(e1.getMessage()); buffer.append(" "); //$NON-NLS-1$ buffer.append("isAutoValidate? "); //$NON-NLS-1$ boolean autoBuild = (_isAutoBuild == null) ? ValidatorManager.getManager().isGlobalAutoBuildEnabled() : _isAutoBuild.booleanValue(); buffer.append(ValidatorManager.getManager().isAutoValidate(getProject(), autoBuild)); buffer.append(" "); //$NON-NLS-1$ buffer.append("isIncremental? "); //$NON-NLS-1$
/** * Get the collection of files from the project that are relevant for the * validator with the given class name. * * @param files The files relevant for the class name. * @param resource The resource to look for files in. * @param validatorClassName The name of the validator class. */ protected void getFiles(Collection files, IContainer resource, String validatorClassName) { try { IResource [] resourceArray = resource.members(false); for (int i=0; i<resourceArray.length; i++) { if (ValidatorManager.getManager().isApplicableTo(validatorClassName, resourceArray[i])) { if (resourceArray[i] instanceof IFile) files.add(resourceArray[i]); } if (resourceArray[i].getType() == IResource.FOLDER) getFiles(files,(IContainer)resourceArray[i], validatorClassName) ; } } catch (Exception e) {} }
QualifiedName validatorKey = new QualifiedName(null, "Validator"); //$NON-NLS-1$ IValidatorJob validator = (IValidatorJob)job.getProperty( validatorKey ); ValidatorManager mgr = ValidatorManager.getManager(); final ArrayList list = mgr.getMessages(validator); e.printStackTrace(); mgr.clearMessages( validator ); validator = null;
public ManualValidatorsOperation(IProject project) { super(project, DEFAULT_FORCE, RegistryConstants.ATT_RULE_GROUP_DEFAULT, true); setEnabledValidators(ValidatorManager.getManager().getManualEnabledValidators(project)); } public ManualValidatorsOperation(IProject project, Object[] changedResources) {
/** * Return true if the given validator must run (i.e., it has changes to validate, and it was not * run automatically.) */ private boolean isValidationNecessary(ValidatorMetaData vmd, IFileDelta[] delta) { // Validation is not necessary if: // 1. auto-validation has run and the validator is incremental, // 2. There are no files for the validator to validate. // There are files to validate if this is a full validation or if the // validator filtered in some of the deltas. boolean autoValidateRan = false; if (_isAutoBuild != null) { // User set the autoBuild default, so check if validation is // necessary or not. autoValidateRan = ValidatorManager.getManager().isAutoValidate(getProject(), _isAutoBuild.booleanValue()) && vmd.isIncremental(); } boolean hasFiles = (isFullValidate() || (delta.length > 0)); return (!autoValidateRan && hasFiles); }
return; if (ValidatorManager.getManager().isSuspended(getProject())) { return;
/** * If the code that invoked this operation suspended auto-build before invoking this operation, * the user's auto-build setting is stored in the following methods. */ public boolean isAutoBuild() { if (_isAutoBuild == null) { return ValidatorManager.getManager().isGlobalAutoBuildEnabled(); } return _isAutoBuild.booleanValue(); }
private static void cacheMessage( IValidatorJob validator, IResource resource, Class clazz, IMessage message, String targetObjectName, String location, String markerId ){ if ((clazz == null) || (message == null) || (resource == null)) { return; } ClassLoader cl = null; if (cl == null) { cl = clazz.getClassLoader(); } String text = message.getText(cl); MessageInfo msgInfo = new MessageInfo(getUniqueId(clazz), resource, location, text, targetObjectName, markerId, message ); ValidatorManager mgr = ValidatorManager.getManager(); mgr.cacheMessage( validator, msgInfo ); } }
public boolean isAutoValidate(IProject project) { return isAutoValidate(project, isGlobalAutoBuildEnabled()); }
/** * Keeping this API around so as not to break existing code. * * @deprecated use isAutoValidate */ public boolean isAutoValidateChecked(IProject project) { return isAutoValidate(project); }
public boolean canAutoValidateButtonBeEnabled(IProject project, boolean isGlobalAutoBuildOn, boolean incrementalValEnabled) { boolean doesProjectSupportAutoValidate = doesProjectSupportBuildValidation(project); return (doesProjectSupportAutoValidate && isGlobalAutoBuildOn && incrementalValEnabled); }
public boolean canAutoValidateButtonBeEnabled(IProject project, boolean isGlobalAutoBuildOn) { try { ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project); boolean incrementalValEnabled = (prjp.numberOfEnabledIncrementalValidators() > 0); return canAutoValidateButtonBeEnabled(project, isGlobalAutoBuildOn, incrementalValEnabled); } catch (InvocationTargetException exc) { Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.SEVERE)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceIdentifier("ValidatorManager::canAutoValidateButtonBeEnabled" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ entry.setTargetException(exc); logger.write(Level.SEVERE, entry); if (exc.getTargetException() != null) { entry.setTargetException(exc); logger.write(Level.SEVERE, entry); } } return false; } }
/** * Get the collection of files from the project that are relevant for the * validator with the given class name. * * @param files The files relevant for the class name. * @param resource The resource to look for files in. * @param validatorClassName The name of the validator class. */ protected void getFiles(Collection files, IContainer resource, String validatorClassName) { try { IResource [] resourceArray = resource.members(false); for (int i=0; i<resourceArray.length; i++) { if (ValidatorManager.getManager().isApplicableTo(validatorClassName, resourceArray[i])) { if (resourceArray[i] instanceof IFile) { files.add(resourceArray[i]); } } if (resourceArray[i].getType() == IResource.FOLDER) getFiles(files,(IContainer)resourceArray[i], validatorClassName) ; } } catch (Exception e) {} }
ValidatorManager mgr = ValidatorManager.getManager(); final ArrayList list = mgr.getMessages((IValidatorJob)validator); mgr.clearMessages( (IValidatorJob)validator );
public ManualValidatorsOperation(IProject project, Object[] changedResources) { super(project, shouldForce(changedResources), RegistryConstants.ATT_RULE_GROUP_DEFAULT, true); setEnabledValidators(ValidatorManager.getManager().getManualEnabledValidators(project)); } }