*/
/* (non-Javadoc)
* @see org.eclipse.gef.editpolicies.TreeContainerEditPolicy#getAddCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
*/
protected Command getAddCommand(ChangeBoundsRequest request) {
CompoundCommand command = new CompoundCommand();
List editparts = request.getEditParts();
int index = findIndexOfTreeItemAt(request.getLocation());
for (int i = 0; i < editparts.size(); i++) {
EditPart child = (EditPart) editparts.get(i);
if (isAncestor(child, getHost()))
command.add(UnexecutableCommand.INSTANCE);
else {
if (child.getModel() instanceof IActionElement
&& getHost().getModel() instanceof IActionState) {
IActionElement childModel = (IActionElement) child.getModel();
command.add(createDeleteActionCommand(childModel));
command.add(createCreateActionCommand(childModel, index));//$NON-NLS-1$
}
else if (child.getModel() instanceof IAttributeMapper
&& getHost().getModel() instanceof ISubflowState) {
IAttributeMapper childModel = (IAttributeMapper) child
.getModel();
command.add(createDeleteAttributeMapperCommand(childModel));
command.add(createCreateAttributeMapperCommand(childModel,
index)); //$NON-NLS-1$
}
else if (child.getModel() instanceof IAttribute
&& (getHost().getModel() instanceof IActionElement || getHost()
.getModel() instanceof IState)) {
IAttribute childModel = (IAttribute) child.getModel();
command.add(createDeletePropertyCommand(childModel));
command.add(createCreatePropertyCommand(childModel, index));
}
else if (child.getModel() instanceof IIf
&& getHost().getModel() instanceof IDecisionState) {
IIf childModel = (IIf) child.getModel();
command.add(createDeleteIfCommand(childModel));
command.add(createCreateIfCommand(childModel, index));
}
else if ((child.getModel() instanceof IInputMapper || child.getModel() instanceof IOutputMapper)
&& getHost().getModel() instanceof IAttributeMapper) {
//command.add(createDeleteInputOutputCommand(child.getModel()));
//command.add(createCreateInputOutputCommand(child.getModel()));