Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0d10c304bc5ab8ac3786b86ae06ea5f6cdb3d1a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.eclipse.papyrus.uml.service.types.helper;

import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.uml2.uml.ActivityPartition;

public class ActivityPartitionEditHelper extends ActivityNodeHelper {
	
	@Override
	protected ICommand getCreateCommand(CreateElementRequest req) {
		return super.getCreateCommand(getCreatePartitionChildRequest(req));
	}
	
	/**
	 * All elements which created in ActivityPartition is contained in Activity. 
	 * ActivityPartition hasn't containment features. 
	 * That's why we need replace ActivityPartion on Activity.
	 * 
	 * @return new CreateElementRequest with Activity as a container for new Element.
	 */
	protected CreateElementRequest getCreatePartitionChildRequest(CreateElementRequest req) {
		if (req == null) {
			return null;
		}
		CreateElementRequest result = new CreateElementRequest(req.getEditingDomain(), findActivity(req.getContainer()), req.getElementType());
		result.setParameter(IN_PARTITION, (ActivityPartition)req.getContainer());
		result.setContainmentFeature(findActivityFeature(req.getElementType().getEClass()));
		return result;
	}
}

Back to the top