Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 403440 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ast/env/QvtOperationalEnv.java (-4 / +4 lines)
Lines 8-14 Link Here
8
 *   
8
 *   
9
 * Contributors:
9
 * Contributors:
10
 *     Borland Software Corporation - initial API and implementation
10
 *     Borland Software Corporation - initial API and implementation
11
 *     Alex Paperno - bugs 416584, 401521
11
 *     Alex Paperno - bugs 416584, 401521, 403440
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.m2m.internal.qvt.oml.ast.env;
13
package org.eclipse.m2m.internal.qvt.oml.ast.env;
14
14
Lines 258-264 Link Here
258
		return TypeUtil.findOperationMatching(this, owner, name, args);
258
		return TypeUtil.findOperationMatching(this, owner, name, args);
259
	}
259
	}
260
	
260
	
261
    public List<EOperation> lookupMappingOperations(EClassifier owner, String name) {
261
    public List<MappingOperation> lookupMappingOperations(EClassifier owner, String name) {
262
        if (owner == null) {
262
        if (owner == null) {
263
            owner = getModuleContextType();
263
            owner = getModuleContextType();
264
            if(owner == null) {
264
            if(owner == null) {
Lines 268-277 Link Here
268
268
269
        UMLReflection<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction, Constraint> uml = getUMLReflection();
269
        UMLReflection<EPackage, EClassifier, EOperation, EStructuralFeature, EEnumLiteral, EParameter, EObject, CallOperationAction, SendSignalAction, Constraint> uml = getUMLReflection();
270
        List<EOperation> operations = TypeUtil.getOperations(this, owner);
270
        List<EOperation> operations = TypeUtil.getOperations(this, owner);
271
        List<EOperation> result = new ArrayList<EOperation>();
271
        List<MappingOperation> result = new ArrayList<MappingOperation>();
272
		for (EOperation operation : operations) {
272
		for (EOperation operation : operations) {
273
		    if (uml.getName(operation).equals(name) && QvtOperationalUtil.isMappingOperation(operation)) {
273
		    if (uml.getName(operation).equals(name) && QvtOperationalUtil.isMappingOperation(operation)) {
274
		        result.add(operation);
274
		        result.add((MappingOperation)operation);
275
		    }
275
		    }
276
		}
276
		}
277
277
(-)a/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ast/parser/QvtOperationalVisitorCS.java (-11 / +18 lines)
Lines 9-15 Link Here
9
 *     Borland Software Corporation - initial API and implementation
9
 *     Borland Software Corporation - initial API and implementation
10
 *     Christopher Gerking - bugs 302594, 310991
10
 *     Christopher Gerking - bugs 302594, 310991
11
 *     Alex Paperno - bugs 272869, 268636, 404647, 414363, 414363, 401521,
11
 *     Alex Paperno - bugs 272869, 268636, 404647, 414363, 414363, 401521,
12
 *                         419299 
12
 *                         419299, 403440 
13
 *******************************************************************************/
13
 *******************************************************************************/
14
package org.eclipse.m2m.internal.qvt.oml.ast.parser;
14
package org.eclipse.m2m.internal.qvt.oml.ast.parser;
15
15
Lines 3725-3732 Link Here
3725
	/**
3725
	/**
3726
	 * TODO - make a common resolution operation, reusable in for ResolveInExp too. 
3726
	 * TODO - make a common resolution operation, reusable in for ResolveInExp too. 
3727
	 */
3727
	 */
3728
	private List<EOperation> resolveMappingOperationReference(ScopedNameCS identifierCS, QvtOperationalEnv env) {
3728
	private List<MappingOperation> resolveMappingOperationReference(ScopedNameCS identifierCS, QvtOperationalEnv env) {
3729
		List<EOperation> result = Collections.emptyList();
3729
		List<MappingOperation> result = Collections.emptyList();
3730
		
3730
		
3731
		TypeCS typeCS = identifierCS.getTypeCS();
3731
		TypeCS typeCS = identifierCS.getTypeCS();
3732
		EClassifier owningType = null;		
3732
		EClassifier owningType = null;		
Lines 3742-3749 Link Here
3742
		}
3742
		}
3743
		// filter out inherited mappings
3743
		// filter out inherited mappings
3744
		if(!result.isEmpty()) {
3744
		if(!result.isEmpty()) {
3745
			List<EOperation> ownerLocalOpers = new ArrayList<EOperation>(result.size());
3745
			List<MappingOperation> ownerLocalOpers = new ArrayList<MappingOperation>(result.size());
3746
	        for (EOperation operation : result) {
3746
	        for (MappingOperation operation : result) {
3747
	            EClassifier owner = env.getUMLReflection().getOwningClassifier(operation);
3747
	            EClassifier owner = env.getUMLReflection().getOwningClassifier(operation);
3748
	            if ((typeCS == null && owner == null) || (TypeUtil.resolveType(env, owner) == owningType)) {
3748
	            if ((typeCS == null && owner == null) || (TypeUtil.resolveType(env, owner) == owningType)) {
3749
	                ownerLocalOpers.add(operation);
3749
	                ownerLocalOpers.add(operation);
Lines 3774-3783 Link Here
3774
				MappingExtensionKindCS kind = extensionCS.getKind();
3774
				MappingExtensionKindCS kind = extensionCS.getKind();
3775
				
3775
				
3776
				for (ScopedNameCS identifierCS : extensionCS.getMappingIdentifiers()) {
3776
				for (ScopedNameCS identifierCS : extensionCS.getMappingIdentifiers()) {
3777
					List<EOperation> mappings = resolveMappingOperationReference(identifierCS, env);
3777
					List<MappingOperation> mappings = resolveMappingOperationReference(identifierCS, env);
3778
					if(mappings.size() == 1) {
3778
					if(mappings.size() == 1) {
3779
						boolean isAdded = false;
3779
						boolean isAdded = false;
3780
						MappingOperation extendedMapping = (MappingOperation)mappings.get(0);
3780
						MappingOperation extendedMapping = mappings.get(0);
3781
						if(kind == MappingExtensionKindCS.INHERITS) {
3781
						if(kind == MappingExtensionKindCS.INHERITS) {
3782
							isAdded = operation.getInherited().add(extendedMapping);
3782
							isAdded = operation.getInherited().add(extendedMapping);
3783
							MappingExtensionHelper.bind2SourceElement(operation, identifierCS, kind);
3783
							MappingExtensionHelper.bind2SourceElement(operation, identifierCS, kind);
Lines 4564-4577 Link Here
4564
        EClassifier eClassifier = (contextTypeCS == null) ? null : visitTypeCS(contextTypeCS, null, env); // mapping context type
4564
        EClassifier eClassifier = (contextTypeCS == null) ? null : visitTypeCS(contextTypeCS, null, env); // mapping context type
4565
        eClassifier = eClassifier != null ? eClassifier : env.getModuleContextType();
4565
        eClassifier = eClassifier != null ? eClassifier : env.getModuleContextType();
4566
        String mappingName = resolveInExpCS.getInMappingName().getValue();
4566
        String mappingName = resolveInExpCS.getInMappingName().getValue();
4567
        List<EOperation> rawMappingOperations = env.lookupMappingOperations(eClassifier, mappingName);
4567
        List<MappingOperation> rawMappingOperations = env.lookupMappingOperations(eClassifier, mappingName);
4568
        List<EOperation> mappingOperations = new ArrayList<EOperation>();
4568
        List<MappingOperation> unfilteredMappingOperations = new ArrayList<MappingOperation>();
4569
        List<MappingOperation> mappingOperations = new ArrayList<MappingOperation>();
4569
        
4570
        
4570
        for (EOperation operation : rawMappingOperations) {
4571
        for (MappingOperation operation : rawMappingOperations) {
4571
            EClassifier owner = env.getUMLReflection().getOwningClassifier(operation);
4572
            EClassifier owner = env.getUMLReflection().getOwningClassifier(operation);
4572
            if (((contextTypeCS == null) && (owner == null))
4573
            if (((contextTypeCS == null) && (owner == null))
4573
                    || (TypeUtil.resolveType(env, owner) == eClassifier)) {
4574
                    || (TypeUtil.resolveType(env, owner) == eClassifier)) {
4574
                mappingOperations.add(operation);
4575
            	unfilteredMappingOperations.add(operation);
4576
            }
4577
        }
4578
        mappingOperations.addAll(unfilteredMappingOperations);
4579
        for (MappingOperation operation : unfilteredMappingOperations) {
4580
            if (unfilteredMappingOperations.contains(operation.getOverridden())) {
4581
            	mappingOperations.remove(operation.getOverridden());
4575
            }
4582
            }
4576
        }
4583
        }
4577
        if (mappingOperations.size() == 1) {
4584
        if (mappingOperations.size() == 1) {

Return to bug 403440