/** * Validate a single resource with a single validator. This will call the validator whether the * validator is enabled or not. * * <p>Callers of this method should ensure that the shouldValidate was tested before making this * call. * * @param validator the validator * @param operation the operation that the validation is running in. * @param resource the resource to validate * @param kind the kind of resource change. See IResourceDelta. * @param monitor */ public void validate( Validator validator, ValOperation operation, IResource resource, int kind, IProgressMonitor monitor, ValidationEvent event) { if (operation.isValidated(validator.getId(), resource)) return; long time = 0; long cpuTime = -1; String msg1 = NLS.bind(ValMessages.LogValStart, validator.getName(), resource.getName()); monitor.subTask(msg1); IPerformanceMonitor pm = ValidationFramework.getDefault().getPerformanceMonitor(); if (pm.isCollecting()) { time = System.currentTimeMillis(); cpuTime = Misc.getCPUTime(); } if (Tracing.matchesExtraDetail(validator.getId())) { Tracing.log("ValManager-03: validating ", resource); // $NON-NLS-1$ } if (resource.exists()) { ValidationResult vr = validator.validate(resource, kind, operation, monitor, event); if (pm.isCollecting()) { if (cpuTime != -1) { cpuTime = Misc.getCPUTime() - cpuTime; } int num = 0; if (vr != null) num = vr.getNumberOfValidatedResources(); PerformanceCounters pc = new PerformanceCounters( validator.getId(), validator.getName(), resource.getName(), num, System.currentTimeMillis() - time, cpuTime); pm.add(pc); } if (ValidationPlugin.getPlugin().isDebugging() && !pm.isCollecting()) { String msg = time != 0 ? NLS.bind( ValMessages.LogValEndTime, new Object[] { validator.getName(), validator.getId(), resource, Misc.getTimeMS(System.currentTimeMillis() - time) }) : NLS.bind(ValMessages.LogValEnd, validator.getName(), resource); Tracing.log("ValManager-01: " + msg); // $NON-NLS-1$ } if (vr != null) { operation.mergeResults(vr); if (vr.getSuspendValidation() != null) operation.suspendValidation(vr.getSuspendValidation(), validator); } } }