コード例 #1
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);
 }