public AbstractValidationSettingsPage() {
   super();
   fCombos = new ArrayList();
   fExpandables = new ArrayList();
   fPreferencesService = Platform.getPreferencesService();
   fValidation = ValidationFramework.getDefault();
 }
Beispiel #2
0
  /**
   * Let each of the enabled validators know that a clean has been requested.
   *
   * @param project the project that is being cleaned, or null if the entire workspace is being
   *     cleaned.
   * @param monitor
   */
  public void clean(IProject project, IProgressMonitor monitor) {
    IValidatorVisitor visitor =
        new IValidatorVisitor() {

          public void visit(
              Validator validator,
              IProject project,
              ValType valType,
              ValOperation operation,
              IProgressMonitor monitor) {
            validator.clean(project, operation, monitor);
          }
        };
    ValidationFramework.getDefault().getDependencyIndex().clear(project);
    ValOperation operation = new ValOperation();
    accept(visitor, project, ValType.Build, operation, monitor);
  }
 public IMarkerResolution[] getResolutions(IMarker marker) {
   if (isNeedToCreate(marker)) {
     IMutableValidator[] validators;
     try {
       MutableWorkspaceSettings workspaceSettings =
           ValidationFramework.getDefault().getWorkspaceSettings();
       validators = workspaceSettings.getValidators();
       if (DisableFaceletHTMLValidatorMarkerResolution.findValidator(validators, VALIDATOR_ID)
           != null) {
         return new IMarkerResolution[] {
           new DisableFaceletHTMLValidatorMarkerResolution((IFile) marker.getResource())
         };
       }
     } catch (InvocationTargetException e) {
       JsfUiPlugin.getPluginLog().logError(e);
     }
   }
   return new IMarkerResolution[] {};
 }
Beispiel #4
0
  /**
   * 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);
      }
    }
  }