public boolean isConformant(final SJClass c1, final SJClass c2) {
   boolean _or = false;
   boolean _or_1 = false;
   boolean _or_2 = false;
   boolean _or_3 = false;
   boolean _equals = Objects.equal(c1, SmallJavaTypeProvider.nullType);
   if (_equals) {
     _or_3 = true;
   } else {
     boolean _conformToLibraryTypes = this.conformToLibraryTypes(c1, c2);
     _or_3 = _conformToLibraryTypes;
   }
   if (_or_3) {
     _or_2 = true;
   } else {
     boolean _equals_1 = Objects.equal(c1, c2);
     _or_2 = _equals_1;
   }
   if (_or_2) {
     _or_1 = true;
   } else {
     QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(c2);
     String _string = _fullyQualifiedName.toString();
     boolean _equals_2 = Objects.equal(_string, SmallJavaLib.LIB_OBJECT);
     _or_1 = _equals_2;
   }
   if (_or_1) {
     _or = true;
   } else {
     boolean _isSubclassOf = this.isSubclassOf(c1, c2);
     _or = _isSubclassOf;
   }
   return _or;
 }
コード例 #2
0
 public String getJavaFileName(IEObjectDescription description) {
   if (!isJvmDeclaredType(description)) {
     return null;
   }
   QualifiedName typeName = description.getName();
   return Strings.concat("/", typeName.getSegments()) + ".java";
 }
コード例 #3
0
 @Override
 public String getDisplayString(
     final EObject element, final String givenQualifiedNameAsString, final String shortName) {
   String qualifiedNameAsString = givenQualifiedNameAsString;
   boolean _equals = Objects.equal(qualifiedNameAsString, null);
   if (_equals) {
     qualifiedNameAsString = shortName;
   }
   boolean _equals_1 = Objects.equal(qualifiedNameAsString, null);
   if (_equals_1) {
     boolean _notEquals = (!Objects.equal(element, null));
     if (_notEquals) {
       ILabelProvider _labelProvider = this.getLabelProvider();
       String _text = _labelProvider.getText(element);
       qualifiedNameAsString = _text;
     } else {
       return null;
     }
   }
   if ((!(element instanceof MobaApplication))) {
     IQualifiedNameConverter _qualifiedNameConverter = this.getQualifiedNameConverter();
     final QualifiedName qualifiedName =
         _qualifiedNameConverter.toQualifiedName(qualifiedNameAsString);
     int _segmentCount = qualifiedName.getSegmentCount();
     boolean _greaterThan = (_segmentCount > 1);
     if (_greaterThan) {
       String _lastSegment = qualifiedName.getLastSegment();
       String _plus = (_lastSegment + " - ");
       return (_plus + qualifiedNameAsString);
     }
   }
   return qualifiedNameAsString;
 }
コード例 #4
0
  public String getJavaStubSource(IEObjectDescription description) {
    if (!isJvmDeclaredType(description)) {
      return null;
    }
    QualifiedName qualifiedName = description.getQualifiedName();

    StringBuilder classSignatureBuilder = new StringBuilder();
    if (qualifiedName.getSegments().size() > 1) {
      String string = qualifiedName.toString();
      classSignatureBuilder.append("package " + string.substring(0, string.lastIndexOf('.')) + ";");
      classSignatureBuilder.append("\n");
    }
    classSignatureBuilder.append("public ");
    if (description.getEClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) {
      if (description.getUserData(JvmTypesResourceDescriptionStrategy.IS_INTERFACE) != null) {
        classSignatureBuilder.append("interface ");
      } else {
        classSignatureBuilder.append("class ");
      }
    } else if (description.getEClass() == TypesPackage.Literals.JVM_ENUMERATION_TYPE) {
      classSignatureBuilder.append("enum ");
    } else if (description.getEClass() == TypesPackage.Literals.JVM_ANNOTATION_TYPE) {
      classSignatureBuilder.append("@interface ");
    }
    classSignatureBuilder.append(qualifiedName.getLastSegment());
    String typeParameters =
        description.getUserData(JvmTypesResourceDescriptionStrategy.TYPE_PARAMETERS);
    if (typeParameters != null) {
      classSignatureBuilder.append(typeParameters);
    }
    classSignatureBuilder.append("{}");
    return classSignatureBuilder.toString();
  }
