| /** |
| * <copyright> |
| * |
| * Copyright (c) 2010,2011 E.D.Willink and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| * |
| * </copyright> |
| * |
| * $Id: OperationCallExpAttribution.java,v 1.3 2011/04/20 19:02:27 ewillink Exp $ |
| */ |
| package org.eclipse.ocl.examples.pivot.attributes; |
| |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.ocl.examples.pivot.OclExpression; |
| import org.eclipse.ocl.examples.pivot.OperationCallExp; |
| import org.eclipse.ocl.examples.pivot.PivotPackage; |
| import org.eclipse.ocl.examples.pivot.scoping.AbstractAttribution; |
| import org.eclipse.ocl.examples.pivot.scoping.EnvironmentView; |
| import org.eclipse.ocl.examples.pivot.scoping.ScopeView; |
| |
| public class OperationCallExpAttribution extends AbstractAttribution |
| { |
| public static final OperationCallExpAttribution INSTANCE = new OperationCallExpAttribution(); |
| |
| @Override |
| public ScopeView computeLookup(EObject target, EnvironmentView environmentView, ScopeView scopeView) { |
| OperationCallExp targetExpression = (OperationCallExp)target; |
| EStructuralFeature containmentFeature = scopeView.getContainmentFeature(); |
| if (containmentFeature == PivotPackage.Literals.OPERATION_CALL_EXP__ARGUMENT) { |
| OclExpression source = targetExpression.getSource(); |
| environmentView.addElementsOfScope(source.getType(), scopeView); |
| } |
| return scopeView.getParent(); |
| } |
| } |