Esempio n. 1
0
 /**
  * This method serves as an entry point for the content assist scoping for simple feature calls.
  *
  * @param context the context e.g. a for loop expression, a block or a catch clause
  * @param reference the reference who's value shall be scoped. Not necessarily a feature of the
  *     context.
  * @param includeCurrentBlock <code>false</code> in the context of scoping but content assist will
  *     not have the actual value holder of the reference at hand so it passes its container to
  *     this method and expects the declared variables to be exposed in the scope.
  * @param idx the index in an expression list of a block. Otherwise to be ignored.
  */
 public IScope createSimpleFeatureCallScope(
     final EObject context,
     EReference reference,
     Resource resource,
     boolean includeCurrentBlock,
     int idx) {
   if (context instanceof XFeatureCall) {
     XFeatureCall featureCall = (XFeatureCall) context;
     if (featureCall.getDeclaringType() != null) {
       JvmParameterizedTypeReference typeReference =
           typeReferences.createTypeRef(featureCall.getDeclaringType());
       JvmFeatureScope result =
           createFeatureScopeForTypeRef(
               typeReference, context, getContextType(context), null, IScope.NULLSCOPE);
       return result;
     }
   }
   IScope staticScope = createStaticScope(context, resource, IScope.NULLSCOPE);
   DelegatingScope delegatingStaticScope = new DelegatingScope(IScope.NULLSCOPE);
   DelegatingScope implicitThis = new DelegatingScope(delegatingStaticScope);
   LocalVariableScopeContext scopeContext =
       createLocalVariableScopeContext(context, reference, includeCurrentBlock, idx);
   IScope localVariableScope = createLocalVarScope(implicitThis, scopeContext);
   IScope scopeForImplicitFeatures =
       createImplicitFeatureCallScope(context, IScope.NULLSCOPE, localVariableScope);
   implicitThis.setDelegate(scopeForImplicitFeatures);
   delegatingStaticScope.setDelegate(staticScope);
   return localVariableScope;
 }
  protected String _case(
      JvmField input,
      XFeatureCall context,
      EReference reference,
      JvmFeatureDescription jvmFeatureDescription) {
    if (context.getDeclaringType() == null) {
      if (input.isStatic()) return INSTANCE_ACCESS_TO_STATIC_MEMBER;
    } else {
      if (!input.isStatic()) return STATIC_ACCESS_TO_INSTANCE_MEMBER;
    }
    if (context.isExplicitOperationCall()) return FIELD_ACCESS_WITH_PARENTHESES;

    return null;
  }
 protected String _case(
     JvmOperation input,
     XFeatureCall context,
     EReference reference,
     JvmFeatureDescription jvmFeatureDescription) {
   if (context.getDeclaringType() != null) {
     if (!input.isStatic()) return STATIC_ACCESS_TO_INSTANCE_MEMBER;
   }
   return checkJvmOperation(
       input,
       context,
       context.isExplicitOperationCall(),
       jvmFeatureDescription,
       context.getFeatureCallArguments());
 }