コード例 #5
0
  public QualifiedName getFullyQualifiedName(EObject obj) {
    QualifiedName partialQualifiedName = null;
    if (obj instanceof DomainDeclaration) {
      DomainDeclaration d = (DomainDeclaration) obj;
      partialQualifiedName = toQualifiedName(d.getName());
    } else if (obj instanceof ResourceInteractionModel) {
      ResourceInteractionModel r = (ResourceInteractionModel) obj;
      partialQualifiedName = toQualifiedName(r.getName());
    } else if (obj instanceof State) {
      State s = (State) obj;
      partialQualifiedName = toQualifiedName(s.getName());
    } else if (obj instanceof Event) {
      Event e = (Event) obj;
      partialQualifiedName = toQualifiedName(e.getName());
    } else if (obj instanceof Command) {
      Command c = (Command) obj;
      partialQualifiedName = toQualifiedName(c.getName());
    } else if (obj instanceof Relation) {
      Relation r = (Relation) obj;
      partialQualifiedName = toQualifiedName(r.getName());
    } else {
      return null;
    }

    if (partialQualifiedName != null) {
      EObject parent = obj.eContainer();
      QualifiedName parentsQualifiedName = getFullyQualifiedName(parent);
      if (parentsQualifiedName != null)
        partialQualifiedName = parentsQualifiedName.append(partialQualifiedName);
    }

    return partialQualifiedName;
  }
コード例 #6
0
 @Test
 public void testGetElementByName_03() {
   IEObjectDescription objectElement =
       getTypeScope().getSingleElement(QualifiedName.create(int.class.getName()));
   assertNotNull(objectElement);
   assertFalse(objectElement.getEObjectOrProxy().eIsProxy());
   assertEquals(QualifiedName.create("int"), objectElement.getName());
 }
コード例 #7
0
 @Override
 public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node)
     throws IllegalNodeException {
   try {
     depth++;
     String text = getText(node);
     boolean traceLookup = BaseScopeProvider.LOOKUP.isActive();
     if ((text == null) || "".equals(text)) { // Avoid IQualifiedNameConverter IAE
       if (traceLookup) {
         BaseScopeProvider.LOOKUP.println("" + depth + " Lookup null");
       }
       return Collections.emptyList();
     }
     IScope scope = getScope(context, ref);
     if (traceLookup) {
       //				EObject target = ((ScopeView)scope).getTarget();
       //				String inString = target instanceof ElementCS ? ((ElementCS)target).getSignature() :
       // target.toString();
       //				BaseScopeProvider.LOOKUP.println("" + depth + " Lookup " + text + " in " + inString);
       BaseScopeProvider.LOOKUP.println("" + depth + " Lookup " + text);
     }
     if (scope == null) {
       return Collections.emptyList();
     }
     QualifiedName qualifiedName = QualifiedName.create(text);
     List<EObject> linkedObjects = lookUp(scope, qualifiedName);
     if ((linkedObjects.size() <= 0) && text.startsWith("_")) { // Deprecated compatibility
       linkedObjects = lookUp(scope, QualifiedName.create(text.substring(1)));
     }
     if (traceLookup) {
       BaseScopeProvider.LOOKUP.println("" + depth + " Lookup " + text + " failed");
     }
     List<Adapter> eAdapters = context.eAdapters();
     Adapter adapter = EcoreUtil.getAdapter(eAdapters, ExceptionAdapter.class);
     if (adapter != null) {
       eAdapters.remove(adapter);
     }
     if (linkedObjects.size() > 1) {
       if (DEBUG_RETRY.isActive()) {
         scope.getElements(qualifiedName);
       }
       AmbiguitiesAdapter.setAmbiguities(context, linkedObjects);
       return Collections.emptyList();
     }
     if (linkedObjects.size() <= 0) {
       if (DEBUG_RETRY.isActive()) {
         scope.getElements(qualifiedName);
       }
     }
     return linkedObjects;
   } catch (IllegalLibraryException e) {
     context.eAdapters().add(new ExceptionAdapter(e));
     return Collections.emptyList();
   } finally {
     depth--;
   }
 }
