Examples of XtextResource


Examples of org.eclipse.xtext.resource.XtextResource

    }
    Query query = queryParser.parse(currentModelToParse);
    if (query == null) {
      return new ICompletionProposal[0];
    }
    final XtextResource xtextResource = (XtextResource) query.eResource();
    final IXtextDocument xtextDocument = getDocument(xtextResource,
        currentModelToParse);

    XtextSourceViewerConfiguration configuration = configurationProvider
        .get();
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  private Resource createResourceFor(IStorage storage) {
    ResourceSet resourceSet = getResourceSet(storage);
    URI uri = storageToUriMapper.getUri(storage);
    XtextResource resource = getResource(resourceSet, uri);
    resource.setValidationDisabled(true);
    return resource;
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

    return descriptions;
  }

  private Collection<? extends IEObjectDescription> createTriggerSpecificVars(Rule rule) {
    List<IEObjectDescription> descriptions = new ArrayList<IEObjectDescription>();
    Resource varResource = new XtextResource(URI.createURI("event://specific.vars"));
    if(containsCommandTrigger(rule)) {
      JvmTypeReference commandTypeRef = typeReferences.getTypeForName(Command.class, rule);
      XVariableDeclaration varDecl = XbaseFactory.eINSTANCE.createXVariableDeclaration();
      varDecl.setName(RuleContextHelper.VAR_RECEIVED_COMMAND);
      varDecl.setType(commandTypeRef);
      varDecl.setWriteable(false);
      varResource.getContents().add(varDecl);
      descriptions.add(new LocalVarDescription(QualifiedName.create(varDecl.getName()), varDecl));
    }
    if(containsStateChangeTrigger(rule)) {
      JvmTypeReference stateTypeRef = typeReferences.getTypeForName(State.class, rule);
      XVariableDeclaration varDecl = XbaseFactory.eINSTANCE.createXVariableDeclaration();
      varDecl.setName(RuleContextHelper.VAR_PREVIOUS_STATE);
      varDecl.setType(stateTypeRef);
      varDecl.setWriteable(false);
      varResource.getContents().add(varDecl);
      descriptions.add(new LocalVarDescription(QualifiedName.create(varDecl.getName()), varDecl));
    }
    return descriptions;
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  public PPResourceFactory(Provider<PPResource> resourceProvider) {
    this.provider = resourceProvider;
  }

  public Resource createResource(URI uri) {
    XtextResource xtextResource = provider.get();
    xtextResource.setURI(uri);
    return xtextResource;
  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Serialize_1() throws Exception {
    String code = "file { 'afile': owner => 'foo'}";
    String fmt = "file { 'afile':\n  owner => 'foo'\n}\n";
    XtextResource r = getResourceFromString(code);
    String s = serializeFormatted(r.getContents().get(0));
    assertEquals("serialization should produce same result", fmt, s);

  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  }

  @Test
  public void test_Valdate_UnknownProperty() throws Exception {
    String code = "file { 'afile': donor => 'A donor'}";
    XtextResource r = getResourceFromStringAndExpect(code, UNKNOWN_EXPECTATION);
    resourceErrorDiagnostics(r).assertDiagnostic(IPPDiagnostics.ISSUE__RESOURCE_UNKNOWN_PROPERTY_PROP);

  }
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Parse_DoubleQuotedString_Dollar() throws Exception {
    String original = "before$/after";
    String code = doubleQuote(original);
    XtextResource r = getResourceFromString(code);
    EObject result = r.getContents().get(0);
    assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest);
    result = ((PuppetManifest) result).getStatements().get(0);
    assertTrue("Should be a DoubleQuotedString", result instanceof DoubleQuotedString);
    DoubleQuotedString string = (DoubleQuotedString) result;
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Parse_DoubleQuotedString_DollarExprVar() throws Exception {
    String original = "before${var}/after";
    String code = doubleQuote(original);
    XtextResource r = getResourceFromString(code);
    EObject result = r.getContents().get(0);
    assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest);
    result = ((PuppetManifest) result).getStatements().get(0);
    assertTrue("Should be a DoubleQuotedString", result instanceof DoubleQuotedString);
    DoubleQuotedString string = (DoubleQuotedString) result;
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Parse_DoubleQuotedString_DollarVar() throws Exception {
    String original = "before$var/after";
    String code = doubleQuote(original);
    XtextResource r = getResourceFromString(code);
    EObject result = r.getContents().get(0);
    assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest);
    result = ((PuppetManifest) result).getStatements().get(0);
    assertTrue("Should be a DoubleQuotedString", result instanceof DoubleQuotedString);
    DoubleQuotedString string = (DoubleQuotedString) result;
View Full Code Here

Examples of org.eclipse.xtext.resource.XtextResource

  @Test
  public void test_Parse_DoubleQuotedString_Simple() throws Exception {
    String original = "This is a simple double quoted string";
    String code = doubleQuote(original);
    XtextResource r = getResourceFromString(code);
    EObject result = r.getContents().get(0);
    assertTrue("Should be a PuppetManifest", result instanceof PuppetManifest);
    result = ((PuppetManifest) result).getStatements().get(0);

    assertTrue("Should be a DoubleQuotedString", result instanceof DoubleQuotedString);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.