コード例 #1
0
 @Override
 public ScopeView computeLookup(
     @NonNull EObject target,
     @NonNull EnvironmentView environmentView,
     @NonNull ScopeView scopeView) {
   if (environmentView.isQualifier()) {
     return scopeView.getParent();
   }
   assert scopeView.getContainmentFeature()
       != PivotPackage.Literals
           .OPERATION_CALL_EXP__OWNED_ARGUMENTS; // Arguments must leapfrog to parent.
   if (NavigationUtil.isNavigationInfixExp(target)) {
     InfixExpCS targetElement = (InfixExpCS) target;
     EObject child = scopeView.getChild();
     ExpCS argument = targetElement.getArgument();
     if ((child == argument) && (child instanceof NameExpCS)) {
       NameExpCS csNameExp = (NameExpCS) child;
       Type sourceTypeValue = csNameExp.getSourceTypeValue();
       if (sourceTypeValue != null) {
         environmentView.addElementsOfScope(
             environmentView.getStandardLibrary().getClassType(), scopeView);
       }
       if (!environmentView.hasFinalResult()) {
         Type type = sourceTypeValue != null ? sourceTypeValue : csNameExp.getSourceType();
         if (type != null) {
           environmentView.addElementsOfScope(type, scopeView);
         }
       }
       return null; // Explicit navigation must be resolved in source
     }
   }
   return scopeView.getParent();
 }
コード例 #2
0
 @Override
 public ScopeView computeLookup(
     @NonNull EObject target,
     @NonNull EnvironmentView environmentView,
     @NonNull ScopeView scopeView) {
   EStructuralFeature containmentFeature = scopeView.getContainmentFeature();
   if (containmentFeature == EssentialOCLCSPackage.Literals.SHADOW_PART_CS__REFERRED_PROPERTY) {
     ShadowPartCS targetElement = (ShadowPartCS) target;
     CurlyBracketedClauseCS csCurlyBracketClause = targetElement.getOwningCurlyBracketClause();
     AbstractNameExpCS csNameExp = csCurlyBracketClause.getOwningNameExp();
     ShadowExp pivot = PivotUtil.getPivot(ShadowExp.class, csNameExp);
     if (pivot != null) {
       Type type = pivot.getType();
       if (type instanceof org.eclipse.ocl.pivot.Class) {
         environmentView.addAllProperties(
             (org.eclipse.ocl.pivot.Class) type, FeatureFilter.SELECT_NON_STATIC);
       }
     }
     return null;
   }
   return scopeView.getParent();
 }