コード例 #8
0
 public static ImportNormalizer createNestedTypeAwareImportNormalizer(
     QualifiedName importedNamespace, boolean wildcard, boolean ignoreCase) {
   for (int i = 0; i < importedNamespace.getSegmentCount(); i++) {
     if (importedNamespace.getSegment(i).indexOf('$') >= 0) {
       return new NestedTypeAwareImportNormalizer(importedNamespace, wildcard, ignoreCase);
     }
   }
   return new NestedTypeAwareImportNormalizerWithDotSeparator(
       importedNamespace, wildcard, ignoreCase);
 }
コード例 #9
0
 @Override
 protected JvmType findNestedType(JvmType result, int index, QualifiedName name) {
   if (result.eContainer() instanceof JvmDeclaredType && name.getSegmentCount() == 1) {
     QualifiedName importName = importNames.get(index);
     if (importName != null && importName.getLastSegment().equals(name.getFirstSegment())) {
       return result;
     }
   }
   return super.findNestedType(result, index, name);
 }
コード例 #10
0
 @Override
 protected void doGetDescriptions(
     JvmType type, JvmType knownType, int i, List<IEObjectDescription> result) {
   super.doGetDescriptions(type, knownType, i, result);
   QualifiedName importName = importNames.get(i);
   if (type == knownType && importName != null) {
     result.add(
         EObjectDescription.create(QualifiedName.create(importName.getLastSegment()), type));
   }
 }
コード例 #11
0
ファイル: PPFinder.java プロジェクト: swung/geppetto
 public List<IEObjectDescription> findHostClasses(
     EObject scopeDetermeningResource, String name, PPImportedNamesAdapter importedNames) {
   if (name == null) throw new IllegalArgumentException("name is null");
   QualifiedName fqn = converter.toQualifiedName(name);
   // make last segments initial char lower case (for references to the type itself - eg. 'File'
   // instead of
   // 'file'.
   fqn = fqn.skipLast(1).append(toInitialLowerCase(fqn.getLastSegment()));
   return findExternal(scopeDetermeningResource, fqn, importedNames, false, CLASS_AND_TYPE);
 }
コード例 #12
0
 public String nameOf(final String operationName) {
   String _xblockexpression = null;
   {
     final JvmOperation op = this.operations.get(operationName);
     QualifiedName _apply = this.subject.apply(op);
     String _string = _apply.toString();
     _xblockexpression = (_string);
   }
   return _xblockexpression;
 }
コード例 #13
0
 /**
  * Creates the fully qualified name for eObj which have simple names.
  *
  * @param eObj
  * @return
  */
 protected QualifiedName internalQualifiedName(EObject eObj) {
   String simpleName = simpleNameProvider.getName(eObj);
   if (simpleName != null) {
     QualifiedName qualifier = getQualifier(eObj);
     if (qualifier != null) {
       return qualifier.append(simpleName);
     }
     return QualifiedName.create(simpleName);
   }
   return null;
 }
コード例 #14
0
 protected QualifiedName resolveWildcard(QualifiedName relativeName) {
   int segmentCount = relativeName.getSegmentCount();
   if (segmentCount == 1) {
     return getImportedNamespacePrefix().append(relativeName);
   }
   for (int i = 0; i < segmentCount; i++) {
     if (relativeName.getSegment(i).indexOf('$') != -1) {
       return null;
     }
   }
   return getImportedNamespacePrefix().append(relativeName.toString("$"));
 }
 public boolean conformsToString(final SJClass c) {
   boolean _or = false;
   boolean _equals = Objects.equal(c, SmallJavaTypeProvider.stringType);
   if (_equals) {
     _or = true;
   } else {
     QualifiedName _fullyQualifiedName = this._iQualifiedNameProvider.getFullyQualifiedName(c);
     String _string = _fullyQualifiedName.toString();
     boolean _equals_1 = Objects.equal(_string, SmallJavaLib.LIB_STRING);
     _or = _equals_1;
   }
   return _or;
 }
コード例 #16
0
 protected Map<String, QualifiedName> getImplicitAliases() {
   if (implicitAliases == null) {
     implicitAliases = newHashMap();
     for (final EDataType eDataType : XcoreImportedNamespaceAwareScopeProvider.IMPLICIT_ALIASES) {
       String instanceClassName = eDataType.getInstanceClassName();
       final QualifiedName actualQualifiedName =
           QualifiedName.create("org", "eclipse", "emf", "ecore", eDataType.getName());
       final QualifiedName qualifiedName = nameConverter.toQualifiedName(instanceClassName);
       implicitAliases.put(instanceClassName, actualQualifiedName);
       implicitAliases.put(qualifiedName.getLastSegment(), actualQualifiedName);
     }
   }
   return implicitAliases;
 }
