Example #1
0
 private IScope scope_TextPropertyAssignment_Attribute(EObject context) {
   NodeElement nodeElement = EcoreUtil2.getContainerOfType(context, NodeElement.class);
   EdgeElement edgeElement = EcoreUtil2.getContainerOfType(context, EdgeElement.class);
   if (nodeElement != null || edgeElement != null) {
     Predicate<EObject> filterPredicate =
         new Predicate<EObject>() {
           @Override
           public boolean apply(EObject input) {
             if (input instanceof EAttribute) {
               if (((EAttribute) input).getEType().getName().equals("EString")) {
                 return true;
               }
             }
             return false;
           }
         };
     if (nodeElement != null) {
       return MapBasedScope.createScope(
           IScope.NULLSCOPE,
           Scopes.scopedElementsFor(
               Iterables.filter(nodeElement.getType().getEAllAttributes(), filterPredicate)));
     } else {
       return MapBasedScope.createScope(
           IScope.NULLSCOPE,
           Scopes.scopedElementsFor(
               Iterables.filter(edgeElement.getType().getEAllAttributes(), filterPredicate)));
     }
   } else {
     return IScope.NULLSCOPE;
   }
 }
Example #2
0
 private IScope scope_EdgeBehaviorSection_source(EObject context, EReference reference) {
   final EdgeElement edgeElement = EcoreUtil2.getContainerOfType(context, EdgeElement.class);
   // filter derived and 'from' from the possible references
   Iterable<EReference> targetReferences =
       Iterables.filter(
           edgeElement.getType().getEAllReferences(),
           new Predicate<EReference>() {
             @Override
             public boolean apply(EReference input) {
               return !input.isDerived();
             }
           });
   final IScope result =
       MapBasedScope.createScope(IScope.NULLSCOPE, Scopes.scopedElementsFor(targetReferences));
   return result;
 }