Package org.eclipse.xtext.resource

Examples of org.eclipse.xtext.resource.IEObjectDescription


    if (crossRefString != null && !crossRefString.equals("")) {
      linkNode = node;
      final IScope scope = getScope(context, ref);
      linkNode = null;
      QualifiedName qualifiedLinkName =  qualifiedNameConverter.toQualifiedName(crossRefString);
      IEObjectDescription eObjectDescription = scope.getSingleElement(qualifiedLinkName);
      if (eObjectDescription != null)
        return Collections.singletonList(eObjectDescription.getEObjectOrProxy());
    }
    return Collections.emptyList();
  }
View Full Code Here


  }
 
  public IScope scope_Id(TaskDeclaration owner, EReference ref) {
    String crossrefName = linkingHelper.getCrossRefNodeAsString(node, true);
    if ("options".equals(crossrefName)) {
      IEObjectDescription description = EObjectDescription.create("options", getOptions());
      return new SingletonScope(description, IScope.NULLSCOPE);
    }
    else {
      // Let superclass handle it
      return null;
View Full Code Here

      descriptions.put(name.toString(), d);
    }
  }

  public EObject objectDescribedAs(String name) {
    IEObjectDescription d = descriptions.get(name);
    return d.getEObjectOrProxy();
  }
View Full Code Here

  @Override public Collection<IEObjectDescription> findOptionFields(IndexedElement reference) {
    Set<IEObjectDescription> descriptions = newHashSet();
    if (reference instanceof MessageField) {
      Message fieldType = messageFields.messageTypeOf((MessageField) reference);
      for (MessageElement element : fieldType.getElements()) {
        IEObjectDescription d = describe(element);
        if (d != null) {
          descriptions.add(d);
        }
      }
    }
    if (reference instanceof Group) {
      for (GroupElement element : ((Group) reference).getElements()) {
        IEObjectDescription d = describe(element);
        if (d != null) {
          descriptions.add(d);
        }
      }
    }
View Full Code Here

      return emptySet();
    }
    Map<EObject, IEObjectDescription> shortestOnes = newHashMap();
    for (IEObjectDescription d : descriptions) {
      EObject e = d.getEObjectOrProxy();
      IEObjectDescription stored = shortestOnes.get(e);
      if (stored != null) {
        QualifiedName currentName = d.getName();
        if (currentName.getSegmentCount() >= stored.getName().getSegmentCount()) {
          continue;
        }
      }
      shortestOnes.put(e, d);
    }
View Full Code Here

    if(eObject instanceof Resource){
      QualifiedName qualifiedName = getQualifiedNameProvider().getFullyQualifiedName(eObject);
      if(qualifiedName!=null){
        Triples triples=(Triples)eObject.eContainer();
        Map<String,String> userData=getUserData(triples);
        IEObjectDescription desc=new TurtleEObjectDescription(qualifiedName, eObject,userData);
        acceptor.accept(desc);
      }
      return false;
    } else if(eObject instanceof Triples){
      extractPotentialNamespaceDefinition((Triples)eObject, acceptor);
View Full Code Here

      userData.put(Descriptions.TAG_KEY, on(Descriptions.SEPARATOR).join(tagData));
      QualifiedName name = nameOf(content);
      if(name == null){
        return Boolean.FALSE;
      }
      IEObjectDescription description = create(name, content, userData);
      acceptor.accept(description);
      return Boolean.TRUE;
    }
View Full Code Here

        // Need the class to get its full name
        ppFinder.configure(model.eResource());
        List<IEObjectDescription> descs = ppFinder.findHostClasses(resourceBody, className, null).getAdjusted();
        if(descs.size() < 1)
          return; // can't find class, no proposals
        IEObjectDescription desc = descs.get(0); // pick first if ambiguous

        // which attribute(s) are we trying to find.
        String prefix = context.getPrefix();
        QualifiedName fqn = desc.getQualifiedName().append(prefix);

        for(IEObjectDescription d : ppFinder.findAttributesWithPrefix(resourceBody, fqn).getAdjusted())
          acceptor.accept(createCompletionProposal(d.getName().getLastSegment(), context));

      }
      else if(resourceType == RESOURCE_IS_OVERRIDE) {
        // do nothing (too complicated due to the query being able to match all sorts of things)
      }
      else {
        // Normal Resource
        ppFinder.configure(model.eResource());

        // Either a default setting Type { } or instance type { }, in both cases propose all properties and parameters
        // including meta
        IEObjectDescription desc = (IEObjectDescription) adapter.getTargetObjectDescription();
        if(desc != null) {
          // the type is known
          // which attribute(s) are we trying to find.
          String prefix = context.getPrefix();
          QualifiedName fqn = desc.getQualifiedName().append(prefix);
          for(IEObjectDescription d : ppFinder.findAttributesWithPrefix(resourceBody, fqn).getAdjusted())
            acceptor.accept(createCompletionProposal(d.getName().getLastSegment(), context));

        }
View Full Code Here

   *
   * @see org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider#createURI(org.eclipse.emf.ecore.EObject)
   */
  @Override
  protected org.eclipse.emf.common.util.URI createURI(EObject o) {
    IEObjectDescription target = documentationProvider.xref(o);
    if(target == null)
      return null; // should disable the link as well

    final URIConverter uriConverter = o.eResource().getResourceSet().getURIConverter();
    final URI uri = target.getEObjectURI();
    final URI normalized = uriConverter.normalize(uri);
    return normalized;
  }
View Full Code Here

    final String definitionURI = d.eResource().getURI().toString();

    int removedCount = 0;
    ListIterator<IEObjectDescription> litor = descs.listIterator();
    while(litor.hasNext()) {
      IEObjectDescription x = litor.next();
      URI xURI = x.getEObjectURI();
      // if in the same resource, and contain by the same EObject
      if(xURI.toString().startsWith(definitionURI) && xURI.fragment().startsWith(definitionFragment)) {
        litor.remove();
        removedCount++;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.resource.IEObjectDescription

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.