コード例 #17
0
 public Set<QualifiedName> getImportedNames(XtextResource resource) {
   XPackage xPackage = getXPackage(resource);
   String packageName = xPackage.getName();
   List<String> implicitPackageImports = newArrayList(packageName, "java.lang");
   Set<QualifiedName> importedNames = newLinkedHashSet();
   Map<String, QualifiedName> implicitAliases = getImplicitAliases();
   for (INode node : XcoreUtil.importableCrossReferences(xPackage)) {
     CrossReference grammarElement = (CrossReference) node.getGrammarElement();
     EObject container = grammarElement.eContainer();
     if (container instanceof Assignment) {
       String name = node.getText().trim();
       if (name.endsWith("::")) {
         name = name.substring(0, name.length() - 2);
       }
       QualifiedName actualQualifiedName = nameConverter.toQualifiedName(name);
       Assignment assignment = (Assignment) container;
       String feature = assignment.getFeature();
       EObject semanticObject = NodeModelUtils.findActualSemanticObjectFor(node);
       EStructuralFeature eStructuralFeature =
           semanticObject.eClass().getEStructuralFeature(feature);
       if (!eStructuralFeature.isMany()) {
         EObject eCrossReference = (EObject) semanticObject.eGet(eStructuralFeature);
         EObject eContainer = eCrossReference.eContainer();
         if (eContainer != xPackage
             && !(eContainer instanceof XPackage
                 && "xcore.lang".equals(((XPackage) eContainer).getName()))
             && !(eContainer instanceof GenPackage
                 && packageName.equals(((GenPackage) eContainer).getQualifiedPackageName()))
             && !(eCrossReference instanceof JvmDeclaredType
                 && implicitPackageImports.contains(
                     ((JvmDeclaredType) eCrossReference).getPackageName()))) {
           QualifiedName fullyQualifiedName = nameProvider.getFullyQualifiedName(eCrossReference);
           if (fullyQualifiedName != null
               && !actualQualifiedName.equals(fullyQualifiedName)
               && !fullyQualifiedName.equals(implicitAliases.get(name))) {
             importedNames.add(fullyQualifiedName);
           }
         }
       } else {
         throw new RuntimeException("Not expecting multi-valued cross references in these models");
       }
     } else {
       throw new RuntimeException(
           "Expecting all cross references to be part of an assignment in these models");
     }
   }
   return importedNames;
 }
コード例 #18
0
 protected IScope createLocalVarScopeForJvmDeclaredType(JvmDeclaredType type, IScope parentScope) {
   Iterator<JvmTypeReference> classes =
       filter(
               type.getSuperTypes(),
               new Predicate<JvmTypeReference>() {
                 public boolean apply(JvmTypeReference input) {
                   if (input.getType() instanceof JvmGenericType) {
                     return !((JvmGenericType) input.getType()).isInterface();
                   }
                   return false;
                 }
               })
           .iterator();
   JvmGenericType superType = null;
   if (classes.hasNext()) {
     superType = (JvmGenericType) classes.next().getType();
   }
   if (superType == null) {
     return new JvmFeatureScope(parentScope, "this", new LocalVarDescription(THIS, type));
   } else {
     return new JvmFeatureScope(
         parentScope,
         "this & super",
         newArrayList(
             new LocalVarDescription(THIS, type),
             new LocalVarDescription(QualifiedName.create("super"), superType)));
   }
 }
コード例 #19
0
 protected synchronized void executeRules(Iterable<Rule> rules, State oldState) {
   for (Rule rule : rules) {
     RuleEvaluationContext context = new RuleEvaluationContext();
     context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_PREVIOUS_STATE), oldState);
     executeRule(rule, context);
   }
 }
コード例 #20
0
 protected synchronized void executeRules(Iterable<Rule> rules, Command command) {
   for (Rule rule : rules) {
     RuleEvaluationContext context = new RuleEvaluationContext();
     context.newValue(QualifiedName.create(RulesJvmModelInferrer.VAR_RECEIVED_COMMAND), command);
     executeRule(rule, context);
   }
 }
