Package org.eclipse.xtext.naming

Examples of org.eclipse.xtext.naming.QualifiedName


    assertThat(userDataOf(input, "task2"), is("done"));
  }

  private String userDataOf(String input, String name) {
    IResourceDescription resourceDescription = createResourceDescription(input);
    QualifiedName qualifiedName = QualifiedName.create(name);
    Iterable<IEObjectDescription> exportedObjects = resourceDescription.getExportedObjects(TaskPackage.Literals.TASK, qualifiedName , false);
    return exportedObjects.iterator().next().getUserData(Descriptions.TAG_KEY);
  }
View Full Code Here


  @Override
  public boolean createEObjectDescriptions(EObject eObject,
      IAcceptor<IEObjectDescription> acceptor) {
    try {
      QualifiedName qualifiedName = getQualifiedNameProvider().getFullyQualifiedName(eObject);
      if (qualifiedName != null) {
        Map<String, String> userData = new HashMap<String, String>();
        userData.put("hash", "" + XdocUtil.hash(eObject));
        acceptor.accept(EObjectDescription.create(qualifiedName, eObject, userData));
      }
View Full Code Here

        EList<Method> _methods = testCase.getMethods();
        for (final Method method : _methods) {
          {
            String _elvis = null;
            String _name = method.getName();
            QualifiedName _create = QualifiedName.create(_name);
            QualifiedName _methodName = JexTestJvmModelInferrer.this._operatorMapping.getMethodName(_create);
            String _string = null;
            if (_methodName!=null) {
              _string=_methodName.toString();
            }
            if (_string != null) {
              _elvis = _string;
            } else {
              String _name_1 = method.getName();
View Full Code Here

   * @param o
   * @return
   */
  QualifiedName getParentsFullyQualifiedName(EObject o) {
    for(EObject tmp = o.eContainer(); tmp != null; tmp = tmp.eContainer()) {
      QualifiedName n = getFullyQualifiedName(tmp);
      if(n != null)
        return n;
    }
    return null;
  }
View Full Code Here

          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

        // create indexed finder from the perspective of the current resource
        ppFinder.configure(model.eResource());

        // get the fqn (skip the '$') of the name to complete
        QualifiedName fqn = converter.toQualifiedName(prefix.substring(bracedInput
            ? 0
            : 1));

        // turn global references '::x' into non global
        if(fqn.getSegmentCount() > 1 && fqn.getSegment(0).length() == 0)
          fqn = fqn.skipFirst(1);

        // normal converter does not add trailing empty segment, do so here to enable search in xxx::* namespace
        if(prefix.endsWith("::") && fqn.getSegmentCount() > 0)
          fqn = fqn.append("");

        // find variables using prefixed variant of find
        SearchResult r = ppFinder.findVariablesPrefixed(model, fqn, null);

        // get the name of the scope we are in to enable reduction of proposal to use locally scoped name
        QualifiedName scopeFQN = ppFinder.getNameOfScope(model);

        // Remove disqualified entries (known to be uninitialized) ( $x = $x, and define foo ($x, $y = $x) ) (surgical operation)
        removeDisqualifiedVariables(r.getAdjusted(), model);

        // Create proposals
View Full Code Here

  }

  private void checkCircularInheritence(HostClassDefinition o, Collection<IEObjectDescription> descs,
      List<QualifiedName> stack, IMessageAcceptor acceptor, PPImportedNamesAdapter importedNames) {
    for(IEObjectDescription d : descs) {
      QualifiedName name = d.getName();
      if(stack.contains(name)) {
        // Gotcha!
        acceptor.acceptError( //
          "Circular inheritence", o, //
          PPPackage.Literals.HOST_CLASS_DEFINITION__PARENT, //
View Full Code Here

    List<AttributeOperation> nameVariables = Lists.newArrayList();
    // Multimap<String, AttributeOperation> seen = ArrayListMultimap.create();

    if(aos != null && desc != null)
      for(AttributeOperation ao : aos.getAttributes()) {
        QualifiedName fqn = desc.getQualifiedName().append(ao.getKey());
        // Accept name if there is at least one type/definition that lists the key
        // NOTE/TODO: If there are other problems (multiple definitions with same name etc,
        // the property could be ok in one, but not in another instance.
        // finding that A'::x exists but not A''::x requires a lot more work
        List<IEObjectDescription> foundAttributes = ppFinder.findAttributes(aos, fqn, importedNames).getAdjusted();
View Full Code Here

  private void internalLinkVariable(EObject o, EAttribute attr, String varName, PPImportedNamesAdapter importedNames,
      IMessageAcceptor acceptor) {
    boolean qualified = false;
    boolean global = false;
    boolean disqualified = false;
    QualifiedName qName = null;
    SearchResult searchResult = null;
    boolean existsAdjusted = false; // variable found as stated
    boolean existsOutside = false; // if not found, reflects if found outside search path
    try {
      qName = converter.toQualifiedName(varName);
      if(patternHelper.isDECIMALVAR(varName)) {
        internalLinkRegexpVariable(o, varName, attr, acceptor);
        return;
      }

      qualified = qName.getSegmentCount() > 1;
      global = qName.getFirstSegment().length() == 0;
      searchResult = ppFinder.findVariable(o, qName, importedNames);

      // remove all references to not yet initialized variables
      disqualified = (0 != removeDisqualifiedVariables(searchResult.getRaw(), o));
      if(disqualified) // adjusted can not have disqualified entries if raw did not have them
View Full Code Here

    private IQualifiedNameConverter qualifiedNameConverter;

    public String get(EObject target) {
      StringBuilder builder = new StringBuilder();
      builder.append("Puppet references to ");
      QualifiedName qualifiedName = qualifiedNameProvider.getFullyQualifiedName(target);
      if(qualifiedName != null) {
        builder.append(qualifiedNameConverter.toString(qualifiedName));
      }
      else {
        String simpleName = SimpleAttributeResolver.NAME_RESOLVER.getValue(target);
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.naming.QualifiedName

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.