Package org.eclipse.xtext.validation

Examples of org.eclipse.xtext.validation.IResourceValidator


    }
    throw new IllegalStateException();
  }

  protected List<Issue> validate(EObject model) {
    IResourceValidator validator = ((XtextResource) model.eResource()).getResourceServiceProvider().getResourceValidator();
    return validator.validate(model.eResource(), CheckMode.ALL, CancelIndicator.NullImpl);
  }
View Full Code Here


      ppRunner.setUp(IValidationAdvisor.ComplianceLevel.PUPPET_2_7, new DefaultPotentialProblemsAdvisor());
      worked(ticker, 1);
      File f = new File("/unnamed.pp");
      r = ppRunner.loadResource(code, URI.createFileURI(f.getPath()));
      // no need to remember "/" as the root
      IResourceValidator rv = ppRunner.getPPResourceValidator();
      final CancelIndicator cancelMonitor = new CancelIndicator() {
        public boolean isCanceled() {
          return ticker.isCanceled();
        }
      };

      List<Issue> issues = rv.validate(r, CheckMode.ALL, cancelMonitor);
      for(Issue issue : issues) {
        addIssueDiagnostic(diagnostics, issue, f, f.getParentFile());
      }
      worked(ticker, 1);
      ppRunner.tearDown();
View Full Code Here

    // Must set the root in all resources to allow cross reference error reports to contain
    // relative paths
    for(Resource r : ppResources.values())
      rememberRootInResource(root, r);

    IResourceValidator validator = ppRunner.getPPResourceValidator();
    long maxLinkTime = 0;
    // Turn on for debugging particular files
    // File slowCandidate = new File("/Users/henrik/gitrepos/forge-modules/jeffmccune-mockbuild/manifests/init.pp");

    for(Entry<File, Resource> r : ppResources.entrySet()) {
      File f = r.getKey();
      if(!isValidationWanted(examinedFiles, f))
        continue;
      long beforeTime = System.currentTimeMillis();
      boolean profileThis = false; // /* for debugging slow file */
                      // f.equals(slowCandidate);
      if(options.isCheckReferences())
        ppRunner.resolveCrossReferences(r.getValue(), profileThis, ticker);
      long afterTime = System.currentTimeMillis();
      if(afterTime - beforeTime > maxLinkTime) {
        maxLinkTime = afterTime - beforeTime;
      }
      final CancelIndicator cancelMonitor = new CancelIndicator() {
        public boolean isCanceled() {
          return ticker.isCanceled();
        }
      };

      List<Issue> issues = validator.validate(r.getValue(), CheckMode.ALL, cancelMonitor);
      for(Issue issue : issues) {
        addIssueDiagnostic(diagnostics, issue, f, root);
      }
    }
    // // Debug stuff
View Full Code Here

    final SubMonitor ticker = SubMonitor.convert(monitor, 2);
    worked(ticker, 1);
    try {
      FileInputStream input = new FileInputStream(f);
      Resource r = dr.loadResource(input, URI.createFileURI(f.getPath()));
      IResourceValidator rv = dr.getPPResourceValidator();
      final CancelIndicator cancelMonitor = new CancelIndicator() {
        public boolean isCanceled() {
          return ticker.isCanceled();
        }
      };

      List<Issue> issues = rv.validate(r, CheckMode.ALL, cancelMonitor);
      worked(ticker, 1);
      for(Issue issue : issues) {
        addIssueDiagnostic(diagnostics, issue, f, root);
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.validation.IResourceValidator

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.