コード例 #21
0
 private ICommand createSubmachineStateCommand(ConfigureRequest req) {
   SelectSubmachineDialog dialog =
       new SelectSubmachineDialog(new Shell(), req.getElementToConfigure().eResource());
   dialog.setElements(new Object[] {req.getElementToConfigure()});
   if (Dialog.OK == dialog.open()) {
     QualifiedName selectedSubmachine = dialog.getSelectedSubmachine();
     if (selectedSubmachine != null) {
       return new SetValueCommand(
           new SetRequest(
               req.getElementToConfigure(),
               SGraphPackage.Literals.STATE__SUBSTATECHART_ID,
               selectedSubmachine.toString()));
     }
   }
   return null;
 }
コード例 #22
0
 protected IScope getExecutableScope(XAbstractFeatureCall call, JvmIdentifiableElement feature) {
   QualifiedName name = QualifiedName.create(feature.getSimpleName());
   if (call.isOperation()) {
     QualifiedName operator = getOperator(call, name);
     if (operator == null) {
       return IScope.NULLSCOPE;
     }
     return new SingletonScope(EObjectDescription.create(operator, feature), IScope.NULLSCOPE);
   }
   if (call instanceof XAssignment) {
     String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3));
     return new SingletonScope(EObjectDescription.create(propertyName, feature), IScope.NULLSCOPE);
   }
   if (call.isExplicitOperationCallOrBuilderSyntax()
       || ((JvmExecutable) feature).getParameters().size() > 1
       || (!call.isExtension() && ((JvmExecutable) feature).getParameters().size() == 1)) {
     return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE);
   }
   if (feature.getSimpleName().startsWith("get") || feature.getSimpleName().startsWith("is")) {
     List<IEObjectDescription> result = Lists.newArrayListWithCapacity(2);
     result.add(EObjectDescription.create(name, feature));
     if (feature.getSimpleName().startsWith("get")) {
       String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(3));
       result.add(EObjectDescription.create(propertyName, feature));
     } else {
       String propertyName = Strings.toFirstLower(feature.getSimpleName().substring(2));
       result.add(EObjectDescription.create(propertyName, feature));
     }
     return new SimpleScope(result);
   }
   return new SingletonScope(EObjectDescription.create(name, feature), IScope.NULLSCOPE);
 }
コード例 #23
0
 @Test
 public void testGetElementByName_02() {
   IEObjectDescription objectElement =
       getTypeScope()
           .getSingleElement(QualifiedName.create(Object.class.getName() + "SuperClass"));
   assertNull(objectElement);
 }
コード例 #24
0
  @Override
  public Object evaluate(ExpressionContext context) throws ExpressionExecutionException {
    Object thisElement = null;
    IEvaluationContext evaluationContext = contextProvider.get();
    evaluationContext.newValue(XbaseScopeProvider.THIS, thisElement);

    if (context != null) {
      for (String elementName : context.getVariableNames()) {
        Object instance = context.getInstance(elementName);
        if (instance == null && context instanceof DynamicExpressionContext) {
          instance = ((DynamicExpressionContext) context).getDynInstance(elementName);
        }
        if (instance != null) {
          evaluationContext.newValue(QualifiedName.create(elementName), instance);
        }
      }
    } else {
      context = new ExpressionContext();
    }

    IEvaluationResult result =
        elInterpreter.evaluate(xExpression, evaluationContext, CancelIndicator.NullImpl);
    if (result.getException() != null) {
      throw new ExpressionExecutionException("Boo!", result.getException());
    }
    return result.getResult();
  }
コード例 #25
0
 protected Object _addToScope(final EventDefinition event) {
   Object _xblockexpression = null;
   {
     QualifiedName _qualifiedName = this.provider.qualifiedName(event);
     String _string = _qualifiedName.toString();
     String fqName = _string;
     Type _type = event.getType();
     boolean _isBoolean = this.isBoolean(_type);
     if (_isBoolean) {
       ExecutionEvent _executionEvent = new ExecutionEvent(fqName, java.lang.Boolean.class, null);
       this.executionContext.declareEvent(_executionEvent);
     } else {
       Type _type_1 = event.getType();
       boolean _isInteger = this.isInteger(_type_1);
       if (_isInteger) {
         ExecutionEvent _executionEvent_1 =
             new ExecutionEvent(fqName, java.lang.Integer.class, null);
         this.executionContext.declareEvent(_executionEvent_1);
       } else {
         Type _type_2 = event.getType();
         boolean _isReal = this.isReal(_type_2);
         if (_isReal) {
           ExecutionEvent _executionEvent_2 =
               new ExecutionEvent(fqName, java.lang.Float.class, null);
           this.executionContext.declareEvent(_executionEvent_2);
         } else {
           Type _type_3 = event.getType();
           boolean _isVoid = this.isVoid(_type_3);
           if (_isVoid) {
             ExecutionEvent _executionEvent_3 = new ExecutionEvent(fqName, java.lang.Void.class);
             this.executionContext.declareEvent(_executionEvent_3);
           } else {
             Type _type_4 = event.getType();
             boolean _isString = this.isString(_type_4);
             if (_isString) {
               ExecutionEvent _executionEvent_4 =
                   new ExecutionEvent(fqName, java.lang.String.class, "");
               this.executionContext.declareEvent(_executionEvent_4);
             }
           }
         }
       }
     }
     _xblockexpression = (null);
   }
   return _xblockexpression;
 }
