Package org.eclipse.wst.validation

Examples of org.eclipse.wst.validation.ValidationResult


    }

    @Override
    public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor) {

        ValidationResult res = new ValidationResult();

        if (!okToValidate) {
            return res;
        }
View Full Code Here


    private final ServiceComponentHeaderValidator scValidator = new ServiceComponentHeaderValidator();

    @Override
    public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor) {
       
        ValidationResult res = new ValidationResult();

        IResource resource = event.getResource();

        if (!resource.getName().equals("MANIFEST.MF") || resource.getType() != IResource.FILE) {
            return res;
        }

        IFile m = (IFile) resource;

        Logger pluginLogger = Activator.getDefault() .getPluginLogger();

        try {

            for (IFile descriptor : scValidator.findMissingScrDescriptors(m)) {
                ValidatorMessage dsMessage = ValidatorMessage.create(
                        "No DS descriptor found at path " + descriptor.getProjectRelativePath(), m);
                dsMessage.setAttribute(IMarker.LOCATION, m.getName());
                dsMessage.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);

                res.add(dsMessage);

            }

        } catch (CoreException e) {
            pluginLogger.warn("Failed validating project " + resource.getFullPath(), e);
View Full Code Here

  }

  public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;
    final ValidationResult result = new ValidationResult();
    final IReporter reporter = result.getReporter(monitor);
   
    if(result.getDependsOn() != null) {
      fDependsOn = new HashSet(Arrays.asList(result.getDependsOn()));
    }
    else {
      fDependsOn = new HashSet();
    }
   
    // add web.xml as a dependency
    addDependsOn(DeploymentDescriptorPropertyCache.getInstance().getWebXML(resource.getFullPath()));

    // List relevant JSP 2.0 preludes/codas as dependencies
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    PropertyGroup[] propertyGroups = DeploymentDescriptorPropertyCache.getInstance().getPropertyGroups(resource.getFullPath());
    for (int j = 0; j < propertyGroups.length; j++) {
      IPath[] preludes = propertyGroups[j].getIncludePrelude();
      for (int i = 0; i < preludes.length; i++) {
        addDependsOn(workspaceRoot.getFile(preludes[i]));
      }
      IPath[] codas = propertyGroups[j].getIncludeCoda();
      for (int i = 0; i < codas.length; i++) {
        addDependsOn(workspaceRoot.getFile(codas[i]));
      }
    }
   
    IWorkspaceRunnable validationRunnable = new IWorkspaceRunnable() {
      public void run(IProgressMonitor monitor) throws CoreException {
        if (fragmentCheck((IFile) resource)) {
          validateFile((IFile) resource, reporter);
        }
        IResource[] resources = (IResource[]) fDependsOn.toArray(new IResource[fDependsOn.size()]);
        result.setDependsOn(resources);
        fDependsOn.clear();
      }
    };
    Job currentJob = Job.getJobManager().currentJob();
    ISchedulingRule rule = null;
View Full Code Here

  public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;

    ValidationResult result = new ValidationResult();
    final IReporter reporter = result.getReporter(monitor);

    if (fragmentCheck((IFile) resource)) {
      IStructuredModel model = null;
      try {
        model = StructuredModelManager.getModelManager().getModelForRead((IFile) resource);
View Full Code Here

  }

  public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;
    ValidationResult result = new ValidationResult();

    IFile file = (IFile) resource;
    if (file.isAccessible()) {
      // TAGX
      if (fTagXexts.contains(file.getFileExtension()) || fTagXnames.contains(file.getName())) {
        monitor.beginTask("", 3);
        org.eclipse.wst.xml.core.internal.validation.eclipse.Validator xmlValidator = new org.eclipse.wst.xml.core.internal.validation.eclipse.Validator();
        ValidationResult result3 = new MarkupValidator().validate(resource, kind, state, new SubProgressMonitor(monitor, 1));
        if(monitor.isCanceled()) return result;
        ValidationResult result2 = xmlValidator.validate(resource, kind, state, new SubProgressMonitor(monitor, 1));
        if(monitor.isCanceled()) return result;
        ValidationResult result1 = new JSPActionValidator().validate(resource, kind, state, new SubProgressMonitor(monitor, 1));
        List messages = new ArrayList(result1.getReporter(new NullProgressMonitor()).getMessages());
        messages.addAll(result2.getReporter(new NullProgressMonitor()).getMessages());
        messages.addAll(result3.getReporter(new NullProgressMonitor()).getMessages());
        for (int i = 0; i < messages.size(); i++) {
          IMessage message = (IMessage) messages.get(i);
          if (message.getText() != null && message.getText().length() > 0) {
View Full Code Here

  }

  public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;
    ValidationResult result = new ValidationResult();
    final IReporter reporter = result.getReporter(monitor);
    validateFile((IFile) resource, reporter);
    return result;
  }
View Full Code Here

  /**
   * Perform the validation using version 2 of the validation framework.
   */
  public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor){
    ValidationResult result = new ValidationResult()
    IReporter reporter = result.getReporter(monitor);
    IFile file = null;
    if (resource instanceof IFile)file = (IFile)resource;
    if (file != null)
    {
      NestedValidatorContext nestedcontext = getNestedContext(state, false);
View Full Code Here

  }

  public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;
    ValidationResult result = new ValidationResult();

    IFile tld = (IFile) resource;
    if (tld.isAccessible()) {
      try {
        final IJavaProject javaProject = JavaCore.create(tld.getProject());
        if (javaProject.exists()) {
          IScopeContext[] scopes = new IScopeContext[]{new InstanceScope(), new DefaultScope()};
          ProjectScope projectScope = new ProjectScope(tld.getProject());
          if (projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(JSPCorePreferenceNames.VALIDATION_USE_PROJECT_SETTINGS, false)) {
            scopes = new IScopeContext[]{projectScope, new InstanceScope(), new DefaultScope()};
          }
          Map[] problems = detectProblems(javaProject, tld, scopes);
          for (int i = 0; i < problems.length; i++) {
            ValidatorMessage message = ValidatorMessage.create(problems[i].get(IMarker.MESSAGE).toString(), resource);
            message.setType(MARKER_TYPE);
            message.setAttributes(problems[i]);
            result.add(message);
          }
        }
      }
      catch (Exception e) {
        Logger.logException(e);
View Full Code Here

  public ValidationResult validate(final IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
    if (resource.getType() != IResource.FILE)
      return null;

    ValidationResult result = new ValidationResult();
    final IReporter reporter = result.getReporter(monitor);

    if (fragmentCheck((IFile) resource)) {
      IStructuredModel model = null;
      try {
        model = StructuredModelManager.getModelManager().getModelForRead((IFile) resource);
View Full Code Here

public class AppConfigValidator extends AbstractValidator implements IValidator {

    @Override
  public ValidationResult validate(final IResource resource, final int kind,
      final ValidationState state, final IProgressMonitor monitor) {
    final ValidationResult vr = new ValidationResult();
    if (resource == null || !(resource instanceof IFile)) {
      return vr;
    }
    final IReporter reporter = vr.getReporter(monitor);
    validateFile((IFile) resource, reporter);
    return vr;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.validation.ValidationResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.