コード例 #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
 public void addLibContents(
     org.eclipse.ocl.pivot.@NonNull Class libType, @NonNull ScopeView scopeView) {
   addElementsOfScope(libType, scopeView);
   for (org.eclipse.ocl.pivot.Class superClass : libType.getSuperClasses()) {
     if (superClass != null) {
       addLibContents(superClass, scopeView);
     }
   }
 }
コード例 #3
0
 public void computeQualifiedLookups(@NonNull Element target) {
   ScopeView parentScopeView = new PivotScopeView(environmentFactory, target, null, true);
   addElementsOfScope(target, parentScopeView);
 }