コード例 #26
0
 /**
  * Creates the namespace for the root object.
  *
  * @param lObj
  * @return
  */
 protected QualifiedName qualifiedName(QObject lObj) {
   if (lObj.eContainer() == null) {
     String namespace = getNamespace(lObj);
     if (namespace != null) {
       QualifiedName qualifiedNameForNamespace = QualifiedName.create(namespace.split("\\."));
       String simpleName = simpleNameProvider.getName(lObj);
       if (simpleName != null) {
         return qualifiedNameForNamespace.append(simpleName);
       } else {
         return qualifiedNameForNamespace;
       }
     }
   } else {
     return internalQualifiedName(lObj);
   }
   return null;
 }
コード例 #27
0
 protected IEObjectDescription doGetSingleElement(QualifiedName name) {
   String firstSegment = name.getFirstSegment();
   int dollar = firstSegment.indexOf('$');
   if (dollar > 0) {
     firstSegment = firstSegment.substring(0, dollar);
   }
   return doGetSingleElement(name, firstSegment, dollar);
 }
コード例 #28
0
ファイル: PPFinder.java プロジェクト: swung/geppetto
  public List<IEObjectDescription> findDefinitions(
      EObject scopeDetermeningResource, String name, PPImportedNamesAdapter importedNames) {
    if (name == null) throw new IllegalArgumentException("name is null");
    QualifiedName fqn = converter.toQualifiedName(name);
    // make all segments initial char lower case (if references is to the type itself - eg. 'File'
    // instead of
    // 'file', or 'Aa::Bb' instead of 'aa::bb'
    QualifiedName fqn2 = QualifiedName.EMPTY;
    for (int i = 0; i < fqn.getSegmentCount(); i++)
      fqn2 = fqn2.append(toInitialLowerCase(fqn.getSegment(i)));
    // fqn2 = fqn.skipLast(1).append(toInitialLowerCase(fqn.getLastSegment()));

    // TODO: Note that order is important, TYPE has higher precedence and should be used for linking
    // This used to work when list was iterated per type, not it is iterated once with type check
    // first - thus if a definition is found before a type, it is earlier in the list.
    return findExternal(scopeDetermeningResource, fqn2, importedNames, false, DEF_AND_TYPE);
  }
コード例 #29
0
 @Test
 public void testGetElementByName_01() {
   IEObjectDescription objectElement =
       getTypeScope().getSingleElement(QualifiedName.create(Object.class.getName()));
   assertNotNull(objectElement);
   assertFalse(objectElement.getEObjectOrProxy().eIsProxy());
   assertEquals("java.lang.Object", objectElement.getName().toString());
 }
コード例 #30
0
 public void testBug350695() throws Exception {
   Resource res =
       getResource(
           new StringInputStream("grammar org.foo.Zonk generate x \"someURI\" Start : 'main';"),
           URI.createURI("foo.xtext"));
   Manager manager = get(IResourceDescription.Manager.class);
   IResourceDescription description = manager.getResourceDescription(res);
   assertTrue(
       Iterables.isEmpty(
           description.getExportedObjects(
               XtextPackage.Literals.GRAMMAR, QualifiedName.create("org.foo.Zonk"), false)));
   IEObjectDescription element =
       Iterables.getOnlyElement(
           description.getExportedObjects(
               XtextPackage.Literals.GRAMMAR, QualifiedName.create("org", "foo", "Zonk"), false));
   assertNotNull(element);
 }