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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
*
* 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:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*****************************************************************************/
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.MoveRequest;
import org.eclipse.papyrus.uml.service.types.command.NotContainmentMoveCommand;
public class ActivityHelper extends ElementEditHelper {
@Override
protected ICommand getMoveCommand(MoveRequest req) {
return new NotContainmentMoveCommand(req);
}
// {
// getDefaultContainmentFeatures().put(UMLPackage.eINSTANCE.getCentralBufferNode(), UMLPackage.eINSTANCE.getActivity_OwnedNode());
// }
//
// @Override
// protected ICommand getCreateCommand(CreateElementRequest req) {
// return super.getCreateCommand(req);
// // return new CreateActivityNode(req);
// }
//
//
// /**
// * this inner class is used to call specific command of UML
// *
// */
// private class CreateActivityNode extends CreateElementCommand{
//
// protected Command emfcmd=null;
// public CreateActivityNode(CreateElementRequest request) {
// super(request);
// }
// @Override
// protected EObject doDefaultElementCreation() {
// EObject result = null;
// EReference containment = getContainmentFeature();
// EClass eClass = getElementType().getEClass();
//
// if (containment != null) {
// EObject element = getElementToEdit();
// if (element != null) {
// result = eClass.getEPackage().getEFactoryInstance().create(eClass);
// //Command cmd=new CreateChildCommand(getRequest().getEditingDomain(), element, UMLPackage.eINSTANCE.getActivity_OwnedNode(), UMLFactory.eINSTANCE.createOpaqueAction(), Collections.EMPTY_LIST);
// emfcmd= new CreateChildCommand(getRequest().getEditingDomain(),element, containment, result, Collections.EMPTY_LIST);
// emfcmd.canExecute();
// emfcmd.execute();
// if(!emfcmd.getResult().isEmpty()){
// result=(EObject)emfcmd.getResult().toArray()[0];
// }
// }
// }
//
// IStatus status = (result != null) ? Status.OK_STATUS
// : new Status(
// Status.ERROR,
// EMFTypePlugin.getPluginId(),
// EMFTypeCoreMessages
// .bind(
// EMFTypeCoreMessages.createElementCommand_noElementCreated,
// getElementType().getDisplayName()));
//
// setDefaultElementCreationStatus(status);
//
// return result;
// }
// @Override
// protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
// emfcmd.undo();
// return super.doUndo(monitor, info);
// }
//
// @Override
// protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
//
// IStatus status= super.doRedo(monitor, info);
// emfcmd.redo();
// return status;
// }
// }
//
//
}
|