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 161574
Collapse All | Expand All

(-)src/org/eclipse/uml2/diagram/activity/view/factories/AcceptEventActionViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class AcceptEventActionViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/AddStructuralFeatureValueActionEditPart.java (+320 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.requests.CreateRequest;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
17
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
18
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
19
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.notation.View;
23
import org.eclipse.uml2.diagram.activity.edit.policies.AddStructuralFeatureValueActionCanonicalEditPolicy;
24
import org.eclipse.uml2.diagram.activity.edit.policies.AddStructuralFeatureValueActionItemSemanticEditPolicy;
25
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
26
27
/**
28
 * @generated
29
 */
30
public class AddStructuralFeatureValueActionEditPart extends AbstractBorderedShapeEditPart {
31
32
	/**
33
	 * @generated
34
	 */
35
	public static final int VISUAL_ID = 2016;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure contentPane;
41
42
	/**
43
	 * @generated
44
	 */
45
	protected IFigure primaryShape;
46
47
	/**
48
	 * @generated
49
	 */
50
	public AddStructuralFeatureValueActionEditPart(View view) {
51
		super(view);
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected void createDefaultEditPolicies() {
58
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
59
		super.createDefaultEditPolicies();
60
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AddStructuralFeatureValueActionItemSemanticEditPolicy());
61
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
62
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new AddStructuralFeatureValueActionCanonicalEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected EditPolicy createChildEditPolicy(EditPart child) {
74
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
75
				if (result == null) {
76
					result = new NonResizableEditPolicy();
77
				}
78
				return result;
79
			}
80
81
			protected Command getMoveChildrenCommand(Request request) {
82
				return null;
83
			}
84
85
			protected Command getCreateCommand(CreateRequest request) {
86
				return null;
87
			}
88
		};
89
		return lep;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected IFigure createNodeShape() {
96
		ActionBaseFigure figure = new ActionBaseFigure();
97
		return primaryShape = figure;
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	public ActionBaseFigure getPrimaryShape() {
104
		return (ActionBaseFigure) primaryShape;
105
	}
106
107
	/**
108
	 * @generated 
109
	 */
110
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
111
		if (editPart instanceof InputPinEditPart) {
112
			return getBorderedFigure().getBorderItemContainer();
113
		}
114
		if (editPart instanceof InputPin2EditPart) {
115
			return getBorderedFigure().getBorderItemContainer();
116
		}
117
		if (editPart instanceof InputPin3EditPart) {
118
			return getBorderedFigure().getBorderItemContainer();
119
		}
120
121
		return super.getContentPaneFor(editPart);
122
	}
123
124
	/**
125
	 * @generated
126
	 */
127
	protected boolean addFixedChild(EditPart childEditPart) {
128
		if (childEditPart instanceof AddStructuralFeatureValueActionNameEditPart) {
129
			((AddStructuralFeatureValueActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureActionBaseFigure_name());
130
			return true;
131
		}
132
		if (childEditPart instanceof InputPinEditPart) {
133
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
134
			getBorderedFigure().getBorderItemContainer().add(((InputPinEditPart) childEditPart).getFigure(), locator);
135
			return true;
136
		}
137
		if (childEditPart instanceof InputPin2EditPart) {
138
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
139
			getBorderedFigure().getBorderItemContainer().add(((InputPin2EditPart) childEditPart).getFigure(), locator);
140
			return true;
141
		}
142
		if (childEditPart instanceof InputPin3EditPart) {
143
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
144
			getBorderedFigure().getBorderItemContainer().add(((InputPin3EditPart) childEditPart).getFigure(), locator);
145
			return true;
146
		}
147
		return false;
148
	}
149
150
	/**
151
	 * @generated
152
	 */
153
	protected boolean removeFixedChild(EditPart childEditPart) {
154
		if (childEditPart instanceof InputPinEditPart) {
155
			getBorderedFigure().getBorderItemContainer().remove(((InputPinEditPart) childEditPart).getFigure());
156
			return true;
157
		}
158
		if (childEditPart instanceof InputPin2EditPart) {
159
			getBorderedFigure().getBorderItemContainer().remove(((InputPin2EditPart) childEditPart).getFigure());
160
			return true;
161
		}
162
		if (childEditPart instanceof InputPin3EditPart) {
163
			getBorderedFigure().getBorderItemContainer().remove(((InputPin3EditPart) childEditPart).getFigure());
164
			return true;
165
		}
166
		return false;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected NodeFigure createNodePlate() {
173
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(80));
174
		return result;
175
	}
176
177
	/**
178
	 * Creates figure for this edit part.
179
	 * 
180
	 * Body of this method does not depend on settings in generation model
181
	 * so you may safely remove <i>generated</i> tag and modify it.
182
	 * 
183
	 * @generated
184
	 */
185
	protected NodeFigure createMainFigure() {
186
		NodeFigure figure = createNodePlate();
187
		figure.setLayoutManager(new StackLayout());
188
		IFigure shape = createNodeShape();
189
		figure.add(shape);
190
		contentPane = setupContentPane(shape);
191
		return figure;
192
	}
193
194
	/**
195
	 * Default implementation treats passed figure as content pane.
196
	 * Respects layout one may have set for generated figure.
197
	 * @param nodeShape instance of generated figure class
198
	 * @generated
199
	 */
200
	protected IFigure setupContentPane(IFigure nodeShape) {
201
		if (nodeShape.getLayoutManager() == null) {
202
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
203
			layout.setSpacing(getMapMode().DPtoLP(5));
204
			nodeShape.setLayoutManager(layout);
205
		}
206
		return nodeShape; // use nodeShape itself as contentPane
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public IFigure getContentPane() {
213
		if (contentPane != null) {
214
			return contentPane;
215
		}
216
		return super.getContentPane();
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	public EditPart getPrimaryChildEditPart() {
223
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionNameEditPart.VISUAL_ID));
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	protected void addChildVisual(EditPart childEditPart, int index) {
230
		if (addFixedChild(childEditPart)) {
231
			return;
232
		}
233
		super.addChildVisual(childEditPart, -1);
234
	}
235
236
	/**
237
	 * @generated
238
	 */
239
	protected void removeChildVisual(EditPart childEditPart) {
240
		if (removeFixedChild(childEditPart)) {
241
			return;
242
		}
243
		super.removeChildVisual(childEditPart);
244
	}
245
246
	/**
247
	 * @generated
248
	 */
249
	public class ActionBaseFigure extends org.eclipse.draw2d.RoundedRectangle {
250
251
		/**
252
		 * @generated
253
		 */
254
		public ActionBaseFigure() {
255
256
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
257
258
			this.setLayoutManager(myGenLayoutManager);
259
260
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
261
262
			createContents();
263
		}
264
265
		/**
266
		 * @generated
267
		 */
268
		private void createContents() {
269
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
270
271
			fig_0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
272
273
			setFigureActionBaseFigure_name(fig_0);
274
275
			Object layData0 = null;
276
277
			this.add(fig_0, layData0);
278
		}
279
280
		/**
281
		 * @generated
282
		 */
283
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fActionBaseFigure_name;
284
285
		/**
286
		 * @generated
287
		 */
288
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureActionBaseFigure_name() {
289
			return fActionBaseFigure_name;
290
		}
291
292
		/**
293
		 * @generated
294
		 */
295
		private void setFigureActionBaseFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
296
			fActionBaseFigure_name = fig;
297
		}
298
299
		/**
300
		 * @generated
301
		 */
302
		private boolean myUseLocalCoordinates = false;
303
304
		/**
305
		 * @generated
306
		 */
307
		protected boolean useLocalCoordinates() {
308
			return myUseLocalCoordinates;
309
		}
310
311
		/**
312
		 * @generated
313
		 */
314
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
315
			myUseLocalCoordinates = useLocalCoordinates;
316
		}
317
318
	}
319
320
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLModelingAssistantProvider.java (+195 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.Collections;
6
import java.util.HashSet;
7
import java.util.Iterator;
8
import java.util.List;
9
10
import org.eclipse.core.runtime.IAdaptable;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
14
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
15
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
16
import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;
17
import org.eclipse.gmf.runtime.notation.Diagram;
18
import org.eclipse.jface.viewers.ILabelProvider;
19
import org.eclipse.jface.window.Window;
20
import org.eclipse.swt.widgets.Display;
21
import org.eclipse.swt.widgets.Shell;
22
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
23
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
24
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
25
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
26
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
27
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
28
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
29
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
30
31
/**
32
 * @generated
33
 */
34
public class UMLModelingAssistantProvider extends ModelingAssistantProvider {
35
36
	/**
37
	 * @generated
38
	 */
39
	public List getTypesForPopupBar(IAdaptable host) {
40
		IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
41
		if (editPart instanceof OpaqueActionEditPart) {
42
			List types = new ArrayList();
43
			types.add(UMLElementTypes.OutputPin_3001);
44
			return types;
45
		}
46
		if (editPart instanceof CreateObjectActionEditPart) {
47
			List types = new ArrayList();
48
			types.add(UMLElementTypes.OutputPin_3002);
49
			return types;
50
		}
51
		if (editPart instanceof AddStructuralFeatureValueActionEditPart) {
52
			List types = new ArrayList();
53
			types.add(UMLElementTypes.InputPin_3003);
54
			types.add(UMLElementTypes.InputPin_3004);
55
			types.add(UMLElementTypes.InputPin_3005);
56
			return types;
57
		}
58
		if (editPart instanceof CallBehaviorActionEditPart) {
59
			List types = new ArrayList();
60
			types.add(UMLElementTypes.OutputPin_3006);
61
			types.add(UMLElementTypes.InputPin_3007);
62
			return types;
63
		}
64
		if (editPart instanceof CallOperationActionEditPart) {
65
			List types = new ArrayList();
66
			types.add(UMLElementTypes.OutputPin_3006);
67
			types.add(UMLElementTypes.InputPin_3007);
68
			types.add(UMLElementTypes.InputPin_3008);
69
			return types;
70
		}
71
		if (editPart instanceof ActivityEditPart) {
72
			List types = new ArrayList();
73
			types.add(UMLElementTypes.AcceptEventAction_2001);
74
			types.add(UMLElementTypes.AcceptEventAction_2002);
75
			types.add(UMLElementTypes.ActivityFinalNode_2003);
76
			types.add(UMLElementTypes.DecisionNode_2004);
77
			types.add(UMLElementTypes.MergeNode_2005);
78
			types.add(UMLElementTypes.InitialNode_2006);
79
			types.add(UMLElementTypes.StructuredActivityNode_2007);
80
			types.add(UMLElementTypes.DataStoreNode_2008);
81
			types.add(UMLElementTypes.CentralBufferNode_2009);
82
			types.add(UMLElementTypes.OpaqueAction_2010);
83
			types.add(UMLElementTypes.FlowFinalNode_2011);
84
			types.add(UMLElementTypes.ForkNode_2012);
85
			types.add(UMLElementTypes.JoinNode_2013);
86
			types.add(UMLElementTypes.Pin_2014);
87
			types.add(UMLElementTypes.CreateObjectAction_2015);
88
			types.add(UMLElementTypes.AddStructuralFeatureValueAction_2016);
89
			types.add(UMLElementTypes.CallBehaviorAction_2017);
90
			types.add(UMLElementTypes.CallOperationAction_2018);
91
			return types;
92
		}
93
		return Collections.EMPTY_LIST;
94
	}
95
96
	/**
97
	 * @generated
98
	 */
99
	public List getRelTypesOnSource(IAdaptable source) {
100
		return Collections.EMPTY_LIST;
101
	}
102
103
	/**
104
	 * @generated
105
	 */
106
	public List getRelTypesOnTarget(IAdaptable target) {
107
		return Collections.EMPTY_LIST;
108
	}
109
110
	/**
111
	 * @generated
112
	 */
113
	public List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {
114
		return Collections.EMPTY_LIST;
115
	}
116
117
	/**
118
	 * @generated
119
	 */
120
	public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
121
		return Collections.EMPTY_LIST;
122
	}
123
124
	/**
125
	 * @generated
126
	 */
127
	public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
128
		return Collections.EMPTY_LIST;
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	public EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {
135
		return selectExistingElement(target, getTypesForSource(target, relationshipType));
136
	}
137
138
	/**
139
	 * @generated
140
	 */
141
	public EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {
142
		return selectExistingElement(source, getTypesForTarget(source, relationshipType));
143
	}
144
145
	/**
146
	 * @generated
147
	 */
148
	protected EObject selectExistingElement(IAdaptable host, Collection types) {
149
		if (types.isEmpty()) {
150
			return null;
151
		}
152
		IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
153
		if (editPart == null) {
154
			return null;
155
		}
156
		Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
157
		Collection elements = new HashSet();
158
		for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {
159
			EObject element = (EObject) it.next();
160
			if (isApplicableElement(element, types)) {
161
				elements.add(element);
162
			}
163
		}
164
		if (elements.isEmpty()) {
165
			return null;
166
		}
167
		return selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));
168
	}
169
170
	/**
171
	 * @generated
172
	 */
173
	protected boolean isApplicableElement(EObject element, Collection types) {
174
		IElementType type = ElementTypeRegistry.getInstance().getElementType(element);
175
		return types.contains(type);
176
	}
177
178
	/**
179
	 * @generated
180
	 */
181
	protected EObject selectElement(EObject[] elements) {
182
		Shell shell = Display.getCurrent().getActiveShell();
183
		ILabelProvider labelProvider = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
184
		ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
185
		dialog.setMessage("Available domain model elements:");
186
		dialog.setTitle("Select domain model element");
187
		dialog.setMultipleSelection(false);
188
		dialog.setElements(elements);
189
		EObject selected = null;
190
		if (dialog.open() == Window.OK) {
191
			selected = (EObject) dialog.getFirstResult();
192
		}
193
		return selected;
194
	}
195
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CallOperationActionNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class CallOperationActionNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5014;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public CallOperationActionNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.CallOperationAction_2018;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java (+68 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Iterator;
4
import java.util.LinkedList;
5
import java.util.List;
6
7
import org.eclipse.emf.ecore.EObject;
8
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
9
import org.eclipse.gmf.runtime.notation.View;
10
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
12
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
import org.eclipse.uml2.uml.CallAction;
15
import org.eclipse.uml2.uml.CallOperationAction;
16
import org.eclipse.uml2.uml.InvocationAction;
17
18
/**
19
 * @generated
20
 */
21
public class CallOperationActionCanonicalEditPolicy extends CanonicalEditPolicy {
22
23
	/**
24
	 * @generated
25
	 */
26
	protected List getSemanticChildrenList() {
27
		List result = new LinkedList();
28
		EObject modelObject = ((View) getHost().getModel()).getElement();
29
		View viewObject = (View) getHost().getModel();
30
		EObject nextValue;
31
		int nodeVID;
32
		for (Iterator values = ((CallAction) modelObject).getResults().iterator(); values.hasNext();) {
33
			nextValue = (EObject) values.next();
34
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
35
			if (OutputPin3EditPart.VISUAL_ID == nodeVID) {
36
				result.add(nextValue);
37
			}
38
		}
39
		for (Iterator values = ((InvocationAction) modelObject).getArguments().iterator(); values.hasNext();) {
40
			nextValue = (EObject) values.next();
41
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
42
			if (InputPin4EditPart.VISUAL_ID == nodeVID) {
43
				result.add(nextValue);
44
			}
45
		}
46
		nextValue = ((CallOperationAction) modelObject).getTarget();
47
		nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
48
		if (InputPin5EditPart.VISUAL_ID == nodeVID) {
49
			result.add(nextValue);
50
		}
51
		return result;
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected boolean shouldDeleteView(View view) {
58
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
59
	}
60
61
	/**
62
	 * @generated
63
	 */
64
	protected String getDefaultFactoryHint() {
65
		return null;
66
	}
67
68
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPin3EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.InputPin3ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class InputPin3EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3005;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public InputPin3EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPin3ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return InputPin3EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinName3EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof InputPinName3EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/StructuredActivityNodeEditPart.java (+261 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.StructuredActivityNodeItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class StructuredActivityNodeEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2007;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public StructuredActivityNodeEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StructuredActivityNodeItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		StructuredActivityFigure figure = new StructuredActivityFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public StructuredActivityFigure getPrimaryShape() {
94
		return (StructuredActivityFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class StructuredActivityFigure extends org.eclipse.draw2d.RoundedRectangle {
151
152
		/**
153
		 * @generated
154
		 */
155
		public StructuredActivityFigure() {
156
157
			org.eclipse.draw2d.BorderLayout myGenLayoutManager = new org.eclipse.draw2d.BorderLayout();
158
159
			this.setLayoutManager(myGenLayoutManager);
160
161
			this.setLineStyle(org.eclipse.draw2d.Graphics.LINE_DASH);
162
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(8), getMapMode().DPtoLP(8)));
163
164
			createContents();
165
		}
166
167
		/**
168
		 * @generated
169
		 */
170
		private void createContents() {
171
			org.eclipse.draw2d.RectangleFigure fig_0 = new org.eclipse.draw2d.RectangleFigure();
172
			fig_0.setFill(false);
173
			fig_0.setOutline(false);
174
175
			setFigureStructuredActivityFigure_ContentPane(fig_0);
176
177
			Object layData0 = org.eclipse.draw2d.BorderLayout.CENTER;
178
179
			this.add(fig_0, layData0);
180
			org.eclipse.draw2d.RectangleFigure fig_1 = new org.eclipse.draw2d.RectangleFigure();
181
			fig_1.setFill(false);
182
			fig_1.setOutline(false);
183
			fig_1.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0)));
184
185
			org.eclipse.draw2d.BorderLayout layouter1 = new org.eclipse.draw2d.BorderLayout();
186
187
			fig_1.setLayoutManager(layouter1);
188
189
			setFigureAux_StructuredActivityFigure_LabelContainer(fig_1);
190
191
			Object layData1 = org.eclipse.draw2d.BorderLayout.TOP;
192
193
			this.add(fig_1, layData1);
194
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_2 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
195
			fig_2.setText("\u00ABstructured\u00BB");
196
197
			Object layData2 = org.eclipse.draw2d.BorderLayout.LEFT;
198
199
			fig_1.add(fig_2, layData2);
200
		}
201
202
		/**
203
		 * @generated
204
		 */
205
		private org.eclipse.draw2d.RectangleFigure fStructuredActivityFigure_ContentPane;
206
207
		/**
208
		 * @generated
209
		 */
210
		public org.eclipse.draw2d.RectangleFigure getFigureStructuredActivityFigure_ContentPane() {
211
			return fStructuredActivityFigure_ContentPane;
212
		}
213
214
		/**
215
		 * @generated
216
		 */
217
		private void setFigureStructuredActivityFigure_ContentPane(org.eclipse.draw2d.RectangleFigure fig) {
218
			fStructuredActivityFigure_ContentPane = fig;
219
		}
220
221
		/**
222
		 * @generated
223
		 */
224
		private org.eclipse.draw2d.RectangleFigure fAux_StructuredActivityFigure_LabelContainer;
225
226
		/**
227
		 * @generated
228
		 */
229
		public org.eclipse.draw2d.RectangleFigure getFigureAux_StructuredActivityFigure_LabelContainer() {
230
			return fAux_StructuredActivityFigure_LabelContainer;
231
		}
232
233
		/**
234
		 * @generated
235
		 */
236
		private void setFigureAux_StructuredActivityFigure_LabelContainer(org.eclipse.draw2d.RectangleFigure fig) {
237
			fAux_StructuredActivityFigure_LabelContainer = fig;
238
		}
239
240
		/**
241
		 * @generated
242
		 */
243
		private boolean myUseLocalCoordinates = false;
244
245
		/**
246
		 * @generated
247
		 */
248
		protected boolean useLocalCoordinates() {
249
			return myUseLocalCoordinates;
250
		}
251
252
		/**
253
		 * @generated
254
		 */
255
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
256
			myUseLocalCoordinates = useLocalCoordinates;
257
		}
258
259
	}
260
261
}
(-)icons/linksNavigatorGroup.gif (+5 lines)
Added Link Here
1
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
2
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;Content-Type: image/gif
3
4
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
5
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/CentralBufferNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class CentralBufferNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CallOperationActionEditPart.java (+320 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.requests.CreateRequest;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
17
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
18
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
19
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.notation.View;
23
import org.eclipse.uml2.diagram.activity.edit.policies.CallOperationActionCanonicalEditPolicy;
24
import org.eclipse.uml2.diagram.activity.edit.policies.CallOperationActionItemSemanticEditPolicy;
25
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
26
27
/**
28
 * @generated
29
 */
30
public class CallOperationActionEditPart extends AbstractBorderedShapeEditPart {
31
32
	/**
33
	 * @generated
34
	 */
35
	public static final int VISUAL_ID = 2018;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure contentPane;
41
42
	/**
43
	 * @generated
44
	 */
45
	protected IFigure primaryShape;
46
47
	/**
48
	 * @generated
49
	 */
50
	public CallOperationActionEditPart(View view) {
51
		super(view);
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected void createDefaultEditPolicies() {
58
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
59
		super.createDefaultEditPolicies();
60
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CallOperationActionItemSemanticEditPolicy());
61
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
62
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new CallOperationActionCanonicalEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected EditPolicy createChildEditPolicy(EditPart child) {
74
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
75
				if (result == null) {
76
					result = new NonResizableEditPolicy();
77
				}
78
				return result;
79
			}
80
81
			protected Command getMoveChildrenCommand(Request request) {
82
				return null;
83
			}
84
85
			protected Command getCreateCommand(CreateRequest request) {
86
				return null;
87
			}
88
		};
89
		return lep;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected IFigure createNodeShape() {
96
		ActionBaseFigure figure = new ActionBaseFigure();
97
		return primaryShape = figure;
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	public ActionBaseFigure getPrimaryShape() {
104
		return (ActionBaseFigure) primaryShape;
105
	}
106
107
	/**
108
	 * @generated 
109
	 */
110
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
111
		if (editPart instanceof OutputPin3EditPart) {
112
			return getBorderedFigure().getBorderItemContainer();
113
		}
114
		if (editPart instanceof InputPin4EditPart) {
115
			return getBorderedFigure().getBorderItemContainer();
116
		}
117
		if (editPart instanceof InputPin5EditPart) {
118
			return getBorderedFigure().getBorderItemContainer();
119
		}
120
121
		return super.getContentPaneFor(editPart);
122
	}
123
124
	/**
125
	 * @generated
126
	 */
127
	protected boolean addFixedChild(EditPart childEditPart) {
128
		if (childEditPart instanceof CallOperationActionNameEditPart) {
129
			((CallOperationActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureActionBaseFigure_name());
130
			return true;
131
		}
132
		if (childEditPart instanceof OutputPin3EditPart) {
133
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.EAST);
134
			getBorderedFigure().getBorderItemContainer().add(((OutputPin3EditPart) childEditPart).getFigure(), locator);
135
			return true;
136
		}
137
		if (childEditPart instanceof InputPin4EditPart) {
138
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
139
			getBorderedFigure().getBorderItemContainer().add(((InputPin4EditPart) childEditPart).getFigure(), locator);
140
			return true;
141
		}
142
		if (childEditPart instanceof InputPin5EditPart) {
143
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
144
			getBorderedFigure().getBorderItemContainer().add(((InputPin5EditPart) childEditPart).getFigure(), locator);
145
			return true;
146
		}
147
		return false;
148
	}
149
150
	/**
151
	 * @generated
152
	 */
153
	protected boolean removeFixedChild(EditPart childEditPart) {
154
		if (childEditPart instanceof OutputPin3EditPart) {
155
			getBorderedFigure().getBorderItemContainer().remove(((OutputPin3EditPart) childEditPart).getFigure());
156
			return true;
157
		}
158
		if (childEditPart instanceof InputPin4EditPart) {
159
			getBorderedFigure().getBorderItemContainer().remove(((InputPin4EditPart) childEditPart).getFigure());
160
			return true;
161
		}
162
		if (childEditPart instanceof InputPin5EditPart) {
163
			getBorderedFigure().getBorderItemContainer().remove(((InputPin5EditPart) childEditPart).getFigure());
164
			return true;
165
		}
166
		return false;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected NodeFigure createNodePlate() {
173
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(80));
174
		return result;
175
	}
176
177
	/**
178
	 * Creates figure for this edit part.
179
	 * 
180
	 * Body of this method does not depend on settings in generation model
181
	 * so you may safely remove <i>generated</i> tag and modify it.
182
	 * 
183
	 * @generated
184
	 */
185
	protected NodeFigure createMainFigure() {
186
		NodeFigure figure = createNodePlate();
187
		figure.setLayoutManager(new StackLayout());
188
		IFigure shape = createNodeShape();
189
		figure.add(shape);
190
		contentPane = setupContentPane(shape);
191
		return figure;
192
	}
193
194
	/**
195
	 * Default implementation treats passed figure as content pane.
196
	 * Respects layout one may have set for generated figure.
197
	 * @param nodeShape instance of generated figure class
198
	 * @generated
199
	 */
200
	protected IFigure setupContentPane(IFigure nodeShape) {
201
		if (nodeShape.getLayoutManager() == null) {
202
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
203
			layout.setSpacing(getMapMode().DPtoLP(5));
204
			nodeShape.setLayoutManager(layout);
205
		}
206
		return nodeShape; // use nodeShape itself as contentPane
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public IFigure getContentPane() {
213
		if (contentPane != null) {
214
			return contentPane;
215
		}
216
		return super.getContentPane();
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	public EditPart getPrimaryChildEditPart() {
223
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(CallOperationActionNameEditPart.VISUAL_ID));
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	protected void addChildVisual(EditPart childEditPart, int index) {
230
		if (addFixedChild(childEditPart)) {
231
			return;
232
		}
233
		super.addChildVisual(childEditPart, -1);
234
	}
235
236
	/**
237
	 * @generated
238
	 */
239
	protected void removeChildVisual(EditPart childEditPart) {
240
		if (removeFixedChild(childEditPart)) {
241
			return;
242
		}
243
		super.removeChildVisual(childEditPart);
244
	}
245
246
	/**
247
	 * @generated
248
	 */
249
	public class ActionBaseFigure extends org.eclipse.draw2d.RoundedRectangle {
250
251
		/**
252
		 * @generated
253
		 */
254
		public ActionBaseFigure() {
255
256
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
257
258
			this.setLayoutManager(myGenLayoutManager);
259
260
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
261
262
			createContents();
263
		}
264
265
		/**
266
		 * @generated
267
		 */
268
		private void createContents() {
269
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
270
271
			fig_0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
272
273
			setFigureActionBaseFigure_name(fig_0);
274
275
			Object layData0 = null;
276
277
			this.add(fig_0, layData0);
278
		}
279
280
		/**
281
		 * @generated
282
		 */
283
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fActionBaseFigure_name;
284
285
		/**
286
		 * @generated
287
		 */
288
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureActionBaseFigure_name() {
289
			return fActionBaseFigure_name;
290
		}
291
292
		/**
293
		 * @generated
294
		 */
295
		private void setFigureActionBaseFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
296
			fActionBaseFigure_name = fig;
297
		}
298
299
		/**
300
		 * @generated
301
		 */
302
		private boolean myUseLocalCoordinates = false;
303
304
		/**
305
		 * @generated
306
		 */
307
		protected boolean useLocalCoordinates() {
308
			return myUseLocalCoordinates;
309
		}
310
311
		/**
312
		 * @generated
313
		 */
314
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
315
			myUseLocalCoordinates = useLocalCoordinates;
316
		}
317
318
	}
319
320
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/AddStructuralFeatureValueActionNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class AddStructuralFeatureValueActionNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)META-INF/MANIFEST.MF (+45 lines)
Added Link Here
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.uml2.diagram.activity; singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-ClassPath: .
7
Bundle-Activator: org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin
8
Bundle-Vendor: %providerName
9
Bundle-Localization: plugin
10
Export-Package: org.eclipse.uml2.diagram.activity.edit.parts,
11
 org.eclipse.uml2.diagram.activity.part,
12
 org.eclipse.uml2.diagram.activity.providers
13
Require-Bundle: org.eclipse.core.runtime,
14
 org.eclipse.core.resources,
15
 org.eclipse.jface,
16
 org.eclipse.ui.ide,
17
 org.eclipse.ui.views,
18
 org.eclipse.ui.workbench,
19
 org.eclipse.ui.workbench.texteditor,
20
 org.eclipse.ui.navigator,
21
 org.eclipse.emf.ecore,
22
 org.eclipse.emf.ecore.xmi,
23
 org.eclipse.emf.edit.ui,
24
 org.eclipse.gef;visibility:=reexport,
25
 org.eclipse.gmf.runtime.emf.core,
26
 org.eclipse.gmf.runtime.emf.commands.core,
27
 org.eclipse.gmf.runtime.emf.ui.properties,
28
 org.eclipse.gmf.runtime.diagram.ui,
29
 org.eclipse.gmf.runtime.diagram.ui.properties,
30
 org.eclipse.gmf.runtime.diagram.ui.providers,
31
 org.eclipse.gmf.runtime.diagram.ui.providers.ide,
32
 org.eclipse.gmf.runtime.diagram.ui.render,
33
 org.eclipse.gmf.runtime.diagram.ui.resources.editor,
34
 org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
35
 org.eclipse.gmf.runtime.notation.providers,
36
 org.eclipse.uml2.uml;visibility:=reexport,
37
 org.eclipse.uml2.uml.edit;visibility:=reexport,
38
 org.eclipse.emf.ecore;visibility:=reexport,
39
 org.eclipse.emf.ecore.edit;visibility:=reexport,
40
 org.eclipse.emf.query.ocl;visibility:=reexport,
41
 org.eclipse.emf.ocl;visibility:=reexport,
42
 org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
43
 org.eclipse.draw2d;visibility:=reexport,
44
 org.eclipse.uml2.diagram.common;visibility:=reexport
45
Eclipse-LazyStart: true
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CentralBufferNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class CentralBufferNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLLoadResourceAction.java (+63 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog;
4
import org.eclipse.jface.action.IAction;
5
import org.eclipse.jface.viewers.ISelection;
6
import org.eclipse.jface.viewers.IStructuredSelection;
7
import org.eclipse.swt.widgets.Shell;
8
import org.eclipse.ui.IObjectActionDelegate;
9
import org.eclipse.ui.IWorkbenchPart;
10
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
11
12
/**
13
 * @generated
14
 */
15
public class UMLLoadResourceAction implements IObjectActionDelegate {
16
17
	/**
18
	 * @generated
19
	 */
20
	private ActivityEditPart mySelectedElement;
21
22
	/**
23
	 * @generated
24
	 */
25
	private Shell myShell;
26
27
	/**
28
	 * @generated
29
	 */
30
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
31
		myShell = targetPart.getSite().getShell();
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	public void run(IAction action) {
38
		LoadResourceDialog loadResourceDialog = new LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());
39
		loadResourceDialog.open();
40
	}
41
42
	/**
43
	 * @generated
44
	 */
45
	public void selectionChanged(IAction action, ISelection selection) {
46
		mySelectedElement = null;
47
		if (selection instanceof IStructuredSelection) {
48
			IStructuredSelection structuredSelection = (IStructuredSelection) selection;
49
			if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof ActivityEditPart) {
50
				mySelectedElement = (ActivityEditPart) structuredSelection.getFirstElement();
51
			}
52
		}
53
		action.setEnabled(isEnabled());
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	private boolean isEnabled() {
60
		return mySelectedElement != null;
61
	}
62
63
}
(-).options (+7 lines)
Added Link Here
1
# Debugging options for the org.eclipse.uml2.diagram.activity plug-in
2
3
# Turn on general debugging for the org.eclipse.uml2.diagram.activity plug-in
4
org.eclipse.uml2.diagram.activity/debug=false
5
6
# Turn on debugging of visualID processing
7
org.eclipse.uml2.diagram.activity/debug/visualID=true
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/ObjectFlowEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class ObjectFlowEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLNewDiagramFileWizard.java (+264 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.io.IOException;
4
import java.util.Collections;
5
import java.util.LinkedList;
6
import java.util.List;
7
8
import org.eclipse.core.commands.ExecutionException;
9
import org.eclipse.core.commands.operations.OperationHistoryFactory;
10
import org.eclipse.core.resources.IContainer;
11
import org.eclipse.core.resources.IFile;
12
import org.eclipse.core.runtime.CoreException;
13
import org.eclipse.core.runtime.IAdaptable;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.NullProgressMonitor;
16
import org.eclipse.core.runtime.Path;
17
import org.eclipse.emf.common.util.URI;
18
import org.eclipse.emf.ecore.EObject;
19
import org.eclipse.emf.ecore.resource.Resource;
20
import org.eclipse.emf.ecore.resource.ResourceSet;
21
import org.eclipse.emf.ecore.util.FeatureMap;
22
import org.eclipse.emf.edit.provider.IWrapperItemProvider;
23
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
24
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
25
import org.eclipse.emf.transaction.TransactionalEditingDomain;
26
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
27
import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
28
import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
29
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
30
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
31
import org.eclipse.gmf.runtime.notation.Diagram;
32
import org.eclipse.jface.viewers.ISelectionChangedListener;
33
import org.eclipse.jface.viewers.IStructuredSelection;
34
import org.eclipse.jface.viewers.SelectionChangedEvent;
35
import org.eclipse.jface.viewers.StructuredSelection;
36
import org.eclipse.jface.viewers.TreeViewer;
37
import org.eclipse.jface.wizard.Wizard;
38
import org.eclipse.jface.wizard.WizardPage;
39
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.layout.GridData;
41
import org.eclipse.swt.layout.GridLayout;
42
import org.eclipse.swt.widgets.Composite;
43
import org.eclipse.swt.widgets.Label;
44
import org.eclipse.ui.IWorkbenchPage;
45
import org.eclipse.ui.PartInitException;
46
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
47
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
48
49
/**
50
 * @generated
51
 */
52
public class UMLNewDiagramFileWizard extends Wizard {
53
54
	/**
55
	 * @generated
56
	 */
57
	private TransactionalEditingDomain myEditingDomain;
58
59
	/**
60
	 * @generated
61
	 */
62
	private WizardNewFileCreationPage myFileCreationPage;
63
64
	/**
65
	 * @generated
66
	 */
67
	private IFile mySelectedModelFile;
68
69
	/**
70
	 * @generated
71
	 */
72
	private IWorkbenchPage myWorkbenchPage;
73
74
	/**
75
	 * @generated
76
	 */
77
	private IStructuredSelection mySelection;
78
79
	/**
80
	 * @generated
81
	 */
82
	private EObject myDiagramRoot;
83
84
	/**
85
	 * @generated
86
	 */
87
	public UMLNewDiagramFileWizard(IFile selectedModelFile, IWorkbenchPage workbenchPage, IStructuredSelection selection, EObject diagramRoot, TransactionalEditingDomain editingDomain) {
88
		assert selectedModelFile != null : "Null selectedModelFile in UMLNewDiagramFileWizard constructor"; //$NON-NLS-1$
89
		assert workbenchPage != null : "Null workbenchPage in UMLNewDiagramFileWizard constructor"; //$NON-NLS-1$
90
		assert selection != null : "Null selection in UMLNewDiagramFileWizard constructor"; //$NON-NLS-1$
91
		assert diagramRoot != null : "Null diagramRoot in UMLNewDiagramFileWizard constructor"; //$NON-NLS-1$
92
		assert editingDomain != null : "Null editingDomain in UMLNewDiagramFileWizard constructor"; //$NON-NLS-1$
93
94
		mySelectedModelFile = selectedModelFile;
95
		myWorkbenchPage = workbenchPage;
96
		mySelection = selection;
97
		myDiagramRoot = diagramRoot;
98
		myEditingDomain = editingDomain;
99
	}
100
101
	/**
102
	 * @generated
103
	 */
104
	public void addPages() {
105
		myFileCreationPage = new WizardNewFileCreationPage("Initialize new Ecore diagram file", mySelection) {
106
107
			public void createControl(Composite parent) {
108
				super.createControl(parent);
109
110
				IContainer parentContainer = mySelectedModelFile.getParent();
111
				String originalFileName = mySelectedModelFile.getProjectRelativePath().removeFileExtension().lastSegment();
112
				String fileExtension = ".umlactivity_diagram"; //$NON-NLS-1$
113
				String fileName = originalFileName + fileExtension;
114
				for (int i = 1; parentContainer.getFile(new Path(fileName)).exists(); i++) {
115
					fileName = originalFileName + i + fileExtension;
116
				}
117
				setFileName(fileName);
118
			}
119
120
		};
121
		myFileCreationPage.setTitle("Diagram file");
122
		myFileCreationPage.setDescription("Create new diagram based on " + ActivityEditPart.MODEL_ID + " model content");
123
		addPage(myFileCreationPage);
124
		addPage(new RootElementSelectorPage());
125
	}
126
127
	/**
128
	 * @generated
129
	 */
130
	public boolean performFinish() {
131
		IFile diagramFile = myFileCreationPage.createNewFile();
132
		try {
133
			diagramFile.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
134
		} catch (CoreException e) {
135
			UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for diagram file", e); //$NON-NLS-1$
136
		}
137
138
		ResourceSet resourceSet = myEditingDomain.getResourceSet();
139
		final Resource diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFile.getFullPath().toString()));
140
141
		List affectedFiles = new LinkedList();
142
		affectedFiles.add(mySelectedModelFile);
143
		affectedFiles.add(diagramFile);
144
145
		AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, "Initializing diagram contents", affectedFiles) { //$NON-NLS-1$
146
147
			protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
148
				int diagramVID = UMLVisualIDRegistry.getDiagramVisualID(myDiagramRoot);
149
				if (diagramVID != ActivityEditPart.VISUAL_ID) {
150
					return CommandResult.newErrorCommandResult("Incorrect model object stored as a root resource object"); //$NON-NLS-1$
151
				}
152
				Diagram diagram = ViewService.createDiagram(myDiagramRoot, ActivityEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
153
				diagramResource.getContents().add(diagram);
154
				return CommandResult.newOKCommandResult();
155
			}
156
		};
157
158
		try {
159
			OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
160
			diagramResource.save(Collections.EMPTY_MAP);
161
			UMLDiagramEditorUtil.openDiagramEditor(myWorkbenchPage, diagramFile);
162
		} catch (ExecutionException e) {
163
			UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
164
		} catch (IOException ex) {
165
			UMLDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramFile.getFullPath().toString(), ex); //$NON-NLS-1$
166
		} catch (PartInitException ex) {
167
			UMLDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
168
		}
169
		return true;
170
	}
171
172
	/**
173
	 * @generated
174
	 */
175
	private class RootElementSelectorPage extends WizardPage implements ISelectionChangedListener {
176
177
		/**
178
		 * @generated
179
		 */
180
		protected RootElementSelectorPage() {
181
			super("Select diagram root element");
182
			setTitle("Diagram root element");
183
			setDescription("Select semantic model element to be depicted on diagram");
184
		}
185
186
		/**
187
		 * @generated
188
		 */
189
		public void createControl(Composite parent) {
190
			initializeDialogUnits(parent);
191
			Composite topLevel = new Composite(parent, SWT.NONE);
192
			topLevel.setLayout(new GridLayout());
193
			topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
194
			topLevel.setFont(parent.getFont());
195
			setControl(topLevel);
196
			createModelBrowser(topLevel);
197
			setPageComplete(validatePage());
198
		}
199
200
		/**
201
		 * @generated
202
		 */
203
		private void createModelBrowser(Composite parent) {
204
			Composite panel = new Composite(parent, SWT.NONE);
205
			panel.setLayoutData(new GridData(GridData.FILL_BOTH));
206
			GridLayout layout = new GridLayout();
207
			layout.marginWidth = 0;
208
			panel.setLayout(layout);
209
210
			Label label = new Label(panel, SWT.NONE);
211
			label.setText("Select diagram root element:");
212
			label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
213
214
			TreeViewer treeViewer = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
215
			GridData layoutData = new GridData(GridData.FILL_BOTH);
216
			layoutData.heightHint = 300;
217
			layoutData.widthHint = 300;
218
			treeViewer.getTree().setLayoutData(layoutData);
219
			treeViewer.setContentProvider(new AdapterFactoryContentProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
220
			treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
221
			treeViewer.setInput(myDiagramRoot.eResource());
222
			treeViewer.setSelection(new StructuredSelection(myDiagramRoot));
223
			treeViewer.addSelectionChangedListener(this);
224
		}
225
226
		/**
227
		 * @generated
228
		 */
229
		public void selectionChanged(SelectionChangedEvent event) {
230
			myDiagramRoot = null;
231
			if (event.getSelection() instanceof IStructuredSelection) {
232
				IStructuredSelection selection = (IStructuredSelection) event.getSelection();
233
				if (selection.size() == 1) {
234
					Object selectedElement = selection.getFirstElement();
235
					if (selectedElement instanceof IWrapperItemProvider) {
236
						selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
237
					}
238
					if (selectedElement instanceof FeatureMap.Entry) {
239
						selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
240
					}
241
					if (selectedElement instanceof EObject) {
242
						myDiagramRoot = (EObject) selectedElement;
243
					}
244
				}
245
			}
246
			setPageComplete(validatePage());
247
		}
248
249
		/**
250
		 * @generated
251
		 */
252
		private boolean validatePage() {
253
			if (myDiagramRoot == null) {
254
				setErrorMessage("No diagram root element selected");
255
				return false;
256
			}
257
			boolean result = ViewService.getInstance().provides(
258
					new CreateDiagramViewOperation(new EObjectAdapter(myDiagramRoot), ActivityEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
259
			setErrorMessage(result ? null : "Invalid diagram root element was selected");
260
			return result;
261
		}
262
263
	}
264
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/AcceptEventAction2ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class AcceptEventAction2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/ControlFlowViewFactory.java (+47 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class ControlFlowViewFactory extends ConnectionViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
26
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
27
		return styles;
28
	}
29
30
	/**
31
	 * @generated
32
	 */
33
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
34
		if (semanticHint == null) {
35
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart.VISUAL_ID);
36
			view.setType(semanticHint);
37
		}
38
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
39
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
40
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
41
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
42
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
43
			view.getEAnnotations().add(shortcutAnnotation);
44
		}
45
	}
46
47
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/JoinNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class JoinNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPinViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class OutputPinViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(OutputPinNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/OpaqueActionCanonicalEditPolicy.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Iterator;
4
import java.util.LinkedList;
5
import java.util.List;
6
7
import org.eclipse.emf.ecore.EObject;
8
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
9
import org.eclipse.gmf.runtime.notation.View;
10
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
11
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
12
import org.eclipse.uml2.uml.OpaqueAction;
13
14
/**
15
 * @generated
16
 */
17
public class OpaqueActionCanonicalEditPolicy extends CanonicalEditPolicy {
18
19
	/**
20
	 * @generated
21
	 */
22
	protected List getSemanticChildrenList() {
23
		List result = new LinkedList();
24
		EObject modelObject = ((View) getHost().getModel()).getElement();
25
		View viewObject = (View) getHost().getModel();
26
		EObject nextValue;
27
		int nodeVID;
28
		for (Iterator values = ((OpaqueAction) modelObject).getOutputValues().iterator(); values.hasNext();) {
29
			nextValue = (EObject) values.next();
30
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
31
			if (OutputPinEditPart.VISUAL_ID == nodeVID) {
32
				result.add(nextValue);
33
			}
34
		}
35
		return result;
36
	}
37
38
	/**
39
	 * @generated
40
	 */
41
	protected boolean shouldDeleteView(View view) {
42
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
43
	}
44
45
	/**
46
	 * @generated
47
	 */
48
	protected String getDefaultFactoryHint() {
49
		return null;
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/PinViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class PinViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(PinNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLIconProvider.java (+31 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
5
import org.eclipse.gmf.runtime.common.core.service.IOperation;
6
import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;
7
import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
8
import org.eclipse.swt.graphics.Image;
9
10
/**
11
 * @generated
12
 */
13
public class UMLIconProvider extends AbstractProvider implements IIconProvider {
14
15
	/**
16
	 * @generated
17
	 */
18
	public Image getIcon(IAdaptable hint, int flags) {
19
		return UMLElementTypes.getImage(hint);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	public boolean provides(IOperation operation) {
26
		if (operation instanceof GetIconOperation) {
27
			return ((GetIconOperation) operation).execute(this) != null;
28
		}
29
		return false;
30
	}
31
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/MergeNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class MergeNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPin3ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class InputPin3ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(InputPinName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CallBehaviorActionViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class CallBehaviorActionViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(CallBehaviorActionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/ActivityEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class ActivityEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPinEditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.OutputPinItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class OutputPinEditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3001;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public OutputPinEditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPinItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return OutputPinEditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(OutputPinNameEditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof OutputPinNameEditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CreateObjectActionCanonicalEditPolicy.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.LinkedList;
4
import java.util.List;
5
6
import org.eclipse.emf.ecore.EObject;
7
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
8
import org.eclipse.gmf.runtime.notation.View;
9
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
10
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
11
import org.eclipse.uml2.uml.CreateObjectAction;
12
13
/**
14
 * @generated
15
 */
16
public class CreateObjectActionCanonicalEditPolicy extends CanonicalEditPolicy {
17
18
	/**
19
	 * @generated
20
	 */
21
	protected List getSemanticChildrenList() {
22
		List result = new LinkedList();
23
		EObject modelObject = ((View) getHost().getModel()).getElement();
24
		View viewObject = (View) getHost().getModel();
25
		EObject nextValue;
26
		int nodeVID;
27
		nextValue = ((CreateObjectAction) modelObject).getResult();
28
		nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
29
		if (OutputPin2EditPart.VISUAL_ID == nodeVID) {
30
			result.add(nextValue);
31
		}
32
		return result;
33
	}
34
35
	/**
36
	 * @generated
37
	 */
38
	protected boolean shouldDeleteView(View view) {
39
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
40
	}
41
42
	/**
43
	 * @generated
44
	 */
45
	protected String getDefaultFactoryHint() {
46
		return null;
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLPaletteFactory.java (+556 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.gef.Tool;
7
import org.eclipse.gef.palette.PaletteContainer;
8
import org.eclipse.gef.palette.PaletteDrawer;
9
import org.eclipse.gef.palette.PaletteRoot;
10
import org.eclipse.gef.palette.ToolEntry;
11
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
12
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
13
import org.eclipse.jface.resource.ImageDescriptor;
14
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
15
16
/**
17
 * @generated
18
 */
19
public class UMLPaletteFactory {
20
21
	/**
22
	 * @generated
23
	 */
24
	public void fillPalette(PaletteRoot paletteRoot) {
25
		paletteRoot.add(createActions1Group());
26
		paletteRoot.add(createControlNodes2Group());
27
		paletteRoot.add(createStructuredActivities3Group());
28
		paletteRoot.add(createObjects4Group());
29
		paletteRoot.add(createEdges5Group());
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	private PaletteContainer createActions1Group() {
36
		PaletteContainer paletteContainer = new PaletteDrawer("Actions");
37
		paletteContainer.setDescription("Actions");
38
		paletteContainer.add(createAcceptEventAction1CreationTool());
39
		paletteContainer.add(createAcceptTimeAction2CreationTool());
40
		paletteContainer.add(createOpaqueAction3CreationTool());
41
		paletteContainer.add(createCreateObjectAction4CreationTool());
42
		paletteContainer.add(createAddFeatureValueAction5CreationTool());
43
		paletteContainer.add(createCallBehaviorAction6CreationTool());
44
		paletteContainer.add(createCallOperationAction7CreationTool());
45
		return paletteContainer;
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	private PaletteContainer createControlNodes2Group() {
52
		PaletteContainer paletteContainer = new PaletteDrawer("Control Nodes");
53
		paletteContainer.setDescription("Control Nodes");
54
		paletteContainer.add(createActivityFinalNode1CreationTool());
55
		paletteContainer.add(createActivityInitialNode2CreationTool());
56
		paletteContainer.add(createFlowFinalNode3CreationTool());
57
		paletteContainer.add(createDecisionNode4CreationTool());
58
		paletteContainer.add(createMergeNode5CreationTool());
59
		paletteContainer.add(createForkNode6CreationTool());
60
		paletteContainer.add(createJoinNode7CreationTool());
61
		return paletteContainer;
62
	}
63
64
	/**
65
	 * @generated
66
	 */
67
	private PaletteContainer createStructuredActivities3Group() {
68
		PaletteContainer paletteContainer = new PaletteDrawer("Structured Activities");
69
		paletteContainer.setDescription("Structured Activities");
70
		paletteContainer.add(createStructuredActivityNode1CreationTool());
71
		return paletteContainer;
72
	}
73
74
	/**
75
	 * @generated
76
	 */
77
	private PaletteContainer createObjects4Group() {
78
		PaletteContainer paletteContainer = new PaletteDrawer("Objects");
79
		paletteContainer.setDescription("Objects");
80
		paletteContainer.add(createDatastore1CreationTool());
81
		paletteContainer.add(createCentralBuffer2CreationTool());
82
		paletteContainer.add(createPin3CreationTool());
83
		paletteContainer.add(createOutputPin4CreationTool());
84
		paletteContainer.add(createInputPin5CreationTool());
85
		return paletteContainer;
86
	}
87
88
	/**
89
	 * @generated
90
	 */
91
	private PaletteContainer createEdges5Group() {
92
		PaletteContainer paletteContainer = new PaletteDrawer("Edges");
93
		paletteContainer.setDescription("Edges");
94
		paletteContainer.add(createControlFlow1CreationTool());
95
		paletteContainer.add(createObjectFlow2CreationTool());
96
		return paletteContainer;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	private ToolEntry createAcceptEventAction1CreationTool() {
103
		ImageDescriptor smallImage;
104
		ImageDescriptor largeImage;
105
106
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.AcceptEventAction_2001);
107
108
		largeImage = smallImage;
109
110
		final List elementTypes = new ArrayList();
111
		elementTypes.add(UMLElementTypes.AcceptEventAction_2001);
112
		ToolEntry result = new NodeToolEntry("Accept Event Action", "Create Accept Event Action", smallImage, largeImage, elementTypes);
113
114
		return result;
115
	}
116
117
	/**
118
	 * @generated
119
	 */
120
	private ToolEntry createAcceptTimeAction2CreationTool() {
121
		ImageDescriptor smallImage;
122
		ImageDescriptor largeImage;
123
124
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.AcceptEventAction_2002);
125
126
		largeImage = smallImage;
127
128
		final List elementTypes = new ArrayList();
129
		elementTypes.add(UMLElementTypes.AcceptEventAction_2002);
130
		ToolEntry result = new NodeToolEntry("Accept Time Action", "Create Accept Time Action", smallImage, largeImage, elementTypes);
131
132
		return result;
133
	}
134
135
	/**
136
	 * @generated
137
	 */
138
	private ToolEntry createOpaqueAction3CreationTool() {
139
		ImageDescriptor smallImage;
140
		ImageDescriptor largeImage;
141
142
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.OpaqueAction_2010);
143
144
		largeImage = smallImage;
145
146
		final List elementTypes = new ArrayList();
147
		elementTypes.add(UMLElementTypes.OpaqueAction_2010);
148
		ToolEntry result = new NodeToolEntry("Opaque Action", "Create Opaque Action", smallImage, largeImage, elementTypes);
149
150
		return result;
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	private ToolEntry createCreateObjectAction4CreationTool() {
157
		ImageDescriptor smallImage;
158
		ImageDescriptor largeImage;
159
160
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.CreateObjectAction_2015);
161
162
		largeImage = smallImage;
163
164
		final List elementTypes = new ArrayList();
165
		elementTypes.add(UMLElementTypes.CreateObjectAction_2015);
166
		ToolEntry result = new NodeToolEntry("Create Object Action", "Create Create Object Action", smallImage, largeImage, elementTypes);
167
168
		return result;
169
	}
170
171
	/**
172
	 * @generated
173
	 */
174
	private ToolEntry createAddFeatureValueAction5CreationTool() {
175
		ImageDescriptor smallImage;
176
		ImageDescriptor largeImage;
177
178
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.AddStructuralFeatureValueAction_2016);
179
180
		largeImage = smallImage;
181
182
		final List elementTypes = new ArrayList();
183
		elementTypes.add(UMLElementTypes.AddStructuralFeatureValueAction_2016);
184
		ToolEntry result = new NodeToolEntry("Add Feature Value Action", "Create Add Feature Value Action", smallImage, largeImage, elementTypes);
185
186
		return result;
187
	}
188
189
	/**
190
	 * @generated
191
	 */
192
	private ToolEntry createCallBehaviorAction6CreationTool() {
193
		ImageDescriptor smallImage;
194
		ImageDescriptor largeImage;
195
196
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.CallBehaviorAction_2017);
197
198
		largeImage = smallImage;
199
200
		final List elementTypes = new ArrayList();
201
		elementTypes.add(UMLElementTypes.CallBehaviorAction_2017);
202
		ToolEntry result = new NodeToolEntry("Call Behavior Action", "Create Call Behavior Action", smallImage, largeImage, elementTypes);
203
204
		return result;
205
	}
206
207
	/**
208
	 * @generated
209
	 */
210
	private ToolEntry createCallOperationAction7CreationTool() {
211
		ImageDescriptor smallImage;
212
		ImageDescriptor largeImage;
213
214
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.CallOperationAction_2018);
215
216
		largeImage = smallImage;
217
218
		final List elementTypes = new ArrayList();
219
		elementTypes.add(UMLElementTypes.CallOperationAction_2018);
220
		ToolEntry result = new NodeToolEntry("Call Operation Action", "Create Call Operation Action", smallImage, largeImage, elementTypes);
221
222
		return result;
223
	}
224
225
	/**
226
	 * @generated
227
	 */
228
	private ToolEntry createActivityFinalNode1CreationTool() {
229
		ImageDescriptor smallImage;
230
		ImageDescriptor largeImage;
231
232
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.ActivityFinalNode_2003);
233
234
		largeImage = smallImage;
235
236
		final List elementTypes = new ArrayList();
237
		elementTypes.add(UMLElementTypes.ActivityFinalNode_2003);
238
		ToolEntry result = new NodeToolEntry("Activity Final Node", "Create Activity Final Node", smallImage, largeImage, elementTypes);
239
240
		return result;
241
	}
242
243
	/**
244
	 * @generated
245
	 */
246
	private ToolEntry createActivityInitialNode2CreationTool() {
247
		ImageDescriptor smallImage;
248
		ImageDescriptor largeImage;
249
250
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.InitialNode_2006);
251
252
		largeImage = smallImage;
253
254
		final List elementTypes = new ArrayList();
255
		elementTypes.add(UMLElementTypes.InitialNode_2006);
256
		ToolEntry result = new NodeToolEntry("Activity Initial Node", "Create Activity Initial Node", smallImage, largeImage, elementTypes);
257
258
		return result;
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	private ToolEntry createFlowFinalNode3CreationTool() {
265
		ImageDescriptor smallImage;
266
		ImageDescriptor largeImage;
267
268
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.FlowFinalNode_2011);
269
270
		largeImage = smallImage;
271
272
		final List elementTypes = new ArrayList();
273
		elementTypes.add(UMLElementTypes.FlowFinalNode_2011);
274
		ToolEntry result = new NodeToolEntry("Flow Final Node", "Create Flow Final Node", smallImage, largeImage, elementTypes);
275
276
		return result;
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	private ToolEntry createDecisionNode4CreationTool() {
283
		ImageDescriptor smallImage;
284
		ImageDescriptor largeImage;
285
286
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.DecisionNode_2004);
287
288
		largeImage = smallImage;
289
290
		final List elementTypes = new ArrayList();
291
		elementTypes.add(UMLElementTypes.DecisionNode_2004);
292
		ToolEntry result = new NodeToolEntry("Decision Node", "Create Decision Node", smallImage, largeImage, elementTypes);
293
294
		return result;
295
	}
296
297
	/**
298
	 * @generated
299
	 */
300
	private ToolEntry createMergeNode5CreationTool() {
301
		ImageDescriptor smallImage;
302
		ImageDescriptor largeImage;
303
304
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.MergeNode_2005);
305
306
		largeImage = smallImage;
307
308
		final List elementTypes = new ArrayList();
309
		elementTypes.add(UMLElementTypes.MergeNode_2005);
310
		ToolEntry result = new NodeToolEntry("Merge Node", "Create Merge Node", smallImage, largeImage, elementTypes);
311
312
		return result;
313
	}
314
315
	/**
316
	 * @generated
317
	 */
318
	private ToolEntry createForkNode6CreationTool() {
319
		ImageDescriptor smallImage;
320
		ImageDescriptor largeImage;
321
322
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.ForkNode_2012);
323
324
		largeImage = smallImage;
325
326
		final List elementTypes = new ArrayList();
327
		elementTypes.add(UMLElementTypes.ForkNode_2012);
328
		ToolEntry result = new NodeToolEntry("Fork Node", "Create Fork Node", smallImage, largeImage, elementTypes);
329
330
		return result;
331
	}
332
333
	/**
334
	 * @generated
335
	 */
336
	private ToolEntry createJoinNode7CreationTool() {
337
		ImageDescriptor smallImage;
338
		ImageDescriptor largeImage;
339
340
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.JoinNode_2013);
341
342
		largeImage = smallImage;
343
344
		final List elementTypes = new ArrayList();
345
		elementTypes.add(UMLElementTypes.JoinNode_2013);
346
		ToolEntry result = new NodeToolEntry("Join Node", "Create Join Node", smallImage, largeImage, elementTypes);
347
348
		return result;
349
	}
350
351
	/**
352
	 * @generated
353
	 */
354
	private ToolEntry createStructuredActivityNode1CreationTool() {
355
		ImageDescriptor smallImage;
356
		ImageDescriptor largeImage;
357
358
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.StructuredActivityNode_2007);
359
360
		largeImage = smallImage;
361
362
		final List elementTypes = new ArrayList();
363
		elementTypes.add(UMLElementTypes.StructuredActivityNode_2007);
364
		ToolEntry result = new NodeToolEntry("Structured Activity Node", "Creare Structured Activity Node", smallImage, largeImage, elementTypes);
365
366
		return result;
367
	}
368
369
	/**
370
	 * @generated
371
	 */
372
	private ToolEntry createDatastore1CreationTool() {
373
		ImageDescriptor smallImage;
374
		ImageDescriptor largeImage;
375
376
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.DataStoreNode_2008);
377
378
		largeImage = smallImage;
379
380
		final List elementTypes = new ArrayList();
381
		elementTypes.add(UMLElementTypes.DataStoreNode_2008);
382
		ToolEntry result = new NodeToolEntry("Datastore", "Create Datastore", smallImage, largeImage, elementTypes);
383
384
		return result;
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	private ToolEntry createCentralBuffer2CreationTool() {
391
		ImageDescriptor smallImage;
392
		ImageDescriptor largeImage;
393
394
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.CentralBufferNode_2009);
395
396
		largeImage = smallImage;
397
398
		final List elementTypes = new ArrayList();
399
		elementTypes.add(UMLElementTypes.CentralBufferNode_2009);
400
		ToolEntry result = new NodeToolEntry("Central Buffer", "Create Central Buffer", smallImage, largeImage, elementTypes);
401
402
		return result;
403
	}
404
405
	/**
406
	 * @generated
407
	 */
408
	private ToolEntry createPin3CreationTool() {
409
		ImageDescriptor smallImage;
410
		ImageDescriptor largeImage;
411
412
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.Pin_2014);
413
414
		largeImage = smallImage;
415
416
		final List elementTypes = new ArrayList();
417
		elementTypes.add(UMLElementTypes.Pin_2014);
418
		ToolEntry result = new NodeToolEntry("Pin", "Create Pin", smallImage, largeImage, elementTypes);
419
420
		return result;
421
	}
422
423
	/**
424
	 * @generated
425
	 */
426
	private ToolEntry createOutputPin4CreationTool() {
427
		ImageDescriptor smallImage;
428
		ImageDescriptor largeImage;
429
430
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.OutputPin_3001);
431
432
		largeImage = smallImage;
433
434
		final List elementTypes = new ArrayList();
435
		elementTypes.add(UMLElementTypes.OutputPin_3001);
436
		elementTypes.add(UMLElementTypes.OutputPin_3002);
437
		elementTypes.add(UMLElementTypes.OutputPin_3006);
438
		ToolEntry result = new NodeToolEntry("Output Pin", "Create Output Pin", smallImage, largeImage, elementTypes);
439
440
		return result;
441
	}
442
443
	/**
444
	 * @generated
445
	 */
446
	private ToolEntry createInputPin5CreationTool() {
447
		ImageDescriptor smallImage;
448
		ImageDescriptor largeImage;
449
450
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.InputPin_3003);
451
452
		largeImage = smallImage;
453
454
		final List elementTypes = new ArrayList();
455
		elementTypes.add(UMLElementTypes.InputPin_3003);
456
		elementTypes.add(UMLElementTypes.InputPin_3004);
457
		elementTypes.add(UMLElementTypes.InputPin_3005);
458
		elementTypes.add(UMLElementTypes.InputPin_3007);
459
		elementTypes.add(UMLElementTypes.InputPin_3008);
460
		ToolEntry result = new NodeToolEntry("Input Pin", "Create Input Pin", smallImage, largeImage, elementTypes);
461
462
		return result;
463
	}
464
465
	/**
466
	 * @generated
467
	 */
468
	private ToolEntry createControlFlow1CreationTool() {
469
		ImageDescriptor smallImage;
470
		ImageDescriptor largeImage;
471
472
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.ControlFlow_4001);
473
474
		largeImage = smallImage;
475
476
		final List relationshipTypes = new ArrayList();
477
		relationshipTypes.add(UMLElementTypes.ControlFlow_4001);
478
		ToolEntry result = new LinkToolEntry("Control Flow", "Create Control Flow", smallImage, largeImage, relationshipTypes);
479
480
		return result;
481
	}
482
483
	/**
484
	 * @generated
485
	 */
486
	private ToolEntry createObjectFlow2CreationTool() {
487
		ImageDescriptor smallImage;
488
		ImageDescriptor largeImage;
489
490
		smallImage = UMLElementTypes.getImageDescriptor(UMLElementTypes.ObjectFlow_4002);
491
492
		largeImage = smallImage;
493
494
		final List relationshipTypes = new ArrayList();
495
		relationshipTypes.add(UMLElementTypes.ObjectFlow_4002);
496
		ToolEntry result = new LinkToolEntry("Object Flow", "Create Object Flow", smallImage, largeImage, relationshipTypes);
497
498
		return result;
499
	}
500
501
	/**
502
	 * @generated
503
	 */
504
	private static class NodeToolEntry extends ToolEntry {
505
506
		/**
507
		 * @generated
508
		 */
509
		private final List elementTypes;
510
511
		/**
512
		 * @generated
513
		 */
514
		private NodeToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, List elementTypes) {
515
			super(title, description, smallIcon, largeIcon);
516
			this.elementTypes = elementTypes;
517
		}
518
519
		/**
520
		 * @generated
521
		 */
522
		public Tool createTool() {
523
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
524
			tool.setProperties(getToolProperties());
525
			return tool;
526
		}
527
	}
528
529
	/**
530
	 * @generated
531
	 */
532
	private static class LinkToolEntry extends ToolEntry {
533
534
		/**
535
		 * @generated
536
		 */
537
		private final List relationshipTypes;
538
539
		/**
540
		 * @generated
541
		 */
542
		private LinkToolEntry(String title, String description, ImageDescriptor smallIcon, ImageDescriptor largeIcon, List relationshipTypes) {
543
			super(title, description, smallIcon, largeIcon);
544
			this.relationshipTypes = relationshipTypes;
545
		}
546
547
		/**
548
		 * @generated
549
		 */
550
		public Tool createTool() {
551
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
552
			tool.setProperties(getToolProperties());
553
			return tool;
554
		}
555
	}
556
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CentralBufferNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class CentralBufferNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinEditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.InputPinItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class InputPinEditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3003;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public InputPinEditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPinItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return InputPinEditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinNameEditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof InputPinNameEditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/DataStoreNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class DataStoreNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/PinNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class PinNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5002;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public PinNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.Pin_2014;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OpaqueActionEditPart.java (+296 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.requests.CreateRequest;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
17
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
18
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
19
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.notation.View;
23
import org.eclipse.uml2.diagram.activity.edit.policies.OpaqueActionCanonicalEditPolicy;
24
import org.eclipse.uml2.diagram.activity.edit.policies.OpaqueActionItemSemanticEditPolicy;
25
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
26
27
/**
28
 * @generated
29
 */
30
public class OpaqueActionEditPart extends AbstractBorderedShapeEditPart {
31
32
	/**
33
	 * @generated
34
	 */
35
	public static final int VISUAL_ID = 2010;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure contentPane;
41
42
	/**
43
	 * @generated
44
	 */
45
	protected IFigure primaryShape;
46
47
	/**
48
	 * @generated
49
	 */
50
	public OpaqueActionEditPart(View view) {
51
		super(view);
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected void createDefaultEditPolicies() {
58
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
59
		super.createDefaultEditPolicies();
60
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OpaqueActionItemSemanticEditPolicy());
61
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
62
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new OpaqueActionCanonicalEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected EditPolicy createChildEditPolicy(EditPart child) {
74
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
75
				if (result == null) {
76
					result = new NonResizableEditPolicy();
77
				}
78
				return result;
79
			}
80
81
			protected Command getMoveChildrenCommand(Request request) {
82
				return null;
83
			}
84
85
			protected Command getCreateCommand(CreateRequest request) {
86
				return null;
87
			}
88
		};
89
		return lep;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected IFigure createNodeShape() {
96
		ActionBaseFigure figure = new ActionBaseFigure();
97
		return primaryShape = figure;
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	public ActionBaseFigure getPrimaryShape() {
104
		return (ActionBaseFigure) primaryShape;
105
	}
106
107
	/**
108
	 * @generated 
109
	 */
110
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
111
		if (editPart instanceof OutputPinEditPart) {
112
			return getBorderedFigure().getBorderItemContainer();
113
		}
114
115
		return super.getContentPaneFor(editPart);
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	protected boolean addFixedChild(EditPart childEditPart) {
122
		if (childEditPart instanceof OpaqueActionNameEditPart) {
123
			((OpaqueActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureActionBaseFigure_name());
124
			return true;
125
		}
126
		if (childEditPart instanceof OutputPinEditPart) {
127
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.EAST);
128
			getBorderedFigure().getBorderItemContainer().add(((OutputPinEditPart) childEditPart).getFigure(), locator);
129
			return true;
130
		}
131
		return false;
132
	}
133
134
	/**
135
	 * @generated
136
	 */
137
	protected boolean removeFixedChild(EditPart childEditPart) {
138
		if (childEditPart instanceof OutputPinEditPart) {
139
			getBorderedFigure().getBorderItemContainer().remove(((OutputPinEditPart) childEditPart).getFigure());
140
			return true;
141
		}
142
		return false;
143
	}
144
145
	/**
146
	 * @generated
147
	 */
148
	protected NodeFigure createNodePlate() {
149
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(50));
150
		return result;
151
	}
152
153
	/**
154
	 * Creates figure for this edit part.
155
	 * 
156
	 * Body of this method does not depend on settings in generation model
157
	 * so you may safely remove <i>generated</i> tag and modify it.
158
	 * 
159
	 * @generated
160
	 */
161
	protected NodeFigure createMainFigure() {
162
		NodeFigure figure = createNodePlate();
163
		figure.setLayoutManager(new StackLayout());
164
		IFigure shape = createNodeShape();
165
		figure.add(shape);
166
		contentPane = setupContentPane(shape);
167
		return figure;
168
	}
169
170
	/**
171
	 * Default implementation treats passed figure as content pane.
172
	 * Respects layout one may have set for generated figure.
173
	 * @param nodeShape instance of generated figure class
174
	 * @generated
175
	 */
176
	protected IFigure setupContentPane(IFigure nodeShape) {
177
		if (nodeShape.getLayoutManager() == null) {
178
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
179
			layout.setSpacing(getMapMode().DPtoLP(5));
180
			nodeShape.setLayoutManager(layout);
181
		}
182
		return nodeShape; // use nodeShape itself as contentPane
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	public IFigure getContentPane() {
189
		if (contentPane != null) {
190
			return contentPane;
191
		}
192
		return super.getContentPane();
193
	}
194
195
	/**
196
	 * @generated
197
	 */
198
	public EditPart getPrimaryChildEditPart() {
199
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(OpaqueActionNameEditPart.VISUAL_ID));
200
	}
201
202
	/**
203
	 * @generated
204
	 */
205
	protected void addChildVisual(EditPart childEditPart, int index) {
206
		if (addFixedChild(childEditPart)) {
207
			return;
208
		}
209
		super.addChildVisual(childEditPart, -1);
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	protected void removeChildVisual(EditPart childEditPart) {
216
		if (removeFixedChild(childEditPart)) {
217
			return;
218
		}
219
		super.removeChildVisual(childEditPart);
220
	}
221
222
	/**
223
	 * @generated
224
	 */
225
	public class ActionBaseFigure extends org.eclipse.draw2d.RoundedRectangle {
226
227
		/**
228
		 * @generated
229
		 */
230
		public ActionBaseFigure() {
231
232
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
233
234
			this.setLayoutManager(myGenLayoutManager);
235
236
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
237
238
			createContents();
239
		}
240
241
		/**
242
		 * @generated
243
		 */
244
		private void createContents() {
245
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
246
247
			fig_0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
248
249
			setFigureActionBaseFigure_name(fig_0);
250
251
			Object layData0 = null;
252
253
			this.add(fig_0, layData0);
254
		}
255
256
		/**
257
		 * @generated
258
		 */
259
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fActionBaseFigure_name;
260
261
		/**
262
		 * @generated
263
		 */
264
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureActionBaseFigure_name() {
265
			return fActionBaseFigure_name;
266
		}
267
268
		/**
269
		 * @generated
270
		 */
271
		private void setFigureActionBaseFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
272
			fActionBaseFigure_name = fig;
273
		}
274
275
		/**
276
		 * @generated
277
		 */
278
		private boolean myUseLocalCoordinates = false;
279
280
		/**
281
		 * @generated
282
		 */
283
		protected boolean useLocalCoordinates() {
284
			return myUseLocalCoordinates;
285
		}
286
287
		/**
288
		 * @generated
289
		 */
290
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
291
			myUseLocalCoordinates = useLocalCoordinates;
292
		}
293
294
	}
295
296
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLElementTypes.java (+526 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.HashSet;
6
import java.util.IdentityHashMap;
7
import java.util.List;
8
import java.util.Map;
9
import java.util.Set;
10
11
import org.eclipse.core.runtime.IAdaptable;
12
import org.eclipse.emf.common.util.BasicEList;
13
import org.eclipse.emf.common.util.EList;
14
import org.eclipse.emf.ecore.EClass;
15
import org.eclipse.emf.ecore.ENamedElement;
16
import org.eclipse.emf.ecore.EObject;
17
import org.eclipse.emf.ecore.EStructuralFeature;
18
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
19
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
20
import org.eclipse.jface.resource.ImageDescriptor;
21
import org.eclipse.jface.resource.ImageRegistry;
22
import org.eclipse.swt.graphics.Image;
23
import org.eclipse.uml2.diagram.activity.expressions.UMLAbstractExpression;
24
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
25
import org.eclipse.uml2.uml.AcceptEventAction;
26
import org.eclipse.uml2.uml.UMLPackage;
27
28
/**
29
 * @generated
30
 */
31
public class UMLElementTypes {
32
33
	/**
34
	 * @generated
35
	 */
36
	private UMLElementTypes() {
37
	}
38
39
	/**
40
	 * @generated
41
	 */
42
	private static Map elements;
43
44
	/**
45
	 * @generated
46
	 */
47
	private static ImageRegistry imageRegistry;
48
49
	/**
50
	 * @generated
51
	 */
52
	private static ImageRegistry getImageRegistry() {
53
		if (imageRegistry == null) {
54
			imageRegistry = new ImageRegistry();
55
		}
56
		return imageRegistry;
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	private static String getImageRegistryKey(ENamedElement element) {
63
		return element.getName();
64
	}
65
66
	/**
67
	 * @generated
68
	 */
69
	private static ImageDescriptor getProvidedImageDescriptor(ENamedElement element) {
70
		if (element instanceof EStructuralFeature) {
71
			element = ((EStructuralFeature) element).getEContainingClass();
72
		}
73
		if (element instanceof EClass) {
74
			EClass eClass = (EClass) element;
75
			if (!eClass.isAbstract()) {
76
				return UMLDiagramEditorPlugin.getInstance().getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
77
			}
78
		}
79
		// TODO : support structural features
80
		return null;
81
	}
82
83
	/**
84
	 * @generated
85
	 */
86
	public static ImageDescriptor getImageDescriptor(ENamedElement element) {
87
		String key = getImageRegistryKey(element);
88
		ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
89
		if (imageDescriptor == null) {
90
			imageDescriptor = getProvidedImageDescriptor(element);
91
			if (imageDescriptor == null) {
92
				imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
93
			}
94
			getImageRegistry().put(key, imageDescriptor);
95
		}
96
		return imageDescriptor;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	public static Image getImage(ENamedElement element) {
103
		String key = getImageRegistryKey(element);
104
		Image image = getImageRegistry().get(key);
105
		if (image == null) {
106
			ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
107
			if (imageDescriptor == null) {
108
				imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
109
			}
110
			getImageRegistry().put(key, imageDescriptor);
111
			image = getImageRegistry().get(key);
112
		}
113
		return image;
114
	}
115
116
	/**
117
	 * @generated
118
	 */
119
	public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
120
		ENamedElement element = getElement(hint);
121
		if (element == null) {
122
			return null;
123
		}
124
		return getImageDescriptor(element);
125
	}
126
127
	/**
128
	 * @generated
129
	 */
130
	public static Image getImage(IAdaptable hint) {
131
		ENamedElement element = getElement(hint);
132
		if (element == null) {
133
			return null;
134
		}
135
		return getImage(element);
136
	}
137
138
	/**
139
	 * Returns 'type' of the ecore object associated with the hint.
140
	 * 
141
	 * @generated
142
	 */
143
	public static ENamedElement getElement(IAdaptable hint) {
144
		Object type = hint.getAdapter(IElementType.class);
145
		if (elements == null) {
146
			elements = new IdentityHashMap();
147
			elements.put(Activity_1000, UMLPackage.eINSTANCE.getActivity());
148
			elements.put(OutputPin_3001, UMLPackage.eINSTANCE.getOutputPin());
149
			elements.put(OutputPin_3002, UMLPackage.eINSTANCE.getOutputPin());
150
			elements.put(InputPin_3003, UMLPackage.eINSTANCE.getInputPin());
151
			elements.put(InputPin_3004, UMLPackage.eINSTANCE.getInputPin());
152
			elements.put(InputPin_3005, UMLPackage.eINSTANCE.getInputPin());
153
			elements.put(OutputPin_3006, UMLPackage.eINSTANCE.getOutputPin());
154
			elements.put(InputPin_3007, UMLPackage.eINSTANCE.getInputPin());
155
			elements.put(InputPin_3008, UMLPackage.eINSTANCE.getInputPin());
156
			elements.put(AcceptEventAction_2001, UMLPackage.eINSTANCE.getAcceptEventAction());
157
			elements.put(AcceptEventAction_2002, UMLPackage.eINSTANCE.getAcceptEventAction());
158
			elements.put(ActivityFinalNode_2003, UMLPackage.eINSTANCE.getActivityFinalNode());
159
			elements.put(DecisionNode_2004, UMLPackage.eINSTANCE.getDecisionNode());
160
			elements.put(MergeNode_2005, UMLPackage.eINSTANCE.getMergeNode());
161
			elements.put(InitialNode_2006, UMLPackage.eINSTANCE.getInitialNode());
162
			elements.put(StructuredActivityNode_2007, UMLPackage.eINSTANCE.getStructuredActivityNode());
163
			elements.put(DataStoreNode_2008, UMLPackage.eINSTANCE.getDataStoreNode());
164
			elements.put(CentralBufferNode_2009, UMLPackage.eINSTANCE.getCentralBufferNode());
165
			elements.put(OpaqueAction_2010, UMLPackage.eINSTANCE.getOpaqueAction());
166
			elements.put(FlowFinalNode_2011, UMLPackage.eINSTANCE.getFlowFinalNode());
167
			elements.put(ForkNode_2012, UMLPackage.eINSTANCE.getForkNode());
168
			elements.put(JoinNode_2013, UMLPackage.eINSTANCE.getJoinNode());
169
			elements.put(Pin_2014, UMLPackage.eINSTANCE.getPin());
170
			elements.put(CreateObjectAction_2015, UMLPackage.eINSTANCE.getCreateObjectAction());
171
			elements.put(AddStructuralFeatureValueAction_2016, UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction());
172
			elements.put(CallBehaviorAction_2017, UMLPackage.eINSTANCE.getCallBehaviorAction());
173
			elements.put(CallOperationAction_2018, UMLPackage.eINSTANCE.getCallOperationAction());
174
			elements.put(ControlFlow_4001, UMLPackage.eINSTANCE.getControlFlow());
175
			elements.put(ObjectFlow_4002, UMLPackage.eINSTANCE.getObjectFlow());
176
		}
177
		return (ENamedElement) elements.get(type);
178
	}
179
180
	/**
181
	 * @generated
182
	 */
183
	public static final IElementType Activity_1000 = getElementType("org.eclipse.uml2.diagram.activity.Activity_1000"); //$NON-NLS-1$
184
185
	/**
186
	 * @generated
187
	 */
188
	public static final IElementType OutputPin_3001 = getElementType("org.eclipse.uml2.diagram.activity.OutputPin_3001"); //$NON-NLS-1$
189
190
	/**
191
	 * @generated
192
	 */
193
	public static final IElementType OutputPin_3002 = getElementType("org.eclipse.uml2.diagram.activity.OutputPin_3002"); //$NON-NLS-1$
194
195
	/**
196
	 * @generated
197
	 */
198
	public static final IElementType InputPin_3003 = getElementType("org.eclipse.uml2.diagram.activity.InputPin_3003"); //$NON-NLS-1$
199
200
	/**
201
	 * @generated
202
	 */
203
	public static final IElementType InputPin_3004 = getElementType("org.eclipse.uml2.diagram.activity.InputPin_3004"); //$NON-NLS-1$
204
205
	/**
206
	 * @generated
207
	 */
208
	public static final IElementType InputPin_3005 = getElementType("org.eclipse.uml2.diagram.activity.InputPin_3005"); //$NON-NLS-1$
209
210
	/**
211
	 * @generated
212
	 */
213
	public static final IElementType OutputPin_3006 = getElementType("org.eclipse.uml2.diagram.activity.OutputPin_3006"); //$NON-NLS-1$
214
215
	/**
216
	 * @generated
217
	 */
218
	public static final IElementType InputPin_3007 = getElementType("org.eclipse.uml2.diagram.activity.InputPin_3007"); //$NON-NLS-1$
219
220
	/**
221
	 * @generated
222
	 */
223
	public static final IElementType InputPin_3008 = getElementType("org.eclipse.uml2.diagram.activity.InputPin_3008"); //$NON-NLS-1$
224
225
	/**
226
	 * @generated
227
	 */
228
	public static final IElementType AcceptEventAction_2001 = getElementType("org.eclipse.uml2.diagram.activity.AcceptEventAction_2001"); //$NON-NLS-1$
229
230
	/**
231
	 * @generated
232
	 */
233
	public static final IElementType AcceptEventAction_2002 = getElementType("org.eclipse.uml2.diagram.activity.AcceptEventAction_2002"); //$NON-NLS-1$
234
235
	/**
236
	 * @generated
237
	 */
238
	public static final IElementType ActivityFinalNode_2003 = getElementType("org.eclipse.uml2.diagram.activity.ActivityFinalNode_2003"); //$NON-NLS-1$
239
240
	/**
241
	 * @generated
242
	 */
243
	public static final IElementType DecisionNode_2004 = getElementType("org.eclipse.uml2.diagram.activity.DecisionNode_2004"); //$NON-NLS-1$
244
245
	/**
246
	 * @generated
247
	 */
248
	public static final IElementType MergeNode_2005 = getElementType("org.eclipse.uml2.diagram.activity.MergeNode_2005"); //$NON-NLS-1$
249
250
	/**
251
	 * @generated
252
	 */
253
	public static final IElementType InitialNode_2006 = getElementType("org.eclipse.uml2.diagram.activity.InitialNode_2006"); //$NON-NLS-1$
254
255
	/**
256
	 * @generated
257
	 */
258
	public static final IElementType StructuredActivityNode_2007 = getElementType("org.eclipse.uml2.diagram.activity.StructuredActivityNode_2007"); //$NON-NLS-1$
259
260
	/**
261
	 * @generated
262
	 */
263
	public static final IElementType DataStoreNode_2008 = getElementType("org.eclipse.uml2.diagram.activity.DataStoreNode_2008"); //$NON-NLS-1$
264
265
	/**
266
	 * @generated
267
	 */
268
	public static final IElementType CentralBufferNode_2009 = getElementType("org.eclipse.uml2.diagram.activity.CentralBufferNode_2009"); //$NON-NLS-1$
269
270
	/**
271
	 * @generated
272
	 */
273
	public static final IElementType OpaqueAction_2010 = getElementType("org.eclipse.uml2.diagram.activity.OpaqueAction_2010"); //$NON-NLS-1$
274
275
	/**
276
	 * @generated
277
	 */
278
	public static final IElementType FlowFinalNode_2011 = getElementType("org.eclipse.uml2.diagram.activity.FlowFinalNode_2011"); //$NON-NLS-1$
279
280
	/**
281
	 * @generated
282
	 */
283
	public static final IElementType ForkNode_2012 = getElementType("org.eclipse.uml2.diagram.activity.ForkNode_2012"); //$NON-NLS-1$
284
285
	/**
286
	 * @generated
287
	 */
288
	public static final IElementType JoinNode_2013 = getElementType("org.eclipse.uml2.diagram.activity.JoinNode_2013"); //$NON-NLS-1$
289
290
	/**
291
	 * @generated
292
	 */
293
	public static final IElementType Pin_2014 = getElementType("org.eclipse.uml2.diagram.activity.Pin_2014"); //$NON-NLS-1$
294
295
	/**
296
	 * @generated
297
	 */
298
	public static final IElementType CreateObjectAction_2015 = getElementType("org.eclipse.uml2.diagram.activity.CreateObjectAction_2015"); //$NON-NLS-1$
299
300
	/**
301
	 * @generated
302
	 */
303
	public static final IElementType AddStructuralFeatureValueAction_2016 = getElementType("org.eclipse.uml2.diagram.activity.AddStructuralFeatureValueAction_2016"); //$NON-NLS-1$
304
305
	/**
306
	 * @generated
307
	 */
308
	public static final IElementType CallBehaviorAction_2017 = getElementType("org.eclipse.uml2.diagram.activity.CallBehaviorAction_2017"); //$NON-NLS-1$
309
310
	/**
311
	 * @generated
312
	 */
313
	public static final IElementType CallOperationAction_2018 = getElementType("org.eclipse.uml2.diagram.activity.CallOperationAction_2018"); //$NON-NLS-1$
314
315
	/**
316
	 * @generated
317
	 */
318
	public static final IElementType ControlFlow_4001 = getElementType("org.eclipse.uml2.diagram.activity.ControlFlow_4001"); //$NON-NLS-1$
319
320
	/**
321
	 * @generated
322
	 */
323
	public static final IElementType ObjectFlow_4002 = getElementType("org.eclipse.uml2.diagram.activity.ObjectFlow_4002"); //$NON-NLS-1$
324
325
	/**
326
	 * @generated
327
	 */
328
	private static IElementType getElementType(String id) {
329
		return ElementTypeRegistry.getInstance().getType(id);
330
	}
331
332
	/**
333
	 * @generated
334
	 */
335
	private static Set KNOWN_ELEMENT_TYPES;
336
337
	/**
338
	 * @generated
339
	 */
340
	public static boolean isKnownElementType(IElementType elementType) {
341
		if (KNOWN_ELEMENT_TYPES == null) {
342
			KNOWN_ELEMENT_TYPES = new HashSet();
343
			KNOWN_ELEMENT_TYPES.add(Activity_1000);
344
			KNOWN_ELEMENT_TYPES.add(OutputPin_3001);
345
			KNOWN_ELEMENT_TYPES.add(OutputPin_3002);
346
			KNOWN_ELEMENT_TYPES.add(InputPin_3003);
347
			KNOWN_ELEMENT_TYPES.add(InputPin_3004);
348
			KNOWN_ELEMENT_TYPES.add(InputPin_3005);
349
			KNOWN_ELEMENT_TYPES.add(OutputPin_3006);
350
			KNOWN_ELEMENT_TYPES.add(InputPin_3007);
351
			KNOWN_ELEMENT_TYPES.add(InputPin_3008);
352
			KNOWN_ELEMENT_TYPES.add(AcceptEventAction_2001);
353
			KNOWN_ELEMENT_TYPES.add(AcceptEventAction_2002);
354
			KNOWN_ELEMENT_TYPES.add(ActivityFinalNode_2003);
355
			KNOWN_ELEMENT_TYPES.add(DecisionNode_2004);
356
			KNOWN_ELEMENT_TYPES.add(MergeNode_2005);
357
			KNOWN_ELEMENT_TYPES.add(InitialNode_2006);
358
			KNOWN_ELEMENT_TYPES.add(StructuredActivityNode_2007);
359
			KNOWN_ELEMENT_TYPES.add(DataStoreNode_2008);
360
			KNOWN_ELEMENT_TYPES.add(CentralBufferNode_2009);
361
			KNOWN_ELEMENT_TYPES.add(OpaqueAction_2010);
362
			KNOWN_ELEMENT_TYPES.add(FlowFinalNode_2011);
363
			KNOWN_ELEMENT_TYPES.add(ForkNode_2012);
364
			KNOWN_ELEMENT_TYPES.add(JoinNode_2013);
365
			KNOWN_ELEMENT_TYPES.add(Pin_2014);
366
			KNOWN_ELEMENT_TYPES.add(CreateObjectAction_2015);
367
			KNOWN_ELEMENT_TYPES.add(AddStructuralFeatureValueAction_2016);
368
			KNOWN_ELEMENT_TYPES.add(CallBehaviorAction_2017);
369
			KNOWN_ELEMENT_TYPES.add(CallOperationAction_2018);
370
			KNOWN_ELEMENT_TYPES.add(ControlFlow_4001);
371
			KNOWN_ELEMENT_TYPES.add(ObjectFlow_4002);
372
		}
373
		return KNOWN_ELEMENT_TYPES.contains(elementType);
374
	}
375
376
	/**
377
	 * @generated
378
	 */
379
	public static class Initializers {
380
381
		/**
382
		 * @generated
383
		 */
384
		public static final IObjectInitializer AcceptEventAction_2002 = new ObjectInitializer(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getAcceptEventAction()) {
385
386
			protected void init() {
387
				add(createExpressionFeatureInitializer(UMLPackage.eINSTANCE.getAcceptEventAction_Trigger(), new UMLAbstractExpression(UMLPackage.eINSTANCE.getAcceptEventAction()) {
388
389
					protected Object doEvaluate(Object context, Map env) {
390
						AcceptEventAction self = (AcceptEventAction) context;
391
						return Java.initAcceptTimeEventActionTrigger(self);
392
					}
393
				}));
394
			}
395
		}; // AcceptEventAction_2002 ObjectInitializer
396
397
		/** 
398
		 * @generated
399
		 */
400
		private Initializers() {
401
		}
402
403
		/** 
404
		 * @generated
405
		 */
406
		public static interface IObjectInitializer {
407
408
			/** 
409
			 * @generated
410
			 */
411
			public void init(EObject instance);
412
		}
413
414
		/** 
415
		 * @generated
416
		 */
417
		public static abstract class ObjectInitializer implements IObjectInitializer {
418
419
			/** 
420
			 * @generated
421
			 */
422
			final EClass element;
423
424
			/** 
425
			 * @generated
426
			 */
427
			private List featureInitializers = new ArrayList();
428
429
			/** 
430
			 * @generated
431
			 */
432
			ObjectInitializer(EClass element) {
433
				this.element = element;
434
				init();
435
			}
436
437
			/**
438
			 * @generated
439
			 */
440
			protected abstract void init();
441
442
			/** 
443
			 * @generated
444
			 */
445
			protected final FeatureInitializer add(FeatureInitializer initializer) {
446
				featureInitializers.add(initializer);
447
				return initializer;
448
			}
449
450
			/** 
451
			 * @generated
452
			 */
453
			public void init(EObject instance) {
454
				for (java.util.Iterator it = featureInitializers.iterator(); it.hasNext();) {
455
					FeatureInitializer nextExpr = (FeatureInitializer) it.next();
456
					try {
457
						nextExpr.init(instance);
458
					} catch (RuntimeException e) {
459
						UMLDiagramEditorPlugin.getInstance().logError("Feature initialization failed", e); //$NON-NLS-1$						
460
					}
461
				}
462
			}
463
		} // end of ObjectInitializer
464
465
		/** 
466
		 * @generated
467
		 */
468
		interface FeatureInitializer {
469
470
			/**
471
			 * @generated
472
			 */
473
			void init(EObject contextInstance);
474
		}
475
476
		/**
477
		 * @generated
478
		 */
479
		static FeatureInitializer createNewElementFeatureInitializer(EStructuralFeature initFeature, ObjectInitializer[] newObjectInitializers) {
480
			final EStructuralFeature feature = initFeature;
481
			final ObjectInitializer[] initializers = newObjectInitializers;
482
			return new FeatureInitializer() {
483
484
				public void init(EObject contextInstance) {
485
					for (int i = 0; i < initializers.length; i++) {
486
						EObject newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);
487
						if (feature.isMany()) {
488
							((Collection) contextInstance.eGet(feature)).add(newInstance);
489
						} else {
490
							contextInstance.eSet(feature, newInstance);
491
						}
492
						initializers[i].init(newInstance);
493
					}
494
				}
495
			};
496
		}
497
498
		/**
499
		 * @generated
500
		 */
501
		static FeatureInitializer createExpressionFeatureInitializer(EStructuralFeature initFeature, UMLAbstractExpression valueExpression) {
502
			final EStructuralFeature feature = initFeature;
503
			final UMLAbstractExpression expression = valueExpression;
504
			return new FeatureInitializer() {
505
506
				public void init(EObject contextInstance) {
507
					expression.assignTo(feature, contextInstance);
508
				}
509
			};
510
		}
511
512
		/** 
513
		 * @generated
514
		 */
515
		static class Java {
516
517
			/**
518
			 * @generated NOT
519
			 */
520
			private static EList initAcceptTimeEventActionTrigger(AcceptEventAction self) {
521
				new AcceptEventAction_2002_Initializer().init(self);
522
				return new BasicEList();
523
			}
524
		} //Java
525
	} // end of Initializers
526
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorLinkHelper.java (+84 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.core.resources.IFile;
4
import org.eclipse.emf.ecore.EObject;
5
import org.eclipse.emf.ecore.resource.Resource;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gmf.runtime.notation.View;
8
import org.eclipse.jface.viewers.IStructuredSelection;
9
import org.eclipse.jface.viewers.StructuredSelection;
10
import org.eclipse.ui.IEditorInput;
11
import org.eclipse.ui.IEditorPart;
12
import org.eclipse.ui.IWorkbenchPage;
13
import org.eclipse.ui.navigator.ILinkHelper;
14
import org.eclipse.ui.part.FileEditorInput;
15
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
16
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditor;
17
18
/**
19
 * @generated
20
 */
21
public class UMLNavigatorLinkHelper implements ILinkHelper {
22
23
	/**
24
	 * @generated
25
	 */
26
	public IStructuredSelection findSelection(IEditorInput anInput) {
27
		return StructuredSelection.EMPTY;
28
	}
29
30
	/**
31
	 * @generated
32
	 */
33
	public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
34
		if (aSelection == null || aSelection.isEmpty()) {
35
			return;
36
		}
37
		if (aSelection.getFirstElement() instanceof UMLAbstractNavigatorItem) {
38
			UMLAbstractNavigatorItem navigatorItem = (UMLAbstractNavigatorItem) aSelection.getFirstElement();
39
			if (!ActivityEditPart.MODEL_ID.equals(navigatorItem.getModelID())) {
40
				return;
41
			}
42
			Object parentFile = navigatorItem.getParent();
43
			while (parentFile instanceof UMLAbstractNavigatorItem) {
44
				parentFile = ((UMLAbstractNavigatorItem) parentFile).getParent();
45
			}
46
			if (false == parentFile instanceof IFile) {
47
				return;
48
			}
49
			IEditorInput fileInput = new FileEditorInput((IFile) parentFile);
50
			IEditorPart editor = aPage.findEditor(fileInput);
51
			if (editor == null) {
52
				return;
53
			}
54
			aPage.bringToTop(editor);
55
			if (editor instanceof UMLDiagramEditor) {
56
				UMLDiagramEditor diagramEditor = (UMLDiagramEditor) editor;
57
				Resource diagramResource = diagramEditor.getDiagram().eResource();
58
59
				View navigatorView = null;
60
				if (navigatorItem instanceof UMLNavigatorItem) {
61
					navigatorView = ((UMLNavigatorItem) navigatorItem).getView();
62
				} else if (navigatorItem instanceof UMLNavigatorGroup) {
63
					UMLNavigatorGroup group = (UMLNavigatorGroup) navigatorItem;
64
					if (group.getParent() instanceof UMLNavigatorItem) {
65
						navigatorView = ((UMLNavigatorItem) group.getParent()).getView();
66
					}
67
				}
68
69
				if (navigatorView == null) {
70
					return;
71
				}
72
				EObject selectedView = diagramResource.getEObject(navigatorView.eResource().getURIFragment(navigatorView));
73
				if (selectedView == null) {
74
					return;
75
				}
76
				EditPart selectedEditPart = (EditPart) diagramEditor.getDiagramGraphicalViewer().getEditPartRegistry().get(selectedView);
77
				if (selectedEditPart != null) {
78
					diagramEditor.getDiagramGraphicalViewer().select(selectedEditPart);
79
				}
80
			}
81
		}
82
	}
83
84
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/UMLEditPartFactory.java (+233 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.FigureUtilities;
4
import org.eclipse.draw2d.IFigure;
5
import org.eclipse.draw2d.Label;
6
import org.eclipse.draw2d.geometry.Dimension;
7
import org.eclipse.draw2d.geometry.Rectangle;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPartFactory;
10
import org.eclipse.gef.tools.CellEditorLocator;
11
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
12
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
13
import org.eclipse.gmf.runtime.notation.View;
14
import org.eclipse.jface.viewers.CellEditor;
15
import org.eclipse.swt.SWT;
16
import org.eclipse.swt.widgets.Text;
17
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
18
19
/**
20
 * @generated
21
 */
22
public class UMLEditPartFactory implements EditPartFactory {
23
24
	/**
25
	 * @generated
26
	 */
27
	public static final String EXTERNAL_NODE_LABELS_LAYER = "External Node Labels"; //$NON-NLS-1$
28
29
	/**
30
	 * @generated
31
	 */
32
	public EditPart createEditPart(EditPart context, Object model) {
33
		if (model instanceof View) {
34
			View view = (View) model;
35
			int viewVisualID = UMLVisualIDRegistry.getVisualID(view);
36
			switch (viewVisualID) {
37
			case AcceptEventActionEditPart.VISUAL_ID:
38
				return new AcceptEventActionEditPart(view);
39
			case AcceptEventAction2EditPart.VISUAL_ID:
40
				return new AcceptEventAction2EditPart(view);
41
			case ActivityFinalNodeEditPart.VISUAL_ID:
42
				return new ActivityFinalNodeEditPart(view);
43
			case DecisionNodeEditPart.VISUAL_ID:
44
				return new DecisionNodeEditPart(view);
45
			case MergeNodeEditPart.VISUAL_ID:
46
				return new MergeNodeEditPart(view);
47
			case InitialNodeEditPart.VISUAL_ID:
48
				return new InitialNodeEditPart(view);
49
			case StructuredActivityNodeEditPart.VISUAL_ID:
50
				return new StructuredActivityNodeEditPart(view);
51
			case DataStoreNodeEditPart.VISUAL_ID:
52
				return new DataStoreNodeEditPart(view);
53
			case CentralBufferNodeEditPart.VISUAL_ID:
54
				return new CentralBufferNodeEditPart(view);
55
			case OpaqueActionEditPart.VISUAL_ID:
56
				return new OpaqueActionEditPart(view);
57
			case OpaqueActionNameEditPart.VISUAL_ID:
58
				return new OpaqueActionNameEditPart(view);
59
			case FlowFinalNodeEditPart.VISUAL_ID:
60
				return new FlowFinalNodeEditPart(view);
61
			case ForkNodeEditPart.VISUAL_ID:
62
				return new ForkNodeEditPart(view);
63
			case JoinNodeEditPart.VISUAL_ID:
64
				return new JoinNodeEditPart(view);
65
			case PinEditPart.VISUAL_ID:
66
				return new PinEditPart(view);
67
			case PinNameEditPart.VISUAL_ID:
68
				return new PinNameEditPart(view);
69
			case CreateObjectActionEditPart.VISUAL_ID:
70
				return new CreateObjectActionEditPart(view);
71
			case CreateObjectActionNameEditPart.VISUAL_ID:
72
				return new CreateObjectActionNameEditPart(view);
73
			case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
74
				return new AddStructuralFeatureValueActionEditPart(view);
75
			case AddStructuralFeatureValueActionNameEditPart.VISUAL_ID:
76
				return new AddStructuralFeatureValueActionNameEditPart(view);
77
			case CallBehaviorActionEditPart.VISUAL_ID:
78
				return new CallBehaviorActionEditPart(view);
79
			case CallBehaviorActionNameEditPart.VISUAL_ID:
80
				return new CallBehaviorActionNameEditPart(view);
81
			case CallOperationActionEditPart.VISUAL_ID:
82
				return new CallOperationActionEditPart(view);
83
			case CallOperationActionNameEditPart.VISUAL_ID:
84
				return new CallOperationActionNameEditPart(view);
85
			case OutputPinEditPart.VISUAL_ID:
86
				return new OutputPinEditPart(view);
87
			case OutputPinNameEditPart.VISUAL_ID:
88
				return new OutputPinNameEditPart(view);
89
			case OutputPin2EditPart.VISUAL_ID:
90
				return new OutputPin2EditPart(view);
91
			case OutputPinName2EditPart.VISUAL_ID:
92
				return new OutputPinName2EditPart(view);
93
			case InputPinEditPart.VISUAL_ID:
94
				return new InputPinEditPart(view);
95
			case InputPinNameEditPart.VISUAL_ID:
96
				return new InputPinNameEditPart(view);
97
			case InputPin2EditPart.VISUAL_ID:
98
				return new InputPin2EditPart(view);
99
			case InputPinName2EditPart.VISUAL_ID:
100
				return new InputPinName2EditPart(view);
101
			case InputPin3EditPart.VISUAL_ID:
102
				return new InputPin3EditPart(view);
103
			case InputPinName3EditPart.VISUAL_ID:
104
				return new InputPinName3EditPart(view);
105
			case OutputPin3EditPart.VISUAL_ID:
106
				return new OutputPin3EditPart(view);
107
			case OutputPinName3EditPart.VISUAL_ID:
108
				return new OutputPinName3EditPart(view);
109
			case InputPin4EditPart.VISUAL_ID:
110
				return new InputPin4EditPart(view);
111
			case InputPinName4EditPart.VISUAL_ID:
112
				return new InputPinName4EditPart(view);
113
			case InputPin5EditPart.VISUAL_ID:
114
				return new InputPin5EditPart(view);
115
			case InputPinName5EditPart.VISUAL_ID:
116
				return new InputPinName5EditPart(view);
117
			case ActivityEditPart.VISUAL_ID:
118
				return new ActivityEditPart(view);
119
			case ControlFlowEditPart.VISUAL_ID:
120
				return new ControlFlowEditPart(view);
121
			case ObjectFlowEditPart.VISUAL_ID:
122
				return new ObjectFlowEditPart(view);
123
			}
124
		}
125
		return createUnrecognizedEditPart(context, model);
126
	}
127
128
	/**
129
	 * @generated
130
	 */
131
	private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
132
		// Handle creation of unrecognized child node EditParts here
133
		return null;
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
140
		if (source.getFigure() instanceof WrapLabel)
141
			return new TextCellEditorLocator((WrapLabel) source.getFigure());
142
		else {
143
			IFigure figure = source.getFigure();
144
			return new LabelCellEditorLocator((Label) figure);
145
		}
146
	}
147
148
	/**
149
	 * @generated
150
	 */
151
	static private class TextCellEditorLocator implements CellEditorLocator {
152
153
		/**
154
		 * @generated
155
		 */
156
		private WrapLabel wrapLabel;
157
158
		/**
159
		 * @generated
160
		 */
161
		public TextCellEditorLocator(WrapLabel wrapLabel) {
162
			super();
163
			this.wrapLabel = wrapLabel;
164
		}
165
166
		/**
167
		 * @generated
168
		 */
169
		public WrapLabel getWrapLabel() {
170
			return wrapLabel;
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		public void relocate(CellEditor celleditor) {
177
			Text text = (Text) celleditor.getControl();
178
			Rectangle rect = getWrapLabel().getTextBounds().getCopy();
179
			getWrapLabel().translateToAbsolute(rect);
180
181
			if (getWrapLabel().isTextWrapped() && getWrapLabel().getText().length() > 0)
182
				rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
183
			else {
184
				int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
185
				rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
186
			}
187
188
			if (!rect.equals(new Rectangle(text.getBounds())))
189
				text.setBounds(rect.x, rect.y, rect.width, rect.height);
190
		}
191
192
	}
193
194
	/**
195
	 * @generated
196
	 */
197
	private static class LabelCellEditorLocator implements CellEditorLocator {
198
199
		/**
200
		 * @generated
201
		 */
202
		private Label label;
203
204
		/**
205
		 * @generated
206
		 */
207
		public LabelCellEditorLocator(Label label) {
208
			this.label = label;
209
		}
210
211
		/**
212
		 * @generated
213
		 */
214
		public Label getLabel() {
215
			return label;
216
		}
217
218
		/**
219
		 * @generated
220
		 */
221
		public void relocate(CellEditor celleditor) {
222
			Text text = (Text) celleditor.getControl();
223
			Rectangle rect = getLabel().getTextBounds().getCopy();
224
			getLabel().translateToAbsolute(rect);
225
226
			int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
227
			rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
228
229
			if (!rect.equals(new Rectangle(text.getBounds())))
230
				text.setBounds(rect.x, rect.y, rect.width, rect.height);
231
		}
232
	}
233
}
(-)icons/obj16/UMLDiagramFile.gif (+6 lines)
Added Link Here
1
GIF89a¥	åëø___¿¿¿ÿߟÀÀÀ€€€ÿÿÀÀÀÿÿÿ?}IÒ輲ٌ™Ìf€À@´?=´?=°?>¬Œ@§‹B¢ˆC?…E—‚FƒwM~uN{sPÔ²iÚ½|àÈ?ùúü÷ùûõøûòõûðõûíòúêðùßéøÜç÷ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!ù?,pÀŸB,…H$ÄÃln I¤äC}<
2
œgô7yA×Nv¥„ΡkãL‰VD¢FC
3
¯D-£FÁZhŒFQzj$$‚„†}ˆŠIƒ{?
4
?QŒj
5
Q%„¢
6
%Q&&r«©Q°±²[µQA;
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramEditorUtil.java (+209 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.lang.reflect.InvocationTargetException;
6
import java.util.ArrayList;
7
import java.util.Collections;
8
import java.util.HashMap;
9
import java.util.List;
10
import java.util.Map;
11
12
import org.eclipse.core.resources.IResourceStatus;
13
import org.eclipse.core.resources.ResourcesPlugin;
14
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.commands.operations.OperationHistoryFactory;
17
import org.eclipse.core.resources.IFile;
18
import org.eclipse.core.resources.IResource;
19
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.NullProgressMonitor;
21
import org.eclipse.core.runtime.IAdaptable;
22
import org.eclipse.core.runtime.IPath;
23
import org.eclipse.core.runtime.IProgressMonitor;
24
import org.eclipse.core.runtime.Path;
25
import org.eclipse.core.runtime.SubProgressMonitor;
26
import org.eclipse.emf.common.util.URI;
27
import org.eclipse.emf.ecore.EObject;
28
import org.eclipse.emf.ecore.resource.Resource;
29
import org.eclipse.emf.ecore.resource.ResourceSet;
30
import org.eclipse.emf.ecore.xmi.XMIResource;
31
import org.eclipse.jface.dialogs.ErrorDialog;
32
33
import org.eclipse.emf.transaction.TransactionalEditingDomain;
34
import java.io.ByteArrayInputStream;
35
36
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
37
import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
38
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.util.DiagramFileCreator;
39
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
40
import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
41
import org.eclipse.gmf.runtime.notation.Diagram;
42
import org.eclipse.jface.operation.IRunnableContext;
43
import org.eclipse.jface.operation.IRunnableWithProgress;
44
import org.eclipse.swt.widgets.Shell;
45
import org.eclipse.ui.IEditorPart;
46
import org.eclipse.ui.IWorkbenchPage;
47
import org.eclipse.ui.IWorkbenchWindow;
48
import org.eclipse.ui.PartInitException;
49
import org.eclipse.ui.ide.IDE;
50
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
51
52
import org.eclipse.uml2.uml.Activity;
53
import org.eclipse.uml2.uml.UMLFactory;
54
55
/**
56
 * @generated
57
 */
58
public class UMLDiagramEditorUtil {
59
60
	/**
61
	 * @generated
62
	 */
63
	public static final URI createAndOpenDiagram(IPath containerPath, String fileName, IWorkbenchWindow window, IProgressMonitor progressMonitor, boolean openEditor, boolean saveDiagram) {
64
		IFile diagramFile = createNewDiagramFile(containerPath, fileName, window.getShell(), progressMonitor);
65
		if (diagramFile != null && openEditor) {
66
			openDiagramEditor(window, diagramFile, saveDiagram, progressMonitor);
67
		}
68
		return URI.createPlatformResourceURI(diagramFile.getFullPath().toString());
69
	}
70
71
	/**
72
	 * @generated
73
	 */
74
	public static final IEditorPart openDiagramEditor(IWorkbenchWindow window, IFile file, boolean saveDiagram, IProgressMonitor progressMonitor) {
75
		IEditorPart editorPart = null;
76
		try {
77
			IWorkbenchPage page = window.getActivePage();
78
			if (page != null) {
79
				editorPart = openDiagramEditor(page, file);
80
				if (saveDiagram) {
81
					editorPart.doSave(progressMonitor);
82
				}
83
			}
84
			file.refreshLocal(IResource.DEPTH_ZERO, null);
85
			return editorPart;
86
		} catch (Exception e) {
87
			UMLDiagramEditorPlugin.getInstance().logError("Error opening diagram", e);
88
		}
89
		return null;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public static final IEditorPart openDiagramEditor(IWorkbenchPage page, IFile file) throws PartInitException {
96
		return IDE.openEditor(page, file);
97
	}
98
99
	/**
100
	 * <p>
101
	 * This method should be called within a workspace modify operation since it creates resources.
102
	 * </p>
103
	 * @generated
104
	 * @return the created file resource, or <code>null</code> if the file was not created
105
	 */
106
	public static final IFile createNewDiagramFile(IPath containerFullPath, String fileName, Shell shell, IProgressMonitor progressMonitor) {
107
		TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
108
		ResourceSet resourceSet = editingDomain.getResourceSet();
109
		progressMonitor.beginTask("Creating diagram and model files", 3); //$NON-NLS-1$
110
		final IFile diagramFile = createNewFile(containerFullPath, fileName, shell);
111
		final Resource diagramResource = resourceSet.createResource(URI.createPlatformResourceURI(diagramFile.getFullPath().toString()));
112
		List affectedFiles = new ArrayList();
113
		affectedFiles.add(diagramFile);
114
		IPath modelFileRelativePath = diagramFile.getFullPath().removeFileExtension().addFileExtension("uml"); //$NON-NLS-1$
115
		IFile modelFile = diagramFile.getParent().getFile(new Path(modelFileRelativePath.lastSegment()));
116
		final Resource modelResource = resourceSet.createResource(URI.createPlatformResourceURI(modelFile.getFullPath().toString()));
117
		affectedFiles.add(modelFile);
118
		AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, "Creating diagram and model", affectedFiles) { //$NON-NLS-1$
119
120
			protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
121
				Activity model = createInitialModel();
122
				modelResource.getContents().add(createInitialRoot(model));
123
				Diagram diagram = ViewService.createDiagram(model, ActivityEditPart.MODEL_ID, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
124
				if (diagram != null) {
125
					diagramResource.getContents().add(diagram);
126
					diagram.setName(diagramFile.getName());
127
					diagram.setElement(model);
128
				}
129
				try {
130
					Map options = new HashMap();
131
					options.put(XMIResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
132
					modelResource.save(options);
133
					diagramResource.save(Collections.EMPTY_MAP);
134
				} catch (IOException e) {
135
136
					UMLDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
137
				}
138
				return CommandResult.newOKCommandResult();
139
			}
140
		};
141
142
		try {
143
			OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
144
		} catch (ExecutionException e) {
145
			UMLDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
146
		}
147
148
		try {
149
			modelFile.setCharset("UTF-8", new SubProgressMonitor(progressMonitor, 1)); //$NON-NLS-1$
150
		} catch (CoreException e) {
151
			UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for model file", e); //$NON-NLS-1$
152
		}
153
		try {
154
			diagramFile.setCharset("UTF-8", new SubProgressMonitor(progressMonitor, 1)); //$NON-NLS-1$
155
		} catch (CoreException e) {
156
			UMLDiagramEditorPlugin.getInstance().logError("Unable to set charset for diagram file", e); //$NON-NLS-1$
157
		}
158
159
		return diagramFile;
160
	}
161
162
	/**
163
	 * Create a new instance of domain element associated with canvas.
164
	 * <!-- begin-user-doc -->
165
	 * <!-- end-user-doc -->
166
	 * @generated
167
	 */
168
	private static Activity createInitialModel() {
169
		return UMLFactory.eINSTANCE.createActivity();
170
	}
171
172
	/**
173
	 * @generated
174
	 */
175
	private static EObject createInitialRoot(Activity model) {
176
		return model;
177
	}
178
179
	/**
180
	 * @generated
181
	 */
182
	public static IFile createNewFile(IPath containerPath, String fileName, Shell shell) {
183
		IPath newFilePath = containerPath.append(fileName);
184
		IFile newFileHandle = ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath);
185
		try {
186
			createFile(newFileHandle);
187
		} catch (CoreException e) {
188
			ErrorDialog.openError(shell, "Creation Problems", null, e.getStatus());
189
			return null;
190
		}
191
		return newFileHandle;
192
	}
193
194
	/**
195
	 * @generated
196
	 */
197
	protected static void createFile(IFile fileHandle) throws CoreException {
198
		try {
199
			fileHandle.create(new ByteArrayInputStream(new byte[0]), false, new NullProgressMonitor());
200
		} catch (CoreException e) {
201
			// If the file already existed locally, just refresh to get contents
202
			if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED) {
203
				fileHandle.refreshLocal(IResource.DEPTH_ZERO, null);
204
			} else {
205
				throw e;
206
			}
207
		}
208
	}
209
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorItem.java (+73 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.emf.ecore.EObject;
4
import org.eclipse.gmf.runtime.notation.View;
5
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
6
7
/**
8
 * @generated
9
 */
10
public class UMLNavigatorItem extends UMLAbstractNavigatorItem {
11
12
	/**
13
	 * @generated
14
	 */
15
	private View myView;
16
17
	/**
18
	 * @generated
19
	 */
20
	public UMLNavigatorItem(View view, Object parent) {
21
		super(parent);
22
		myView = view;
23
	}
24
25
	/**
26
	 * @generated
27
	 */
28
	public View getView() {
29
		return myView;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	public String getModelID() {
36
		return UMLVisualIDRegistry.getModelID(myView);
37
	}
38
39
	/**
40
	 * @generated
41
	 */
42
	public int getVisualID() {
43
		return UMLVisualIDRegistry.getVisualID(myView);
44
	}
45
46
	/**
47
	 * @generated
48
	 */
49
	public Object getAdapter(Class adapter) {
50
		if (View.class.isAssignableFrom(adapter) || EObject.class.isAssignableFrom(adapter)) {
51
			return myView;
52
		}
53
		return super.getAdapter(adapter);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	public boolean equals(Object obj) {
60
		if (obj instanceof UMLNavigatorItem) {
61
			EObject eObject = getView().getElement();
62
			EObject anotherEObject = ((UMLNavigatorItem) obj).getView().getElement();
63
			if (eObject == null) {
64
				return anotherEObject == null;
65
			} else if (anotherEObject == null) {
66
				return false;
67
			}
68
			return eObject.eResource().getURIFragment(eObject).equals(anotherEObject.eResource().getURIFragment(anotherEObject));
69
		}
70
		return super.equals(obj);
71
	}
72
73
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPin3EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.OutputPin3ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class OutputPin3EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3006;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public OutputPin3EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPin3ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return OutputPin3EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(OutputPinName3EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof OutputPinName3EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/ActivityFinalNodeEditPart.java (+242 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
13
import org.eclipse.gef.requests.CreateRequest;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
16
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
17
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
18
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.uml2.diagram.activity.edit.policies.ActivityFinalNodeItemSemanticEditPolicy;
21
22
/**
23
 * @generated
24
 */
25
public class ActivityFinalNodeEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2003;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public ActivityFinalNodeEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActivityFinalNodeItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		ActivityFinalFigure figure = new ActivityFinalFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public ActivityFinalFigure getPrimaryShape() {
96
		return (ActivityFinalFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected NodeFigure createNodePlate() {
103
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23));
104
		return result;
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	public EditPolicy getPrimaryDragEditPolicy() {
111
		EditPolicy result = super.getPrimaryDragEditPolicy();
112
		if (result instanceof ResizableEditPolicy) {
113
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
114
115
			ep.setResizeDirections(PositionConstants.NONE);
116
117
		}
118
		return result;
119
	}
120
121
	/**
122
	 * Creates figure for this edit part.
123
	 * 
124
	 * Body of this method does not depend on settings in generation model
125
	 * so you may safely remove <i>generated</i> tag and modify it.
126
	 * 
127
	 * @generated
128
	 */
129
	protected NodeFigure createNodeFigure() {
130
		NodeFigure figure = createNodePlate();
131
		figure.setLayoutManager(new StackLayout());
132
		IFigure shape = createNodeShape();
133
		figure.add(shape);
134
		contentPane = setupContentPane(shape);
135
		return figure;
136
	}
137
138
	/**
139
	 * Default implementation treats passed figure as content pane.
140
	 * Respects layout one may have set for generated figure.
141
	 * @param nodeShape instance of generated figure class
142
	 * @generated
143
	 */
144
	protected IFigure setupContentPane(IFigure nodeShape) {
145
		if (nodeShape.getLayoutManager() == null) {
146
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
147
			layout.setSpacing(getMapMode().DPtoLP(5));
148
			nodeShape.setLayoutManager(layout);
149
		}
150
		return nodeShape; // use nodeShape itself as contentPane
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	public IFigure getContentPane() {
157
		if (contentPane != null) {
158
			return contentPane;
159
		}
160
		return super.getContentPane();
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public class ActivityFinalFigure extends org.eclipse.draw2d.Ellipse {
167
168
		/**
169
		 * @generated
170
		 */
171
		public ActivityFinalFigure() {
172
173
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
174
175
			this.setLayoutManager(myGenLayoutManager);
176
177
			this.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
178
			this.setPreferredSize(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23));
179
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23)));
180
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23)));
181
			createContents();
182
		}
183
184
		/**
185
		 * @generated
186
		 */
187
		private void createContents() {
188
			org.eclipse.draw2d.Ellipse fig_0 = new org.eclipse.draw2d.Ellipse();
189
190
			fig_0.setBackgroundColor(org.eclipse.draw2d.ColorConstants.black);
191
			fig_0.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
192
			fig_0.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
193
			fig_0.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
194
195
			setFigureActivityFinalFigure_inner(fig_0);
196
197
			Object layData0 = null;
198
199
			this.add(fig_0, layData0);
200
		}
201
202
		/**
203
		 * @generated
204
		 */
205
		private org.eclipse.draw2d.Ellipse fActivityFinalFigure_inner;
206
207
		/**
208
		 * @generated
209
		 */
210
		public org.eclipse.draw2d.Ellipse getFigureActivityFinalFigure_inner() {
211
			return fActivityFinalFigure_inner;
212
		}
213
214
		/**
215
		 * @generated
216
		 */
217
		private void setFigureActivityFinalFigure_inner(org.eclipse.draw2d.Ellipse fig) {
218
			fActivityFinalFigure_inner = fig;
219
		}
220
221
		/**
222
		 * @generated
223
		 */
224
		private boolean myUseLocalCoordinates = false;
225
226
		/**
227
		 * @generated
228
		 */
229
		protected boolean useLocalCoordinates() {
230
			return myUseLocalCoordinates;
231
		}
232
233
		/**
234
		 * @generated
235
		 */
236
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
237
			myUseLocalCoordinates = useLocalCoordinates;
238
		}
239
240
	}
241
242
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/UMLTextNonResizableEditPolicy.java (+208 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.ColorConstants;
7
import org.eclipse.draw2d.Figure;
8
import org.eclipse.draw2d.Graphics;
9
import org.eclipse.draw2d.IFigure;
10
import org.eclipse.draw2d.Label;
11
import org.eclipse.draw2d.RectangleFigure;
12
import org.eclipse.draw2d.geometry.Rectangle;
13
import org.eclipse.gef.GraphicalEditPart;
14
import org.eclipse.gef.LayerConstants;
15
import org.eclipse.gef.handles.MoveHandle;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
17
import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
18
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
19
20
/**
21
 * @generated
22
 */
23
public class UMLTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
24
25
	/**
26
	 * @generated
27
	 */
28
	private IFigure selectionFeedbackFigure;
29
30
	/**
31
	 * @generated
32
	 */
33
	private IFigure focusFeedbackFigure;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected void showPrimarySelection() {
39
		if (getHostFigure() instanceof WrapLabel) {
40
			((WrapLabel) getHostFigure()).setSelected(true);
41
			((WrapLabel) getHostFigure()).setFocus(true);
42
		} else {
43
			showSelection();
44
			showFocus();
45
		}
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	protected void showSelection() {
52
		if (getHostFigure() instanceof WrapLabel) {
53
			((WrapLabel) getHostFigure()).setSelected(true);
54
			((WrapLabel) getHostFigure()).setFocus(false);
55
		} else {
56
			hideSelection();
57
			addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
58
			refreshSelectionFeedback();
59
			hideFocus();
60
		}
61
	}
62
63
	/**
64
	 * @generated
65
	 */
66
	protected void hideSelection() {
67
		if (getHostFigure() instanceof WrapLabel) {
68
			((WrapLabel) getHostFigure()).setSelected(false);
69
			((WrapLabel) getHostFigure()).setFocus(false);
70
		} else {
71
			if (selectionFeedbackFigure != null) {
72
				removeFeedback(selectionFeedbackFigure);
73
				selectionFeedbackFigure = null;
74
			}
75
			hideFocus();
76
		}
77
	}
78
79
	/**
80
	 * @generated
81
	 */
82
	protected void showFocus() {
83
		if (getHostFigure() instanceof WrapLabel) {
84
			((WrapLabel) getHostFigure()).setFocus(true);
85
		} else {
86
			hideFocus();
87
			addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
88
			refreshFocusFeedback();
89
		}
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected void hideFocus() {
96
		if (getHostFigure() instanceof WrapLabel) {
97
			((WrapLabel) getHostFigure()).setFocus(false);
98
		} else {
99
			if (focusFeedbackFigure != null) {
100
				removeFeedback(focusFeedbackFigure);
101
				focusFeedbackFigure = null;
102
			}
103
		}
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure getFeedbackLayer() {
110
		return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
111
	}
112
113
	/**
114
	 * @generated
115
	 */
116
	protected Rectangle getFeedbackBounds() {
117
		Rectangle bounds;
118
		if (getHostFigure() instanceof Label) {
119
			bounds = ((Label) getHostFigure()).getTextBounds();
120
			bounds.intersect(getHostFigure().getBounds());
121
		} else {
122
			bounds = getHostFigure().getBounds().getCopy();
123
		}
124
		getHostFigure().getParent().translateToAbsolute(bounds);
125
		getFeedbackLayer().translateToRelative(bounds);
126
		return bounds;
127
	}
128
129
	/**
130
	 * @generated
131
	 */
132
	protected IFigure createSelectionFeedbackFigure() {
133
		if (getHostFigure() instanceof Label) {
134
			Label feedbackFigure = new Label();
135
			feedbackFigure.setOpaque(true);
136
			feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
137
			feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
138
			return feedbackFigure;
139
		} else {
140
			RectangleFigure feedbackFigure = new RectangleFigure();
141
			feedbackFigure.setFill(false);
142
			return feedbackFigure;
143
		}
144
	}
145
146
	/**
147
	 * @generated
148
	 */
149
	protected IFigure createFocusFeedbackFigure() {
150
		return new Figure() {
151
152
			protected void paintFigure(Graphics graphics) {
153
				graphics.drawFocus(getBounds().getResized(-1, -1));
154
			}
155
		};
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	protected void updateLabel(Label target) {
162
		Label source = (Label) getHostFigure();
163
		target.setText(source.getText());
164
		target.setTextAlignment(source.getTextAlignment());
165
		target.setFont(source.getFont());
166
	}
167
168
	/**
169
	 * @generated
170
	 */
171
	protected void refreshSelectionFeedback() {
172
		if (selectionFeedbackFigure != null) {
173
			if (selectionFeedbackFigure instanceof Label) {
174
				updateLabel((Label) selectionFeedbackFigure);
175
				selectionFeedbackFigure.setBounds(getFeedbackBounds());
176
			} else {
177
				selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
178
			}
179
		}
180
	}
181
182
	/**
183
	 * @generated
184
	 */
185
	protected void refreshFocusFeedback() {
186
		if (focusFeedbackFigure != null) {
187
			focusFeedbackFigure.setBounds(getFeedbackBounds());
188
		}
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	public void refreshFeedback() {
195
		refreshSelectionFeedback();
196
		refreshFocusFeedback();
197
	}
198
199
	/**
200
	 * @generated
201
	 */
202
	protected List createSelectionHandles() {
203
		MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
204
		moveHandle.setBorder(null);
205
		moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
206
		return Collections.singletonList(moveHandle);
207
	}
208
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OpaqueActionNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class OpaqueActionNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5001;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public OpaqueActionNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.OpaqueAction_2010;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/AddStructuralFeatureValueActionViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class AddStructuralFeatureValueActionViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinName4ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class InputPinName4ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/MergeNodeEditPart.java (+252 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.MergeNodeItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class MergeNodeEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2005;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public MergeNodeEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new MergeNodeItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		ScalableRhombFigure figure = new ScalableRhombFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public ScalableRhombFigure getPrimaryShape() {
94
		return (ScalableRhombFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(20), getMapMode().DPtoLP(40));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class ScalableRhombFigure extends org.eclipse.draw2d.Shape {
151
152
		/**
153
		 * @generated
154
		 */
155
		private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
156
157
		/**
158
		 * @generated
159
		 */
160
		private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
161
162
		/**
163
		 * @generated
164
		 */
165
		public void addPoint(org.eclipse.draw2d.geometry.Point point) {
166
			myTemplate.addPoint(point);
167
			myTemplateBounds = null;
168
		}
169
170
		/**
171
		 * @generated
172
		 */
173
		protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
174
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
175
			graphics.pushState();
176
			graphics.translate(bounds.x, bounds.y);
177
			graphics.fillPolygon(scalePointList());
178
			graphics.popState();
179
		}
180
181
		/**
182
		 * @generated
183
		 */
184
		protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
185
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
186
			graphics.pushState();
187
			graphics.translate(bounds.x, bounds.y);
188
			graphics.drawPolygon(scalePointList());
189
			graphics.popState();
190
		}
191
192
		/**
193
		 * @generated
194
		 */
195
		private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds() {
196
			if (myTemplateBounds == null) {
197
				myTemplateBounds = new org.eclipse.draw2d.geometry.Rectangle();
198
				myTemplateBounds = myTemplate.getBounds().union(0, 0);
199
				//just safety -- we are going to use this as divider 
200
				if (myTemplateBounds.width < 1) {
201
					myTemplateBounds.width = 1;
202
				}
203
				if (myTemplateBounds.height < 1) {
204
					myTemplateBounds.height = 1;
205
				}
206
			}
207
			return myTemplateBounds;
208
		}
209
210
		/**
211
		 * @generated
212
		 */
213
		private int[] scalePointList() {
214
			org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
215
			org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
216
217
			float xScale = ((float) actualBounds.width) / pointsBounds.width;
218
			float yScale = ((float) actualBounds.height) / pointsBounds.height;
219
220
			if (xScale == 1 && yScale == 1) {
221
				return myTemplate.toIntArray();
222
			}
223
			int[] scaled = (int[]) myTemplate.toIntArray().clone();
224
			for (int i = 0; i < scaled.length; i += 2) {
225
				scaled[i] = (int) Math.floor(scaled[i] * xScale);
226
				scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
227
			}
228
			return scaled;
229
		}
230
231
		/**
232
		 * @generated
233
		 */
234
		public ScalableRhombFigure() {
235
236
			this.setFill(true);
237
			this.addPoint(new org.eclipse.draw2d.geometry.Point(20, 0));
238
			this.addPoint(new org.eclipse.draw2d.geometry.Point(40, 20));
239
			this.addPoint(new org.eclipse.draw2d.geometry.Point(20, 40));
240
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 20));
241
			createContents();
242
		}
243
244
		/**
245
		 * @generated
246
		 */
247
		private void createContents() {
248
		}
249
250
	}
251
252
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/ForkNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class ForkNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/AddStructuralFeatureValueActionCanonicalEditPolicy.java (+63 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.LinkedList;
4
import java.util.List;
5
6
import org.eclipse.emf.ecore.EObject;
7
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
8
import org.eclipse.gmf.runtime.notation.View;
9
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
10
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
12
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
13
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
14
import org.eclipse.uml2.uml.StructuralFeatureAction;
15
import org.eclipse.uml2.uml.WriteStructuralFeatureAction;
16
17
/**
18
 * @generated
19
 */
20
public class AddStructuralFeatureValueActionCanonicalEditPolicy extends CanonicalEditPolicy {
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List getSemanticChildrenList() {
26
		List result = new LinkedList();
27
		EObject modelObject = ((View) getHost().getModel()).getElement();
28
		View viewObject = (View) getHost().getModel();
29
		EObject nextValue;
30
		int nodeVID;
31
		nextValue = ((AddStructuralFeatureValueAction) modelObject).getInsertAt();
32
		nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
33
		if (InputPinEditPart.VISUAL_ID == nodeVID) {
34
			result.add(nextValue);
35
		}
36
		nextValue = ((WriteStructuralFeatureAction) modelObject).getValue();
37
		nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
38
		if (InputPin2EditPart.VISUAL_ID == nodeVID) {
39
			result.add(nextValue);
40
		}
41
		nextValue = ((StructuralFeatureAction) modelObject).getObject();
42
		nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
43
		if (InputPin3EditPart.VISUAL_ID == nodeVID) {
44
			result.add(nextValue);
45
		}
46
		return result;
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected boolean shouldDeleteView(View view) {
53
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected String getDefaultFactoryHint() {
60
		return null;
61
	}
62
63
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InputPin2EditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class InputPin2EditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPinName3ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class OutputPinName3ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPin3ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class OutputPin3ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(OutputPinName3EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/expressions/UMLAbstractExpression.java (+210 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.expressions;
2
3
import java.math.BigDecimal;
4
import java.math.BigInteger;
5
import java.util.Collection;
6
import java.util.Collections;
7
import java.util.Iterator;
8
import java.util.Map;
9
10
import org.eclipse.core.runtime.IStatus;
11
import org.eclipse.core.runtime.Platform;
12
import org.eclipse.core.runtime.Status;
13
import org.eclipse.emf.ecore.EClassifier;
14
import org.eclipse.emf.ecore.EObject;
15
import org.eclipse.emf.ecore.EStructuralFeature;
16
import org.eclipse.emf.ecore.ETypedElement;
17
import org.eclipse.emf.ecore.util.EcoreUtil;
18
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
19
20
/**
21
 * @generated
22
 */
23
public abstract class UMLAbstractExpression {
24
25
	/**
26
	 * @generated
27
	 */
28
	private static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean.valueOf(
29
			Platform.getDebugOption(UMLDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/disableNoExprImplExceptionLog")).booleanValue();
30
31
	/**
32
	 * @generated
33
	 */
34
	private String body;
35
36
	/**
37
	 * @generated
38
	 */
39
	private EClassifier context;
40
41
	/**
42
	 * @generated
43
	 */
44
	private IStatus status = Status.OK_STATUS;
45
46
	/**
47
	 * @generated
48
	 */
49
	protected UMLAbstractExpression(EClassifier context) {
50
		this.context = context;
51
	}
52
53
	/**
54
	 * @generated
55
	 */
56
	protected UMLAbstractExpression(String body, EClassifier context, Map env) {
57
		this.body = body;
58
		this.context = context;
59
	}
60
61
	/**
62
	 * @generated
63
	 */
64
	protected void setStatus(int severity, String message, Throwable throwable) {
65
		String pluginID = UMLDiagramEditorPlugin.ID;
66
		this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
67
		if (!this.status.isOK()) {
68
			UMLDiagramEditorPlugin.getInstance().logError("Expression problem:" + message + "body:" + body, throwable); //$NON-NLS-1$ //$NON-NLS-2$
69
70
		}
71
	}
72
73
	/**
74
	 * @generated
75
	 */
76
	protected abstract Object doEvaluate(Object context, Map env);
77
78
	/**
79
	 * @generated
80
	 */
81
	public Object evaluate(Object context) {
82
		return evaluate(context, Collections.EMPTY_MAP);
83
	}
84
85
	/**
86
	 * @generated
87
	 */
88
	public Object evaluate(Object context, Map env) {
89
		if (context().isInstance(context)) {
90
			try {
91
				return doEvaluate(context, env);
92
			} catch (Exception e) {
93
				if (DISABLED_NO_IMPL_EXCEPTION_LOG && e instanceof NoImplException) {
94
					return null;
95
				}
96
				UMLDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body, e);
97
			}
98
		}
99
		return null;
100
	}
101
102
	/**
103
	 * @generated
104
	 */
105
	public IStatus getStatus() {
106
		return status;
107
	}
108
109
	/**
110
	 * @generated
111
	 */
112
	public String body() {
113
		return body;
114
	}
115
116
	/**
117
	 * @generated
118
	 */
119
	public EClassifier context() {
120
		return context;
121
	}
122
123
	/**
124
	 * @generated
125
	 */
126
	public void assignTo(EStructuralFeature feature, EObject target) {
127
		Object value = evaluate(target);
128
		value = (value != null) ? performCast(value, feature) : null;
129
		if (feature.isMany()) {
130
			Collection destCollection = (Collection) target.eGet(feature);
131
			destCollection.clear();
132
			if (value instanceof Collection) {
133
				Collection valueCollection = (Collection) value;
134
				for (Iterator it = valueCollection.iterator(); it.hasNext();) {
135
					destCollection.add(performCast(it.next(), feature));
136
				}
137
			} else {
138
				destCollection.add(value);
139
			}
140
			return;
141
		}
142
		target.eSet(feature, value);
143
	}
144
145
	/**
146
	 * @generated
147
	 */
148
	protected Object performCast(Object value, ETypedElement targetType) {
149
		if (targetType.getEType() == null || targetType.getEType().getInstanceClass() == null) {
150
			return value;
151
		}
152
		Class targetClass = targetType.getEType().getInstanceClass();
153
		if (value != null && value instanceof Number) {
154
			Number num = (Number) value;
155
			Class valClass = value.getClass();
156
			Class targetWrapperClass = targetClass;
157
			if (targetClass.isPrimitive()) {
158
				targetWrapperClass = EcoreUtil.wrapperClassFor(targetClass);
159
			}
160
			if (valClass.equals(targetWrapperClass)) {
161
				return value;
162
			}
163
			if (Number.class.isAssignableFrom(targetWrapperClass)) {
164
				if (targetWrapperClass.equals(Byte.class))
165
					return new Byte(num.byteValue());
166
				if (targetWrapperClass.equals(Integer.class))
167
					return new Integer(num.intValue());
168
				if (targetWrapperClass.equals(Short.class))
169
					return new Short(num.shortValue());
170
				if (targetWrapperClass.equals(Long.class))
171
					return new Long(num.longValue());
172
				if (targetWrapperClass.equals(BigInteger.class))
173
					return BigInteger.valueOf(num.longValue());
174
				if (targetWrapperClass.equals(Float.class))
175
					return new Float(num.floatValue());
176
				if (targetWrapperClass.equals(Double.class))
177
					return new Double(num.doubleValue());
178
				if (targetWrapperClass.equals(BigDecimal.class))
179
					return new BigDecimal(num.doubleValue());
180
			}
181
		}
182
		return value;
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	public static final UMLAbstractExpression createNullExpression(EClassifier context) {
189
		return new UMLAbstractExpression(context) {
190
191
			protected Object doEvaluate(Object context, Map env) {
192
				// TODO - log entry about not provider available for this expression
193
				return null;
194
			}
195
		};
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public static class NoImplException extends RuntimeException {
202
203
		/**
204
		 * @generated
205
		 */
206
		public NoImplException(String message) {
207
			super(message);
208
		}
209
	}
210
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/ForkNodeEditPart.java (+206 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
13
import org.eclipse.gef.requests.CreateRequest;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
16
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
17
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
18
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.uml2.diagram.activity.edit.policies.ForkNodeItemSemanticEditPolicy;
21
22
/**
23
 * @generated
24
 */
25
public class ForkNodeEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2012;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public ForkNodeEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ForkNodeItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		VerticalForkJoinFigure figure = new VerticalForkJoinFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public VerticalForkJoinFigure getPrimaryShape() {
96
		return (VerticalForkJoinFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected NodeFigure createNodePlate() {
103
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50));
104
		return result;
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	public EditPolicy getPrimaryDragEditPolicy() {
111
		EditPolicy result = super.getPrimaryDragEditPolicy();
112
		if (result instanceof ResizableEditPolicy) {
113
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
114
115
			ep.setResizeDirections(PositionConstants.NORTH | PositionConstants.SOUTH);
116
117
		}
118
		return result;
119
	}
120
121
	/**
122
	 * Creates figure for this edit part.
123
	 * 
124
	 * Body of this method does not depend on settings in generation model
125
	 * so you may safely remove <i>generated</i> tag and modify it.
126
	 * 
127
	 * @generated
128
	 */
129
	protected NodeFigure createNodeFigure() {
130
		NodeFigure figure = createNodePlate();
131
		figure.setLayoutManager(new StackLayout());
132
		IFigure shape = createNodeShape();
133
		figure.add(shape);
134
		contentPane = setupContentPane(shape);
135
		return figure;
136
	}
137
138
	/**
139
	 * Default implementation treats passed figure as content pane.
140
	 * Respects layout one may have set for generated figure.
141
	 * @param nodeShape instance of generated figure class
142
	 * @generated
143
	 */
144
	protected IFigure setupContentPane(IFigure nodeShape) {
145
		if (nodeShape.getLayoutManager() == null) {
146
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
147
			layout.setSpacing(getMapMode().DPtoLP(5));
148
			nodeShape.setLayoutManager(layout);
149
		}
150
		return nodeShape; // use nodeShape itself as contentPane
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	public IFigure getContentPane() {
157
		if (contentPane != null) {
158
			return contentPane;
159
		}
160
		return super.getContentPane();
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public class VerticalForkJoinFigure extends org.eclipse.draw2d.RectangleFigure {
167
168
		/**
169
		 * @generated
170
		 */
171
		public VerticalForkJoinFigure() {
172
173
			this.setBackgroundColor(org.eclipse.draw2d.ColorConstants.black);
174
			this.setPreferredSize(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50));
175
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50)));
176
			createContents();
177
		}
178
179
		/**
180
		 * @generated
181
		 */
182
		private void createContents() {
183
		}
184
185
		/**
186
		 * @generated
187
		 */
188
		private boolean myUseLocalCoordinates = false;
189
190
		/**
191
		 * @generated
192
		 */
193
		protected boolean useLocalCoordinates() {
194
			return myUseLocalCoordinates;
195
		}
196
197
		/**
198
		 * @generated
199
		 */
200
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
201
			myUseLocalCoordinates = useLocalCoordinates;
202
		}
203
204
	}
205
206
}
(-).classpath (+8 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="custom-src"/>
5
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
6
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
7
	<classpathentry kind="output" path="bin"/>
8
</classpath>
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPin5ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class InputPin5ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(InputPinName5EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InputPin4ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InputPin4ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/AcceptEventActionEditPart.java (+253 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.AcceptEventActionItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class AcceptEventActionEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2001;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public AcceptEventActionEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AcceptEventActionItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		AcceptEventActionFigure figure = new AcceptEventActionFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public AcceptEventActionFigure getPrimaryShape() {
94
		return (AcceptEventActionFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(50));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class AcceptEventActionFigure extends org.eclipse.draw2d.Shape {
151
152
		/**
153
		 * @generated
154
		 */
155
		private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
156
157
		/**
158
		 * @generated
159
		 */
160
		private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
161
162
		/**
163
		 * @generated
164
		 */
165
		public void addPoint(org.eclipse.draw2d.geometry.Point point) {
166
			myTemplate.addPoint(point);
167
			myTemplateBounds = null;
168
		}
169
170
		/**
171
		 * @generated
172
		 */
173
		protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
174
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
175
			graphics.pushState();
176
			graphics.translate(bounds.x, bounds.y);
177
			graphics.fillPolygon(scalePointList());
178
			graphics.popState();
179
		}
180
181
		/**
182
		 * @generated
183
		 */
184
		protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
185
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
186
			graphics.pushState();
187
			graphics.translate(bounds.x, bounds.y);
188
			graphics.drawPolygon(scalePointList());
189
			graphics.popState();
190
		}
191
192
		/**
193
		 * @generated
194
		 */
195
		private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds() {
196
			if (myTemplateBounds == null) {
197
				myTemplateBounds = new org.eclipse.draw2d.geometry.Rectangle();
198
				myTemplateBounds = myTemplate.getBounds().union(0, 0);
199
				//just safety -- we are going to use this as divider 
200
				if (myTemplateBounds.width < 1) {
201
					myTemplateBounds.width = 1;
202
				}
203
				if (myTemplateBounds.height < 1) {
204
					myTemplateBounds.height = 1;
205
				}
206
			}
207
			return myTemplateBounds;
208
		}
209
210
		/**
211
		 * @generated
212
		 */
213
		private int[] scalePointList() {
214
			org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
215
			org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
216
217
			float xScale = ((float) actualBounds.width) / pointsBounds.width;
218
			float yScale = ((float) actualBounds.height) / pointsBounds.height;
219
220
			if (xScale == 1 && yScale == 1) {
221
				return myTemplate.toIntArray();
222
			}
223
			int[] scaled = (int[]) myTemplate.toIntArray().clone();
224
			for (int i = 0; i < scaled.length; i += 2) {
225
				scaled[i] = (int) Math.floor(scaled[i] * xScale);
226
				scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
227
			}
228
			return scaled;
229
		}
230
231
		/**
232
		 * @generated
233
		 */
234
		public AcceptEventActionFigure() {
235
236
			this.setFill(true);
237
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 0));
238
			this.addPoint(new org.eclipse.draw2d.geometry.Point(50, 0));
239
			this.addPoint(new org.eclipse.draw2d.geometry.Point(50, 40));
240
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 40));
241
			this.addPoint(new org.eclipse.draw2d.geometry.Point(10, 20));
242
			createContents();
243
		}
244
245
		/**
246
		 * @generated
247
		 */
248
		private void createContents() {
249
		}
250
251
	}
252
253
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ActivityCanonicalEditPolicy.java (+533 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Collection;
4
import java.util.Collections;
5
import java.util.HashMap;
6
import java.util.Iterator;
7
import java.util.LinkedList;
8
import java.util.List;
9
import java.util.Map;
10
11
import org.eclipse.core.runtime.IAdaptable;
12
import org.eclipse.emf.ecore.EClass;
13
import org.eclipse.emf.ecore.EObject;
14
import org.eclipse.gef.EditPart;
15
import org.eclipse.gef.commands.Command;
16
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
17
import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
18
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
21
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
22
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
23
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
24
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
25
import org.eclipse.gmf.runtime.notation.Diagram;
26
import org.eclipse.gmf.runtime.notation.Edge;
27
import org.eclipse.gmf.runtime.notation.View;
28
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart;
29
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart;
30
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
31
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart;
32
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
33
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
34
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
35
import org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart;
36
import org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart;
37
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
38
import org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart;
39
import org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart;
40
import org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart;
41
import org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart;
42
import org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart;
43
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
44
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
45
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
46
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
47
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
48
import org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart;
49
import org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart;
50
import org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart;
51
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
52
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
53
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
54
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
55
import org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart;
56
import org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart;
57
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
58
import org.eclipse.uml2.uml.Activity;
59
import org.eclipse.uml2.uml.ActivityEdge;
60
import org.eclipse.uml2.uml.UMLPackage;
61
62
/**
63
 * @generated
64
 */
65
public class ActivityCanonicalEditPolicy extends CanonicalConnectionEditPolicy {
66
67
	/**
68
	 * @generated
69
	 */
70
	protected List getSemanticChildrenList() {
71
		List result = new LinkedList();
72
		EObject modelObject = ((View) getHost().getModel()).getElement();
73
		View viewObject = (View) getHost().getModel();
74
		EObject nextValue;
75
		int nodeVID;
76
		for (Iterator values = ((Activity) modelObject).getNodes().iterator(); values.hasNext();) {
77
			nextValue = (EObject) values.next();
78
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
79
			switch (nodeVID) {
80
			case AcceptEventActionEditPart.VISUAL_ID: {
81
				result.add(nextValue);
82
				break;
83
			}
84
			case AcceptEventAction2EditPart.VISUAL_ID: {
85
				result.add(nextValue);
86
				break;
87
			}
88
			case ActivityFinalNodeEditPart.VISUAL_ID: {
89
				result.add(nextValue);
90
				break;
91
			}
92
			case DecisionNodeEditPart.VISUAL_ID: {
93
				result.add(nextValue);
94
				break;
95
			}
96
			case MergeNodeEditPart.VISUAL_ID: {
97
				result.add(nextValue);
98
				break;
99
			}
100
			case InitialNodeEditPart.VISUAL_ID: {
101
				result.add(nextValue);
102
				break;
103
			}
104
			case DataStoreNodeEditPart.VISUAL_ID: {
105
				result.add(nextValue);
106
				break;
107
			}
108
			case CentralBufferNodeEditPart.VISUAL_ID: {
109
				result.add(nextValue);
110
				break;
111
			}
112
			case OpaqueActionEditPart.VISUAL_ID: {
113
				result.add(nextValue);
114
				break;
115
			}
116
			case FlowFinalNodeEditPart.VISUAL_ID: {
117
				result.add(nextValue);
118
				break;
119
			}
120
			case ForkNodeEditPart.VISUAL_ID: {
121
				result.add(nextValue);
122
				break;
123
			}
124
			case JoinNodeEditPart.VISUAL_ID: {
125
				result.add(nextValue);
126
				break;
127
			}
128
			case PinEditPart.VISUAL_ID: {
129
				result.add(nextValue);
130
				break;
131
			}
132
			case CreateObjectActionEditPart.VISUAL_ID: {
133
				result.add(nextValue);
134
				break;
135
			}
136
			case AddStructuralFeatureValueActionEditPart.VISUAL_ID: {
137
				result.add(nextValue);
138
				break;
139
			}
140
			case CallBehaviorActionEditPart.VISUAL_ID: {
141
				result.add(nextValue);
142
				break;
143
			}
144
			case CallOperationActionEditPart.VISUAL_ID: {
145
				result.add(nextValue);
146
				break;
147
			}
148
			}
149
		}
150
		for (Iterator values = ((Activity) modelObject).getGroups().iterator(); values.hasNext();) {
151
			nextValue = (EObject) values.next();
152
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
153
			if (StructuredActivityNodeEditPart.VISUAL_ID == nodeVID) {
154
				result.add(nextValue);
155
			}
156
		}
157
		return result;
158
	}
159
160
	/**
161
	 * @generated
162
	 */
163
	protected boolean shouldDeleteView(View view) {
164
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
165
	}
166
167
	/**
168
	 * @generated
169
	 */
170
	protected String getDefaultFactoryHint() {
171
		return null;
172
	}
173
174
	/**
175
	 * @generated
176
	 */
177
	protected List getSemanticConnectionsList() {
178
		return Collections.EMPTY_LIST;
179
	}
180
181
	/**
182
	 * @generated
183
	 */
184
	protected EObject getSourceElement(EObject relationship) {
185
		return null;
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	protected EObject getTargetElement(EObject relationship) {
192
		return null;
193
	}
194
195
	/**
196
	 * @generated
197
	 */
198
	protected boolean shouldIncludeConnection(Edge connector, Collection children) {
199
		return false;
200
	}
201
202
	/**
203
	 * @generated
204
	 */
205
	protected void refreshSemantic() {
206
		List createdViews = new LinkedList();
207
		createdViews.addAll(refreshSemanticChildren());
208
		List createdConnectionViews = new LinkedList();
209
		createdConnectionViews.addAll(refreshSemanticConnections());
210
		createdConnectionViews.addAll(refreshConnections());
211
212
		if (createdViews.size() > 1) {
213
			// perform a layout of the container
214
			DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
215
			executeCommand(new ICommandProxy(layoutCmd));
216
		}
217
218
		createdViews.addAll(createdConnectionViews);
219
		makeViewsImmutable(createdViews);
220
	}
221
222
	/**
223
	 * @generated
224
	 */
225
	private Collection myLinkDescriptors = new LinkedList();
226
227
	/**
228
	 * @generated
229
	 */
230
	private Map myEObject2ViewMap = new HashMap();
231
232
	/**
233
	 * @generated
234
	 */
235
	private Collection refreshConnections() {
236
		try {
237
			collectAllLinks(getDiagram());
238
			Collection existingLinks = new LinkedList(getDiagram().getEdges());
239
			for (Iterator diagramLinks = existingLinks.iterator(); diagramLinks.hasNext();) {
240
				Edge nextDiagramLink = (Edge) diagramLinks.next();
241
				EObject diagramLinkObject = nextDiagramLink.getElement();
242
				EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
243
				EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
244
				int diagramLinkVisualID = UMLVisualIDRegistry.getVisualID(nextDiagramLink);
245
				for (Iterator modelLinkDescriptors = myLinkDescriptors.iterator(); modelLinkDescriptors.hasNext();) {
246
					LinkDescriptor nextLinkDescriptor = (LinkDescriptor) modelLinkDescriptors.next();
247
					if (diagramLinkObject == nextLinkDescriptor.getLinkElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination()
248
							&& diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
249
						diagramLinks.remove();
250
						modelLinkDescriptors.remove();
251
					}
252
				}
253
			}
254
			deleteViews(existingLinks.iterator());
255
			return createConnections(myLinkDescriptors);
256
		} finally {
257
			myLinkDescriptors.clear();
258
			myEObject2ViewMap.clear();
259
		}
260
	}
261
262
	/**
263
	 * @generated
264
	 */
265
	private void collectAllLinks(View view) {
266
		EObject modelElement = view.getElement();
267
		int diagramElementVisualID = UMLVisualIDRegistry.getVisualID(view);
268
		switch (diagramElementVisualID) {
269
		case AcceptEventActionEditPart.VISUAL_ID:
270
		case AcceptEventAction2EditPart.VISUAL_ID:
271
		case ActivityFinalNodeEditPart.VISUAL_ID:
272
		case DecisionNodeEditPart.VISUAL_ID:
273
		case MergeNodeEditPart.VISUAL_ID:
274
		case InitialNodeEditPart.VISUAL_ID:
275
		case StructuredActivityNodeEditPart.VISUAL_ID:
276
		case DataStoreNodeEditPart.VISUAL_ID:
277
		case CentralBufferNodeEditPart.VISUAL_ID:
278
		case OpaqueActionEditPart.VISUAL_ID:
279
		case FlowFinalNodeEditPart.VISUAL_ID:
280
		case ForkNodeEditPart.VISUAL_ID:
281
		case JoinNodeEditPart.VISUAL_ID:
282
		case PinEditPart.VISUAL_ID:
283
		case CreateObjectActionEditPart.VISUAL_ID:
284
		case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
285
		case CallBehaviorActionEditPart.VISUAL_ID:
286
		case CallOperationActionEditPart.VISUAL_ID:
287
		case OutputPinEditPart.VISUAL_ID:
288
		case OutputPin2EditPart.VISUAL_ID:
289
		case InputPinEditPart.VISUAL_ID:
290
		case InputPin2EditPart.VISUAL_ID:
291
		case InputPin3EditPart.VISUAL_ID:
292
		case OutputPin3EditPart.VISUAL_ID:
293
		case InputPin4EditPart.VISUAL_ID:
294
		case InputPin5EditPart.VISUAL_ID:
295
		case ActivityEditPart.VISUAL_ID: {
296
			myEObject2ViewMap.put(modelElement, view);
297
			storeLinks(modelElement, getDiagram());
298
		}
299
		default: {
300
		}
301
			for (Iterator children = view.getChildren().iterator(); children.hasNext();) {
302
				View childView = (View) children.next();
303
				collectAllLinks(childView);
304
			}
305
		}
306
	}
307
308
	/**
309
	 * @generated
310
	 */
311
	private Collection createConnections(Collection linkDescriptors) {
312
		if (linkDescriptors.isEmpty()) {
313
			return Collections.EMPTY_LIST;
314
		}
315
		List adapters = new LinkedList();
316
		for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
317
			final LinkDescriptor nextLinkDescriptor = (LinkDescriptor) linkDescriptorsIterator.next();
318
			EditPart sourceEditPart = getEditPartFor(nextLinkDescriptor.getSource());
319
			EditPart targetEditPart = getEditPartFor(nextLinkDescriptor.getDestination());
320
			if (sourceEditPart == null || targetEditPart == null) {
321
				continue;
322
			}
323
			CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, ViewUtil.APPEND,
324
					false, ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
325
			CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
326
			ccr.setType(RequestConstants.REQ_CONNECTION_START);
327
			ccr.setSourceEditPart(sourceEditPart);
328
			sourceEditPart.getCommand(ccr);
329
			ccr.setTargetEditPart(targetEditPart);
330
			ccr.setType(RequestConstants.REQ_CONNECTION_END);
331
			Command cmd = targetEditPart.getCommand(ccr);
332
			if (cmd != null && cmd.canExecute()) {
333
				executeCommand(cmd);
334
				IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
335
				if (viewAdapter != null) {
336
					adapters.add(viewAdapter);
337
				}
338
			}
339
		}
340
		return adapters;
341
	}
342
343
	/**
344
	 * @generated
345
	 */
346
	private EditPart getEditPartFor(EObject modelElement) {
347
		View view = (View) myEObject2ViewMap.get(modelElement);
348
		if (view != null) {
349
			return (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
350
		}
351
		return null;
352
	}
353
354
	/**
355
	 *@generated
356
	 */
357
	private void storeLinks(EObject container, Diagram diagram) {
358
		EClass containerMetaclass = container.eClass();
359
		storeFeatureModelFacetLinks(container, containerMetaclass, diagram);
360
		storeTypeModelFacetLinks(container, containerMetaclass);
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	private void storeTypeModelFacetLinks(EObject container, EClass containerMetaclass) {
367
		storeTypeModelFacetLinks_ControlFlow_4001(container, containerMetaclass);
368
		storeTypeModelFacetLinks_ObjectFlow_4002(container, containerMetaclass);
369
	}
370
371
	/**
372
	 * @generated
373
	 */
374
	private void storeTypeModelFacetLinks_ControlFlow_4001(EObject container, EClass containerMetaclass) {
375
		if (UMLPackage.eINSTANCE.getActivity().isSuperTypeOf(containerMetaclass)) {
376
			for (Iterator values = ((Activity) container).getEdges().iterator(); values.hasNext();) {
377
				EObject nextValue = ((EObject) values.next());
378
				int linkVID = UMLVisualIDRegistry.getLinkWithClassVisualID(nextValue);
379
				if (ControlFlowEditPart.VISUAL_ID == linkVID) {
380
					Object structuralFeatureResult = ((ActivityEdge) nextValue).getTarget();
381
					if (structuralFeatureResult instanceof EObject) {
382
						EObject dst = (EObject) structuralFeatureResult;
383
						structuralFeatureResult = ((ActivityEdge) nextValue).getSource();
384
						if (structuralFeatureResult instanceof EObject) {
385
							EObject src = (EObject) structuralFeatureResult;
386
							myLinkDescriptors.add(new LinkDescriptor(src, dst, nextValue, linkVID));
387
						}
388
					}
389
				}
390
			}
391
		}
392
	}
393
394
	/**
395
	 * @generated
396
	 */
397
	private void storeTypeModelFacetLinks_ObjectFlow_4002(EObject container, EClass containerMetaclass) {
398
		if (UMLPackage.eINSTANCE.getActivity().isSuperTypeOf(containerMetaclass)) {
399
			for (Iterator values = ((Activity) container).getEdges().iterator(); values.hasNext();) {
400
				EObject nextValue = ((EObject) values.next());
401
				int linkVID = UMLVisualIDRegistry.getLinkWithClassVisualID(nextValue);
402
				if (ObjectFlowEditPart.VISUAL_ID == linkVID) {
403
					Object structuralFeatureResult = ((ActivityEdge) nextValue).getTarget();
404
					if (structuralFeatureResult instanceof EObject) {
405
						EObject dst = (EObject) structuralFeatureResult;
406
						structuralFeatureResult = ((ActivityEdge) nextValue).getSource();
407
						if (structuralFeatureResult instanceof EObject) {
408
							EObject src = (EObject) structuralFeatureResult;
409
							myLinkDescriptors.add(new LinkDescriptor(src, dst, nextValue, linkVID));
410
						}
411
					}
412
				}
413
			}
414
		}
415
	}
416
417
	/**
418
	 *@generated
419
	 */
420
	private void storeFeatureModelFacetLinks(EObject container, EClass containerMetaclass, Diagram diagram) {
421
422
	}
423
424
	/**
425
	 * @generated
426
	 */
427
	private Diagram getDiagram() {
428
		return ((View) getHost().getModel()).getDiagram();
429
	}
430
431
	/**
432
	 * @generated
433
	 */
434
	private class LinkDescriptor {
435
436
		/**
437
		 * @generated
438
		 */
439
		private EObject mySource;
440
441
		/**
442
		 * @generated
443
		 */
444
		private EObject myDestination;
445
446
		/**
447
		 * @generated
448
		 */
449
		private EObject myLinkElement;
450
451
		/**
452
		 * @generated
453
		 */
454
		private int myVisualID;
455
456
		/**
457
		 * @generated
458
		 */
459
		private IAdaptable mySemanticAdapter;
460
461
		/**
462
		 * @generated
463
		 */
464
		protected LinkDescriptor(EObject source, EObject destination, EObject linkElement, int linkVID) {
465
			this(source, destination, linkVID);
466
			myLinkElement = linkElement;
467
			mySemanticAdapter = new EObjectAdapter(linkElement);
468
		}
469
470
		/**
471
		 * @generated
472
		 */
473
		protected LinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
474
			this(source, destination, linkVID);
475
			myLinkElement = null;
476
			final IElementType elementTypeCopy = elementType;
477
			mySemanticAdapter = new IAdaptable() {
478
479
				public Object getAdapter(Class adapter) {
480
					if (IElementType.class.equals(adapter)) {
481
						return elementTypeCopy;
482
					}
483
					return null;
484
				}
485
			};
486
		}
487
488
		/**
489
		 * @generated
490
		 */
491
		private LinkDescriptor(EObject source, EObject destination, int linkVID) {
492
			mySource = source;
493
			myDestination = destination;
494
			myVisualID = linkVID;
495
		}
496
497
		/**
498
		 * @generated
499
		 */
500
		protected EObject getSource() {
501
			return mySource;
502
		}
503
504
		/**
505
		 * @generated
506
		 */
507
		protected EObject getDestination() {
508
			return myDestination;
509
		}
510
511
		/**
512
		 * @generated
513
		 */
514
		protected EObject getLinkElement() {
515
			return myLinkElement;
516
		}
517
518
		/**
519
		 * @generated
520
		 */
521
		protected int getVisualID() {
522
			return myVisualID;
523
		}
524
525
		/**
526
		 * @generated
527
		 */
528
		protected IAdaptable getSemanticAdapter() {
529
			return mySemanticAdapter;
530
		}
531
	}
532
533
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPinNameViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class OutputPinNameViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPin5EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.InputPin5ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class InputPin5EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3008;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public InputPin5EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPin5ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return InputPin5EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinName5EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof InputPinName5EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinName3EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class InputPinName3EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5008;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(InputPinName3EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public InputPinName3EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.InputPin_3005;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/ActivityFinalNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class ActivityFinalNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/DecisionNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class DecisionNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CallOperationActionItemSemanticEditPolicy.java (+324 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
13
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
14
import org.eclipse.gmf.runtime.notation.View;
15
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
16
import org.eclipse.uml2.uml.Activity;
17
import org.eclipse.uml2.uml.ActivityNode;
18
import org.eclipse.uml2.uml.CallOperationAction;
19
import org.eclipse.uml2.uml.ControlFlow;
20
import org.eclipse.uml2.uml.ObjectFlow;
21
import org.eclipse.uml2.uml.UMLPackage;
22
23
/**
24
 * @generated
25
 */
26
public class CallOperationActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
27
28
	/**
29
	 * @generated
30
	 */
31
	protected Command getCreateCommand(CreateElementRequest req) {
32
		if (UMLElementTypes.OutputPin_3006 == req.getElementType()) {
33
			if (req.getContainmentFeature() == null) {
34
				req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result());
35
			}
36
			return getMSLWrapper(new CreateOutputPin_3006Command(req));
37
		}
38
		if (UMLElementTypes.InputPin_3007 == req.getElementType()) {
39
			if (req.getContainmentFeature() == null) {
40
				req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument());
41
			}
42
			return getMSLWrapper(new CreateInputPin_3007Command(req));
43
		}
44
		if (UMLElementTypes.InputPin_3008 == req.getElementType()) {
45
			CallOperationAction container = (CallOperationAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer());
46
			if (container.getTarget() != null) {
47
				return super.getCreateCommand(req);
48
			}
49
			if (req.getContainmentFeature() == null) {
50
				req.setContainmentFeature(UMLPackage.eINSTANCE.getCallOperationAction_Target());
51
			}
52
			return getMSLWrapper(new CreateInputPin_3008Command(req));
53
		}
54
		return super.getCreateCommand(req);
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	private static class CreateOutputPin_3006Command extends CreateElementCommand {
61
62
		/**
63
		 * @generated
64
		 */
65
		public CreateOutputPin_3006Command(CreateElementRequest req) {
66
			super(req);
67
		}
68
69
		/**
70
		 * @generated
71
		 */
72
		protected EClass getEClassToEdit() {
73
			return UMLPackage.eINSTANCE.getCallOperationAction();
74
		};
75
76
		/**
77
		 * @generated
78
		 */
79
		protected EObject getElementToEdit() {
80
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
81
			if (container instanceof View) {
82
				container = ((View) container).getElement();
83
			}
84
			return container;
85
		}
86
	}
87
88
	/**
89
	 * @generated
90
	 */
91
	private static class CreateInputPin_3007Command extends CreateElementCommand {
92
93
		/**
94
		 * @generated
95
		 */
96
		public CreateInputPin_3007Command(CreateElementRequest req) {
97
			super(req);
98
		}
99
100
		/**
101
		 * @generated
102
		 */
103
		protected EClass getEClassToEdit() {
104
			return UMLPackage.eINSTANCE.getCallOperationAction();
105
		};
106
107
		/**
108
		 * @generated
109
		 */
110
		protected EObject getElementToEdit() {
111
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
112
			if (container instanceof View) {
113
				container = ((View) container).getElement();
114
			}
115
			return container;
116
		}
117
	}
118
119
	/**
120
	 * @generated
121
	 */
122
	private static class CreateInputPin_3008Command extends CreateElementCommand {
123
124
		/**
125
		 * @generated
126
		 */
127
		public CreateInputPin_3008Command(CreateElementRequest req) {
128
			super(req);
129
		}
130
131
		/**
132
		 * @generated
133
		 */
134
		protected EClass getEClassToEdit() {
135
			return UMLPackage.eINSTANCE.getCallOperationAction();
136
		};
137
138
		/**
139
		 * @generated
140
		 */
141
		protected EObject getElementToEdit() {
142
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
143
			if (container instanceof View) {
144
				container = ((View) container).getElement();
145
			}
146
			return container;
147
		}
148
	}
149
150
	/**
151
	 * @generated
152
	 */
153
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
154
		return getMSLWrapper(new DestroyElementCommand(req) {
155
156
			protected EObject getElementToDestroy() {
157
				View view = (View) getHost().getModel();
158
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
159
				if (annotation != null) {
160
					return view;
161
				}
162
				return super.getElementToDestroy();
163
			}
164
165
		});
166
	}
167
168
	/**
169
	 * @generated
170
	 */
171
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
172
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
173
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
174
		}
175
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
176
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
177
		}
178
		return super.getCreateRelationshipCommand(req);
179
	}
180
181
	/**
182
	 * @generated
183
	 */
184
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
185
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
186
			return UnexecutableCommand.INSTANCE;
187
		}
188
		return new Command() {
189
		};
190
	}
191
192
	/**
193
	 * @generated
194
	 */
195
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
196
		if (!(req.getSource() instanceof ActivityNode)) {
197
			return UnexecutableCommand.INSTANCE;
198
		}
199
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
200
		if (element == null) {
201
			return UnexecutableCommand.INSTANCE;
202
		}
203
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
204
			return UnexecutableCommand.INSTANCE;
205
		}
206
		if (req.getContainmentFeature() == null) {
207
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
208
		}
209
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
210
211
			protected EObject getElementToEdit() {
212
				return element;
213
			}
214
		});
215
	}
216
217
	/**
218
	 * @generated
219
	 */
220
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
221
222
		/**
223
		 * @generated
224
		 */
225
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
226
			super(req);
227
		}
228
229
		/**
230
		 * @generated
231
		 */
232
		protected EClass getEClassToEdit() {
233
			return UMLPackage.eINSTANCE.getActivity();
234
		};
235
236
		/**
237
		 * @generated
238
		 */
239
		protected void setElementToEdit(EObject element) {
240
			throw new UnsupportedOperationException();
241
		}
242
243
		/**
244
		 * @generated
245
		 */
246
		protected EObject doDefaultElementCreation() {
247
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
248
			if (newElement != null) {
249
				newElement.setTarget((ActivityNode) getTarget());
250
				newElement.setSource((ActivityNode) getSource());
251
			}
252
			return newElement;
253
		}
254
	}
255
256
	/**
257
	 * @generated
258
	 */
259
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
260
		return new Command() {
261
		};
262
	}
263
264
	/**
265
	 * @generated
266
	 */
267
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
268
		if (!(req.getSource() instanceof ActivityNode)) {
269
			return UnexecutableCommand.INSTANCE;
270
		}
271
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
272
		if (element == null) {
273
			return UnexecutableCommand.INSTANCE;
274
		}
275
		if (req.getContainmentFeature() == null) {
276
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
277
		}
278
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
279
280
			protected EObject getElementToEdit() {
281
				return element;
282
			}
283
		});
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
290
291
		/**
292
		 * @generated
293
		 */
294
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
295
			super(req);
296
		}
297
298
		/**
299
		 * @generated
300
		 */
301
		protected EClass getEClassToEdit() {
302
			return UMLPackage.eINSTANCE.getActivity();
303
		};
304
305
		/**
306
		 * @generated
307
		 */
308
		protected void setElementToEdit(EObject element) {
309
			throw new UnsupportedOperationException();
310
		}
311
312
		/**
313
		 * @generated
314
		 */
315
		protected EObject doDefaultElementCreation() {
316
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
317
			if (newElement != null) {
318
				newElement.setTarget((ActivityNode) getTarget());
319
				newElement.setSource((ActivityNode) getSource());
320
			}
321
			return newElement;
322
		}
323
	}
324
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InitialNodeEditPart.java (+207 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
13
import org.eclipse.gef.requests.CreateRequest;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
16
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
17
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
18
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.uml2.diagram.activity.edit.policies.InitialNodeItemSemanticEditPolicy;
21
22
/**
23
 * @generated
24
 */
25
public class InitialNodeEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2006;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public InitialNodeEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InitialNodeItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		ActivityInitialFigure figure = new ActivityInitialFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public ActivityInitialFigure getPrimaryShape() {
96
		return (ActivityInitialFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected NodeFigure createNodePlate() {
103
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
104
		return result;
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	public EditPolicy getPrimaryDragEditPolicy() {
111
		EditPolicy result = super.getPrimaryDragEditPolicy();
112
		if (result instanceof ResizableEditPolicy) {
113
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
114
115
			ep.setResizeDirections(PositionConstants.NONE);
116
117
		}
118
		return result;
119
	}
120
121
	/**
122
	 * Creates figure for this edit part.
123
	 * 
124
	 * Body of this method does not depend on settings in generation model
125
	 * so you may safely remove <i>generated</i> tag and modify it.
126
	 * 
127
	 * @generated
128
	 */
129
	protected NodeFigure createNodeFigure() {
130
		NodeFigure figure = createNodePlate();
131
		figure.setLayoutManager(new StackLayout());
132
		IFigure shape = createNodeShape();
133
		figure.add(shape);
134
		contentPane = setupContentPane(shape);
135
		return figure;
136
	}
137
138
	/**
139
	 * Default implementation treats passed figure as content pane.
140
	 * Respects layout one may have set for generated figure.
141
	 * @param nodeShape instance of generated figure class
142
	 * @generated
143
	 */
144
	protected IFigure setupContentPane(IFigure nodeShape) {
145
		if (nodeShape.getLayoutManager() == null) {
146
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
147
			layout.setSpacing(getMapMode().DPtoLP(5));
148
			nodeShape.setLayoutManager(layout);
149
		}
150
		return nodeShape; // use nodeShape itself as contentPane
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	public IFigure getContentPane() {
157
		if (contentPane != null) {
158
			return contentPane;
159
		}
160
		return super.getContentPane();
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public class ActivityInitialFigure extends org.eclipse.draw2d.Ellipse {
167
168
		/**
169
		 * @generated
170
		 */
171
		public ActivityInitialFigure() {
172
173
			this.setBackgroundColor(org.eclipse.draw2d.ColorConstants.black);
174
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
175
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
176
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
177
			createContents();
178
		}
179
180
		/**
181
		 * @generated
182
		 */
183
		private void createContents() {
184
		}
185
186
		/**
187
		 * @generated
188
		 */
189
		private boolean myUseLocalCoordinates = false;
190
191
		/**
192
		 * @generated
193
		 */
194
		protected boolean useLocalCoordinates() {
195
			return myUseLocalCoordinates;
196
		}
197
198
		/**
199
		 * @generated
200
		 */
201
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
202
			myUseLocalCoordinates = useLocalCoordinates;
203
		}
204
205
	}
206
207
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/AcceptEventAction2EditPart.java (+253 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.AcceptEventAction2ItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class AcceptEventAction2EditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2002;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public AcceptEventAction2EditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AcceptEventAction2ItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		AcceptTimeEventActionFigure figure = new AcceptTimeEventActionFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public AcceptTimeEventActionFigure getPrimaryShape() {
94
		return (AcceptTimeEventActionFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(50));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class AcceptTimeEventActionFigure extends org.eclipse.draw2d.Shape {
151
152
		/**
153
		 * @generated
154
		 */
155
		private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
156
157
		/**
158
		 * @generated
159
		 */
160
		private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
161
162
		/**
163
		 * @generated
164
		 */
165
		public void addPoint(org.eclipse.draw2d.geometry.Point point) {
166
			myTemplate.addPoint(point);
167
			myTemplateBounds = null;
168
		}
169
170
		/**
171
		 * @generated
172
		 */
173
		protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
174
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
175
			graphics.pushState();
176
			graphics.translate(bounds.x, bounds.y);
177
			graphics.fillPolygon(scalePointList());
178
			graphics.popState();
179
		}
180
181
		/**
182
		 * @generated
183
		 */
184
		protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
185
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
186
			graphics.pushState();
187
			graphics.translate(bounds.x, bounds.y);
188
			graphics.drawPolygon(scalePointList());
189
			graphics.popState();
190
		}
191
192
		/**
193
		 * @generated
194
		 */
195
		private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds() {
196
			if (myTemplateBounds == null) {
197
				myTemplateBounds = new org.eclipse.draw2d.geometry.Rectangle();
198
				myTemplateBounds = myTemplate.getBounds().union(0, 0);
199
				//just safety -- we are going to use this as divider 
200
				if (myTemplateBounds.width < 1) {
201
					myTemplateBounds.width = 1;
202
				}
203
				if (myTemplateBounds.height < 1) {
204
					myTemplateBounds.height = 1;
205
				}
206
			}
207
			return myTemplateBounds;
208
		}
209
210
		/**
211
		 * @generated
212
		 */
213
		private int[] scalePointList() {
214
			org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
215
			org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
216
217
			float xScale = ((float) actualBounds.width) / pointsBounds.width;
218
			float yScale = ((float) actualBounds.height) / pointsBounds.height;
219
220
			if (xScale == 1 && yScale == 1) {
221
				return myTemplate.toIntArray();
222
			}
223
			int[] scaled = (int[]) myTemplate.toIntArray().clone();
224
			for (int i = 0; i < scaled.length; i += 2) {
225
				scaled[i] = (int) Math.floor(scaled[i] * xScale);
226
				scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
227
			}
228
			return scaled;
229
		}
230
231
		/**
232
		 * @generated
233
		 */
234
		public AcceptTimeEventActionFigure() {
235
236
			this.setFill(true);
237
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 0));
238
			this.addPoint(new org.eclipse.draw2d.geometry.Point(25, 0));
239
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 25));
240
			this.addPoint(new org.eclipse.draw2d.geometry.Point(25, 25));
241
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 0));
242
			createContents();
243
		}
244
245
		/**
246
		 * @generated
247
		 */
248
		private void createContents() {
249
		}
250
251
	}
252
253
}
(-)src/org/eclipse/uml2/diagram/activity/sheet/UMLPropertySection.java (+107 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.sheet;
2
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.common.notify.AdapterFactory;
8
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
9
import org.eclipse.emf.edit.provider.IItemPropertySource;
10
import org.eclipse.emf.edit.ui.provider.PropertySource;
11
import org.eclipse.emf.transaction.TransactionalEditingDomain;
12
import org.eclipse.emf.transaction.util.TransactionUtil;
13
import org.eclipse.gef.EditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
15
import org.eclipse.gmf.runtime.notation.View;
16
import org.eclipse.jface.viewers.ISelection;
17
import org.eclipse.jface.viewers.StructuredSelection;
18
import org.eclipse.ui.IWorkbenchPart;
19
import org.eclipse.ui.views.properties.IPropertySource;
20
import org.eclipse.ui.views.properties.IPropertySourceProvider;
21
22
/**
23
 * @generated
24
 */
25
public class UMLPropertySection extends AdvancedPropertySection implements IPropertySourceProvider {
26
27
	/**
28
	 * @generated
29
	 */
30
	public IPropertySource getPropertySource(Object object) {
31
		if (object instanceof IPropertySource) {
32
			return (IPropertySource) object;
33
		}
34
		AdapterFactory af = getAdapterFactory(object);
35
		if (af != null) {
36
			IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
37
			if (ips != null) {
38
				return new PropertySource(object, ips);
39
			}
40
		}
41
		if (object instanceof IAdaptable) {
42
			return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
43
		}
44
		return null;
45
	}
46
47
	/**
48
	 * Modify/unwrap selection.  
49
	 * @generated
50
	 */
51
	protected Object transformSelection(Object selected) {
52
		if (selected instanceof EditPart) {
53
			Object model = ((EditPart) selected).getModel();
54
			return model instanceof View ? ((View) model).getElement() : null;
55
		}
56
		if (selected instanceof View) {
57
			return ((View) selected).getElement();
58
		}
59
		if (selected instanceof IAdaptable) {
60
			View view = (View) ((IAdaptable) selected).getAdapter(View.class);
61
			if (view != null) {
62
				return view.getElement();
63
			}
64
		}
65
		return selected;
66
	}
67
68
	/**
69
	 * @generated
70
	 */
71
	protected IPropertySourceProvider getPropertySourceProvider() {
72
		return this;
73
	}
74
75
	/**
76
	 * @generated
77
	 */
78
	public void setInput(IWorkbenchPart part, ISelection selection) {
79
		if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
80
			super.setInput(part, selection);
81
			return;
82
		}
83
		final StructuredSelection structuredSelection = ((StructuredSelection) selection);
84
		ArrayList transformedSelection = new ArrayList(structuredSelection.size());
85
		for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
86
			Object r = transformSelection(it.next());
87
			if (r != null) {
88
				transformedSelection.add(r);
89
			}
90
		}
91
		super.setInput(part, new StructuredSelection(transformedSelection));
92
	}
93
94
	/**
95
	 * @generated
96
	 */
97
	protected AdapterFactory getAdapterFactory(Object object) {
98
		if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
99
			return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
100
		}
101
		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
102
		if (editingDomain != null) {
103
			return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
104
		}
105
		return null;
106
	}
107
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLMatchingStrategy.java (+64 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.emf.common.util.URI;
4
5
import org.eclipse.emf.ecore.resource.Resource;
6
7
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorInput;
8
9
import org.eclipse.gmf.runtime.notation.Diagram;
10
11
import org.eclipse.ui.IEditorInput;
12
import org.eclipse.ui.IEditorMatchingStrategy;
13
import org.eclipse.ui.IEditorPart;
14
import org.eclipse.ui.IEditorReference;
15
import org.eclipse.ui.PartInitException;
16
17
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditorMatchingStrategy;
18
19
/**
20
 * @generated
21
 */
22
public class UMLMatchingStrategy implements IEditorMatchingStrategy {
23
24
	/**
25
	 * @generated
26
	 */
27
	public boolean matches(IEditorReference editorRef, IEditorInput input) {
28
		IEditorInput editorInput;
29
		try {
30
			editorInput = editorRef.getEditorInput();
31
		} catch (PartInitException e) {
32
			return false;
33
		}
34
35
		if (editorInput.equals(input)) {
36
			return true;
37
		}
38
39
		IEditorPart editor = editorRef.getEditor(false);
40
		if (input instanceof DiagramEditorInput && editor instanceof UMLDiagramEditor) {
41
			Diagram editorDiagram = ((UMLDiagramEditor) editor).getDiagram();
42
			Diagram otherDiagram = ((DiagramEditorInput) input).getDiagram();
43
			return equals(editorDiagram, otherDiagram);
44
		}
45
		return false;
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	private boolean equals(Diagram editorDiagram, Diagram otherDiagram) {
52
		Resource editorResource = editorDiagram.eResource();
53
		Resource otherResource = otherDiagram.eResource();
54
		if (editorResource != null && otherResource != null) {
55
			URI editorURI = editorResource.getURI();
56
			URI otherURI = otherResource.getURI();
57
			String editorURIFragment = editorResource.getURIFragment(editorDiagram);
58
			String otherURIFragment = otherResource.getURIFragment(otherDiagram);
59
			return editorURI.equals(otherURI) && editorURIFragment.equals(otherURIFragment);
60
		}
61
		return false;
62
	}
63
64
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InputPin2ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InputPin2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)icons/linkTargetNavigatorGroup.gif (+5 lines)
Added Link Here
1
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
2
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;Content-Type: image/gif
3
4
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
5
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPin2EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.InputPin2ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class InputPin2EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3004;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public InputPin2EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPin2ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return InputPin2EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinName2EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof InputPinName2EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/ControlFlowEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class ControlFlowEditHelper extends UMLBaseEditHelper {
7
}
(-)icons/incomingLinksNavigatorGroup.gif (+5 lines)
Added Link Here
1
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
2
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;Content-Type: image/gif
3
4
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
5
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/FlowFinalNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class FlowFinalNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/DecisionNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class DecisionNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinName2ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class InputPinName2ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/ActivityEditPart.java (+40 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
4
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
5
import org.eclipse.gmf.runtime.notation.View;
6
import org.eclipse.uml2.diagram.activity.edit.policies.ActivityCanonicalEditPolicy;
7
import org.eclipse.uml2.diagram.activity.edit.policies.ActivityItemSemanticEditPolicy;
8
9
/**
10
 * @generated
11
 */
12
public class ActivityEditPart extends DiagramEditPart {
13
14
	/**
15
	 * @generated
16
	 */
17
	public final static String MODEL_ID = "UMLActivity"; //$NON-NLS-1$
18
19
	/**
20
	 * @generated
21
	 */
22
	public static final int VISUAL_ID = 1000;
23
24
	/**
25
	 * @generated
26
	 */
27
	public ActivityEditPart(View view) {
28
		super(view);
29
	}
30
31
	/**
32
	 * @generated
33
	 */
34
	protected void createDefaultEditPolicies() {
35
		super.createDefaultEditPolicies();
36
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActivityItemSemanticEditPolicy());
37
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ActivityCanonicalEditPolicy());
38
39
	}
40
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/CallBehaviorActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class CallBehaviorActionEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramActionBarContributor.java (+23 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
4
5
/**
6
 * @generated
7
 */
8
public class UMLDiagramActionBarContributor extends DiagramActionBarContributor {
9
10
	/**
11
	 * @generated
12
	 */
13
	protected Class getEditorClass() {
14
		return UMLDiagramEditor.class;
15
	}
16
17
	/**
18
	 * @generated
19
	 */
20
	protected String getEditorId() {
21
		return UMLDiagramEditor.ID;
22
	}
23
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ActivityFinalNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class ActivityFinalNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/ControlFlowEditPart.java (+79 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.Connection;
4
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
5
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
6
import org.eclipse.gmf.runtime.notation.View;
7
import org.eclipse.uml2.diagram.activity.edit.policies.ControlFlowItemSemanticEditPolicy;
8
9
/**
10
 * @generated
11
 */
12
public class ControlFlowEditPart extends ConnectionNodeEditPart {
13
14
	/**
15
	 * @generated
16
	 */
17
	public static final int VISUAL_ID = 4001;
18
19
	/**
20
	 * @generated
21
	 */
22
	public ControlFlowEditPart(View view) {
23
		super(view);
24
	}
25
26
	/**
27
	 * @generated
28
	 */
29
	protected void createDefaultEditPolicies() {
30
		super.createDefaultEditPolicies();
31
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ControlFlowItemSemanticEditPolicy());
32
33
	}
34
35
	/**
36
	 * Creates figure for this edit part.
37
	 * 
38
	 * Body of this method does not depend on settings in generation model
39
	 * so you may safely remove <i>generated</i> tag and modify it.
40
	 * 
41
	 * @generated
42
	 */
43
	protected Connection createConnectionFigure() {
44
		return new ActivityEdgeConnection();
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	public class ActivityEdgeConnection extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {
51
52
		/**
53
		 * @generated
54
		 */
55
		public ActivityEdgeConnection() {
56
			this.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
57
			setTargetDecoration(createTargetDecoration());
58
		}
59
60
		/**
61
		 * @generated
62
		 */
63
		private org.eclipse.draw2d.PolylineDecoration createTargetDecoration() {
64
			org.eclipse.draw2d.PolylineDecoration df = new org.eclipse.draw2d.PolylineDecoration();
65
			// dispatchNext?
66
67
			org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();
68
			pl.addPoint(-2, -1);
69
			pl.addPoint(0, 0);
70
			pl.addPoint(-2, 1);
71
			df.setTemplate(pl);
72
			df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
73
74
			return df;
75
		}
76
77
	}
78
79
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinName2EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class InputPinName2EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5007;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(InputPinName2EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public InputPinName2EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.InputPin_3004;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CallBehaviorActionNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class CallBehaviorActionNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5012;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public CallBehaviorActionNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.CallBehaviorAction_2017;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)icons/wizban/NewUMLWizard.gif (+8 lines)
Added Link Here
1
GIF89aKBçÿÿÿîñøîñ÷¸ÃÖËÓâËÓáäéòíñø;Z‹=[Œ=[‹Ò輲ٌ™Ìf€À@Ca?Ec’Da?Fc’Fc‘He“Mi–Ok˜Ok—Qm™Rm™TošWqœWq›ZtžZt?]w _y¢`y¢`y¡c{£f~¥i?§lƒ©o†«p†ªs‰­vŒ¯z?±}’³}‘²ƒ—·„—·Š?»‹?¼‘£À’£À’£¿•¦Â™©Ä™©Ãœ¬ÆŸ¯È ¯È ¯Ç¤²Êª¸Î®»Ð·ÃÖ¸Ä×ÂÌÜÈÑàÓÛèÔÛçÖÝéØßêÞäîÜâìæëóäéñ<\Œ>]?=\‹?^Ž?^?A`?Db?Ec‘Ge“Fd‘Jg”Li•Qn™Rn™TpšWrœWr›YtžYt?]wŸ`z¢_y¡`z¡c|£e~¥l„©k„¨sŠ­uŒ¯y?±€•µƒ˜·„˜·‡›¹Šž¼Šž»? ½Ž¡¾Ž¡½‘¤À’¤À‘£¿‘¤¿’¤¿•§Á™ªÄ °ÈŸ¯Ç °Ç£³Ê¦µÌ©¸Î­»Ð®¼Ð±¾Ò´ÁÔ»ÇØ¾ÉÚÁÌÜÇÑàËÔâÍÖäÐÙæÎ×äÓÛçÕÝéÝäîÛâìàæïÞäíìðö˜ªÃœ­ÅŸ°ÈŸ°Ç¦¶Ì­¼Ð·ÄÖ¾ÊÚÄÏÞÈÒàÊÔáÓÜèÐÙåÎ×ãÖÞéäêòâèðêïöèíôÇÒàÍ×ãÓÜçÕÞéØàêßæïÝäíÛâëëðöêïõèíóïóøîò÷æìóäêñèîôíò÷ô®_ôÛ²óáÆ×Ä¥µ³?—£—†›–|•’u‘?c?…ž±²¨·´¼Â¹¼Â¹ÆÇ¶¼¹¬¢›’½ÃÇßàÞÌÆÏÎÈÑÑÌÖÙØãÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ,KBþH° Áƒ*\h0R#Jœ8Ñ!©‹)jÜ(1–€‡/rI’`,‡ Cf,ɲãI”*1¶œ©ðd?)c®¤Éóf,ŸrêìÙӿɠBc?iôhPRIC.-Ù4R¤PuŠœºñ§×›W¡F•Š0—Ù³hÓªMû“áW¯WÃjÝzW2fÉòêÝË·o®[ºp-|û2îçsâjÖ·q¤d?G%£µR$]·#|{3€€?†'F¨K•iÓ­R·Š	’kH£hɞ-›YfÍ
2
;{ý+âÑu“©R­šukZ­]?ZNà̺Lr~ù9ôX™¤U'+¾šõìå±gþÃ?+pfÁ?uû<Y=®Ø¹;ê"n<™åH´c‡ëoù[»ä2ÝzõæÞu	Í·Ýc¬¹É~´@HËx°Ì"
3
`˜f”n/xàut4Ÿq$>H[sRË(·Ýa¶g|ñ¤K‰¬?òÀŽ(ʦ",’$ÓbfÇäÂa‡~_‚‘t÷àŽ4Ð?>þ8^?CBç’ìVRJ(q“9&ó€Q6À€”Tù£$’d˜å\Rçå{‰yÀ«ð9&i$ž‰¦”¬é@›oÂ	fºè2L0
4
ôrL2uv)zò¹Ê¦œ&¸ÚrPښT^	'œà’ËÉ,À0þÂLZi’Oeª)§›ò™?1£@2ٙ¡úÀ”²½"	?pÊäÊÞŀ1»PZi{¤`kŸØfûçAº0§#šÂËf•§Êb.?'Ér2ÑÎ
5
’˜¢ˆ²ç¼¸Ö›P´à	*å¾ãÒb®$æšËe?Ì´Ëå»a†)ïžØÞÊé¶#[lgòËo›þ0’7Á’Œ1Җ§³(ï¼~ÖÛ)B»ÐVñ¾…Ž«ñÆMý$Ë( ‹ŒÉ˜šŒ²Ã¸B\P˳½LèšÄÎ,Ç[J’óo˜’2KÉ¢(q2Ã)k»Ê½.§y4›J¼å[Å4“ÕÎRO?ðÕX«Ü'×E‹jñaËåteë4KþÚ
6
[M/иÂ-› ^Kyh؟iP1Ì@½7É%ûü·Öo³|"áû®tÅkžÙ–@yÇ´·ÚV³Í°ÊºZ~9á;ÖÍù”lX(gç™6Õ¥O¸Ð}"-;Ò]÷Iâzþy³ëÍ·äm»?Ð0¿ËV·Ø±?ª8gÃ4žÓã¤çŽ²Û•ýïÓ/}Ò¡4í¢/ïÂ)k*ÿÖ??[ùæWÿÀWêy5Œˆ	“µ~ö=‡9bSÜÔó𧱗 O=é±IözFÀï­Â¼ 1ÈÁ&„§JVØ:ô@¤ç&ÃXÆÂ q®	Œ¡Ã†`"¤žþ4£Cþ®A‚‡HD!:"	?xˏÄF(1ƒ¼%®àY1vèK‡ò“a #I£??22‘‰F@#3¨@„ôÂ\Â!°l²ÅrQÈc3ôx„fôñ?Íh†)H#ò\ÙAދýYъ?ÜߖzÁ¶à1?˜Ì¤&3Y„B"2?¹JH/ˆW=p™²‘±;á†&ù“Knò•˜ì¤Ùè0Q’Ò”§4UÉKa0–™E3„H#<	ÙÊUøâRZl_¨¤ä$;¥›ø’Í`6µÉMmf“ˆìÓü‡?fàx¦”P©Å±%΀•7¹™Ímb³˜Iþgւ–?f62…
7
h@Q‰Ë‚¾îLÁ`@7ªMbæógnKÝA~qtîò„?Ì(°¢Ô9CË`(=ý¨Oz%óa	ùÅOª¨Qx¨-ŋ¬–AӚzÓ?H°ÖµN§²”¶¥ }©OÎé¹|THUFH±y„œ&Œ€Ê¬WڑŽüãå[‚Œ¤z“Œ?H˜žà×<{$’XBUMجF°­œÈQCÈ$°0jb]Xâ꧂ ­Éè0KØÂö°ˆ=¬0î¹%”¢gy%ë>ÉÉÅX`°¨L^½p6/IÐc’1Ú$0洘4m$ö„¶î™î¤(å?H[‡Š$ÄèR!QÂEH÷>ˆ‚¯#u\åØj;#0¹~{•jBâúÖÊΊ:ЉnyûZÀµñ¬¹¹èKú7-Ü¢
8
rk“,ø¦jÇ]òo¸³ºÔ¤Æ·ª±-¹óŒ4ÍÛ?ÝvF¹½]xш̖­Ïe~U2ºÈ¹wr¿ÝŒI(¹Eô×»»?Zä¼×¶q  ;
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/MergeNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class MergeNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/CallOperationActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class CallOperationActionEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/ActivityViewFactory.java (+42 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory;
8
import org.eclipse.gmf.runtime.notation.MeasurementUnit;
9
import org.eclipse.gmf.runtime.notation.NotationFactory;
10
import org.eclipse.gmf.runtime.notation.View;
11
12
/**
13
 * @generated
14
 */
15
public class ActivityViewFactory extends DiagramViewFactory {
16
17
	/**
18
	 * @generated 
19
	 */
20
	protected List createStyles(View view) {
21
		List styles = new ArrayList();
22
		styles.add(NotationFactory.eINSTANCE.createPageStyle());
23
		styles.add(NotationFactory.eINSTANCE.createGuideStyle());
24
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
25
		return styles;
26
	}
27
28
	/**
29
	 * @generated
30
	 */
31
	protected void decorateView(View view, IAdaptable semanticAdapter, String diagramKind) {
32
		super.decorateView(view, semanticAdapter, diagramKind);
33
	}
34
35
	/**
36
	 * @generated
37
	 */
38
	protected MeasurementUnit getMeasurementUnit() {
39
		return MeasurementUnit.PIXEL_LITERAL;
40
	}
41
42
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class InputPinViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(InputPinNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CreateObjectActionViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class CreateObjectActionViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(CreateObjectActionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/UMLReferenceConnectionEditPolicy.java (+150 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.transaction.TransactionalEditingDomain;
4
import org.eclipse.gef.EditPart;
5
import org.eclipse.gef.Request;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.CompoundCommand;
8
import org.eclipse.gef.commands.UnexecutableCommand;
9
import org.eclipse.gef.editparts.AbstractConnectionEditPart;
10
import org.eclipse.gef.editpolicies.ConnectionEditPolicy;
11
import org.eclipse.gef.requests.GroupRequest;
12
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
13
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
16
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
17
import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants;
18
import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
19
import org.eclipse.gmf.runtime.diagram.ui.requests.GroupRequestViaKeyboard;
20
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
21
import org.eclipse.gmf.runtime.notation.View;
22
import org.eclipse.jface.dialogs.IDialogConstants;
23
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
24
import org.eclipse.jface.preference.IPreferenceStore;
25
import org.eclipse.jface.util.Assert;
26
import org.eclipse.swt.widgets.Display;
27
28
/**
29
 * @generated
30
 */
31
public class UMLReferenceConnectionEditPolicy extends ConnectionEditPolicy {
32
33
	/**
34
	 * @generated
35
	 */
36
	private static final String DELETE_FROM_DIAGRAM_DLG_TITLE = DiagramUIMessages.PromptingDeleteAction_DeleteFromDiagramDialog_Title;
37
38
	/**
39
	 * @generated
40
	 */
41
	private static final String DELETE_FROM_DIAGRAM_DLG_MESSAGE = DiagramUIMessages.PromptingDeleteAction_DeleteFromDiagramDialog_Message;
42
43
	/**
44
	 * @generated
45
	 */
46
	private static final String DELETE_FROM_MODEL_DLG_TOGGLE_LABEL = DiagramUIMessages.MessageDialogWithToggle_DoNotPromptAgainToggle_label;
47
48
	/**
49
	 * @generated
50
	 */
51
	protected final Command getDeleteCommand(GroupRequest deleteRequest) {
52
		boolean isDeleteFromKeyBoard = deleteRequest instanceof GroupRequestViaKeyboard;
53
		if (shouldDeleteSemantic()) {
54
			return createDeleteSemanticCommand(deleteRequest);
55
		} else {
56
			boolean proceedToDeleteView = true;
57
			if (isDeleteFromKeyBoard) {
58
				GroupRequestViaKeyboard groupRequestViaKeyboard = (GroupRequestViaKeyboard) deleteRequest;
59
				if (groupRequestViaKeyboard.isShowInformationDialog()) {
60
					proceedToDeleteView = showPrompt();
61
					groupRequestViaKeyboard.setShowInformationDialog(false);
62
					if (!(proceedToDeleteView))
63
						return UnexecutableCommand.INSTANCE;
64
				}
65
			}
66
			return createDeleteViewCommand(deleteRequest);
67
		}
68
	}
69
70
	/**
71
	 * @generated
72
	 */
73
	protected boolean shouldDeleteSemantic() {
74
		Assert.isTrue(getHost() instanceof AbstractConnectionEditPart);
75
		AbstractConnectionEditPart cep = (AbstractConnectionEditPart) getHost();
76
		boolean isCanonical = false;
77
		if (cep.getSource() != null)
78
			isCanonical = IsCanonical(cep.getSource());
79
		if (cep.getTarget() != null)
80
			return isCanonical ? isCanonical : IsCanonical(cep.getTarget());
81
		return isCanonical;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	private boolean IsCanonical(EditPart ep) {
88
		EditPart parent = ep.getParent();
89
		return parent instanceof GraphicalEditPart ? ((GraphicalEditPart) parent).isCanonical() : false;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
96
		TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
97
		return new ICommandProxy(new DeleteCommand(editingDomain, (View) getHost().getModel()));
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected Command createDeleteSemanticCommand(GroupRequest deleteRequest) {
104
		TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
105
		EditCommandRequestWrapper semReq = new EditCommandRequestWrapper(new DestroyElementRequest(editingDomain, false), deleteRequest.getExtendedData());
106
		Command semanticCmd = getHost().getCommand(semReq);
107
		if (semanticCmd != null && semanticCmd.canExecute()) {
108
			CompoundCommand cc = new CompoundCommand();
109
			cc.add(semanticCmd);
110
			return cc;
111
		}
112
		return null;
113
	}
114
115
	/**
116
	 * @generated
117
	 */
118
	private boolean showPrompt() {
119
		boolean prompt = ((IPreferenceStore) ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint().getPreferenceStore()).getBoolean(IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_DIAGRAM);
120
		if (prompt)
121
			if (showMessageDialog())
122
				return true;
123
			else
124
				return false;
125
		return true;
126
	}
127
128
	/**
129
	 * @generated
130
	 */
131
	private boolean showMessageDialog() {
132
		MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(Display.getCurrent().getActiveShell(), DELETE_FROM_DIAGRAM_DLG_TITLE, DELETE_FROM_DIAGRAM_DLG_MESSAGE,
133
				DELETE_FROM_MODEL_DLG_TOGGLE_LABEL, false, (IPreferenceStore) ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint().getPreferenceStore(),
134
				IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_DIAGRAM);
135
		if (dialog.getReturnCode() == IDialogConstants.YES_ID)
136
			return true;
137
		else
138
			return false;
139
	}
140
141
	/**
142
	 * @generated
143
	 */
144
	public Command getCommand(Request request) {
145
		if (request instanceof GroupRequestViaKeyboard) {
146
			return getDeleteCommand((GroupRequest) request);
147
		}
148
		return super.getCommand(request);
149
	}
150
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorSorter.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.jface.viewers.ViewerSorter;
4
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
5
6
/**
7
 * @generated
8
 */
9
public class UMLNavigatorSorter extends ViewerSorter {
10
11
	/**
12
	 * @generated
13
	 */
14
	private static final int GROUP_CATEGORY = 4003;
15
16
	/**
17
	 * @generated
18
	 */
19
	public int category(Object element) {
20
		if (element instanceof UMLNavigatorItem) {
21
			UMLNavigatorItem item = (UMLNavigatorItem) element;
22
			if (ActivityEditPart.MODEL_ID.equals(item.getModelID())) {
23
				return item.getVisualID();
24
			}
25
		}
26
		return GROUP_CATEGORY;
27
	}
28
29
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPinName3EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class OutputPinName3EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5010;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(OutputPinName3EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public OutputPinName3EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.OutputPin_3006;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPinName2ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class OutputPinName2ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramPreferenceInitializer.java (+17 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramPreferenceInitializer;
4
import org.eclipse.jface.preference.IPreferenceStore;
5
6
/**
7
 * @generated
8
 */
9
public class UMLDiagramPreferenceInitializer extends DiagramPreferenceInitializer {
10
11
	/**
12
	 * @generated
13
	 */
14
	protected IPreferenceStore getPreferenceStore() {
15
		return org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
16
	}
17
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/ForkNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class ForkNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CreateObjectActionNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class CreateObjectActionNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/PinItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class PinItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/AddStructuralFeatureValueActionItemSemanticEditPolicy.java (+332 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
13
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
14
import org.eclipse.gmf.runtime.notation.View;
15
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
16
import org.eclipse.uml2.uml.Activity;
17
import org.eclipse.uml2.uml.ActivityNode;
18
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
19
import org.eclipse.uml2.uml.ControlFlow;
20
import org.eclipse.uml2.uml.ObjectFlow;
21
import org.eclipse.uml2.uml.UMLPackage;
22
23
/**
24
 * @generated
25
 */
26
public class AddStructuralFeatureValueActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
27
28
	/**
29
	 * @generated
30
	 */
31
	protected Command getCreateCommand(CreateElementRequest req) {
32
		if (UMLElementTypes.InputPin_3003 == req.getElementType()) {
33
			AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer());
34
			if (container.getInsertAt() != null) {
35
				return super.getCreateCommand(req);
36
			}
37
			if (req.getContainmentFeature() == null) {
38
				req.setContainmentFeature(UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction_InsertAt());
39
			}
40
			return getMSLWrapper(new CreateInputPin_3003Command(req));
41
		}
42
		if (UMLElementTypes.InputPin_3004 == req.getElementType()) {
43
			AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer());
44
			if (container.getValue() != null) {
45
				return super.getCreateCommand(req);
46
			}
47
			if (req.getContainmentFeature() == null) {
48
				req.setContainmentFeature(UMLPackage.eINSTANCE.getWriteStructuralFeatureAction_Value());
49
			}
50
			return getMSLWrapper(new CreateInputPin_3004Command(req));
51
		}
52
		if (UMLElementTypes.InputPin_3005 == req.getElementType()) {
53
			AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer());
54
			if (container.getObject() != null) {
55
				return super.getCreateCommand(req);
56
			}
57
			if (req.getContainmentFeature() == null) {
58
				req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuralFeatureAction_Object());
59
			}
60
			return getMSLWrapper(new CreateInputPin_3005Command(req));
61
		}
62
		return super.getCreateCommand(req);
63
	}
64
65
	/**
66
	 * @generated
67
	 */
68
	private static class CreateInputPin_3003Command extends CreateElementCommand {
69
70
		/**
71
		 * @generated
72
		 */
73
		public CreateInputPin_3003Command(CreateElementRequest req) {
74
			super(req);
75
		}
76
77
		/**
78
		 * @generated
79
		 */
80
		protected EClass getEClassToEdit() {
81
			return UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction();
82
		};
83
84
		/**
85
		 * @generated
86
		 */
87
		protected EObject getElementToEdit() {
88
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
89
			if (container instanceof View) {
90
				container = ((View) container).getElement();
91
			}
92
			return container;
93
		}
94
	}
95
96
	/**
97
	 * @generated
98
	 */
99
	private static class CreateInputPin_3004Command extends CreateElementCommand {
100
101
		/**
102
		 * @generated
103
		 */
104
		public CreateInputPin_3004Command(CreateElementRequest req) {
105
			super(req);
106
		}
107
108
		/**
109
		 * @generated
110
		 */
111
		protected EClass getEClassToEdit() {
112
			return UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction();
113
		};
114
115
		/**
116
		 * @generated
117
		 */
118
		protected EObject getElementToEdit() {
119
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
120
			if (container instanceof View) {
121
				container = ((View) container).getElement();
122
			}
123
			return container;
124
		}
125
	}
126
127
	/**
128
	 * @generated
129
	 */
130
	private static class CreateInputPin_3005Command extends CreateElementCommand {
131
132
		/**
133
		 * @generated
134
		 */
135
		public CreateInputPin_3005Command(CreateElementRequest req) {
136
			super(req);
137
		}
138
139
		/**
140
		 * @generated
141
		 */
142
		protected EClass getEClassToEdit() {
143
			return UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction();
144
		};
145
146
		/**
147
		 * @generated
148
		 */
149
		protected EObject getElementToEdit() {
150
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
151
			if (container instanceof View) {
152
				container = ((View) container).getElement();
153
			}
154
			return container;
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
162
		return getMSLWrapper(new DestroyElementCommand(req) {
163
164
			protected EObject getElementToDestroy() {
165
				View view = (View) getHost().getModel();
166
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
167
				if (annotation != null) {
168
					return view;
169
				}
170
				return super.getElementToDestroy();
171
			}
172
173
		});
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
180
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
181
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
182
		}
183
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
184
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
185
		}
186
		return super.getCreateRelationshipCommand(req);
187
	}
188
189
	/**
190
	 * @generated
191
	 */
192
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
193
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
194
			return UnexecutableCommand.INSTANCE;
195
		}
196
		return new Command() {
197
		};
198
	}
199
200
	/**
201
	 * @generated
202
	 */
203
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
204
		if (!(req.getSource() instanceof ActivityNode)) {
205
			return UnexecutableCommand.INSTANCE;
206
		}
207
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
208
		if (element == null) {
209
			return UnexecutableCommand.INSTANCE;
210
		}
211
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
212
			return UnexecutableCommand.INSTANCE;
213
		}
214
		if (req.getContainmentFeature() == null) {
215
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
216
		}
217
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
218
219
			protected EObject getElementToEdit() {
220
				return element;
221
			}
222
		});
223
	}
224
225
	/**
226
	 * @generated
227
	 */
228
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
229
230
		/**
231
		 * @generated
232
		 */
233
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
234
			super(req);
235
		}
236
237
		/**
238
		 * @generated
239
		 */
240
		protected EClass getEClassToEdit() {
241
			return UMLPackage.eINSTANCE.getActivity();
242
		};
243
244
		/**
245
		 * @generated
246
		 */
247
		protected void setElementToEdit(EObject element) {
248
			throw new UnsupportedOperationException();
249
		}
250
251
		/**
252
		 * @generated
253
		 */
254
		protected EObject doDefaultElementCreation() {
255
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
256
			if (newElement != null) {
257
				newElement.setTarget((ActivityNode) getTarget());
258
				newElement.setSource((ActivityNode) getSource());
259
			}
260
			return newElement;
261
		}
262
	}
263
264
	/**
265
	 * @generated
266
	 */
267
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
268
		return new Command() {
269
		};
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
276
		if (!(req.getSource() instanceof ActivityNode)) {
277
			return UnexecutableCommand.INSTANCE;
278
		}
279
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
280
		if (element == null) {
281
			return UnexecutableCommand.INSTANCE;
282
		}
283
		if (req.getContainmentFeature() == null) {
284
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
285
		}
286
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
287
288
			protected EObject getElementToEdit() {
289
				return element;
290
			}
291
		});
292
	}
293
294
	/**
295
	 * @generated
296
	 */
297
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
298
299
		/**
300
		 * @generated
301
		 */
302
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
303
			super(req);
304
		}
305
306
		/**
307
		 * @generated
308
		 */
309
		protected EClass getEClassToEdit() {
310
			return UMLPackage.eINSTANCE.getActivity();
311
		};
312
313
		/**
314
		 * @generated
315
		 */
316
		protected void setElementToEdit(EObject element) {
317
			throw new UnsupportedOperationException();
318
		}
319
320
		/**
321
		 * @generated
322
		 */
323
		protected EObject doDefaultElementCreation() {
324
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
325
			if (newElement != null) {
326
				newElement.setTarget((ActivityNode) getTarget());
327
				newElement.setSource((ActivityNode) getSource());
328
			}
329
			return newElement;
330
		}
331
	}
332
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramFileCreator.java (+69 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.core.resources.IWorkspaceRoot;
4
import org.eclipse.core.resources.ResourcesPlugin;
5
import org.eclipse.core.runtime.IPath;
6
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.util.DiagramFileCreator;
7
8
/**
9
 * @generated
10
 */
11
public class UMLDiagramFileCreator extends DiagramFileCreator {
12
13
	/**
14
	 * @generated
15
	 */
16
	private static UMLDiagramFileCreator INSTANCE = new UMLDiagramFileCreator();
17
18
	/**
19
	 * @generated
20
	 */
21
	public static DiagramFileCreator getInstance() {
22
		return INSTANCE;
23
	}
24
25
	/**
26
	 * @generated
27
	 */
28
	public String getExtension() {
29
		return ".umlactivity_diagram"; //$NON-NLS-1$
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	public String getUniqueFileName(IPath containerPath, String fileName) {
36
		int nFileNumber = 1;
37
		fileName = removeExtensionFromFileName(fileName);
38
		String newFileName = fileName;
39
40
		IPath diagramFilePath = containerPath.append(appendExtensionToFileName(newFileName));
41
		IPath modelFilePath = containerPath.append(appendExtensionToModelFileName(newFileName));
42
		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
43
44
		while (workspaceRoot.exists(diagramFilePath) || workspaceRoot.exists(modelFilePath)) {
45
			nFileNumber++;
46
			newFileName = fileName + nFileNumber;
47
			diagramFilePath = containerPath.append(appendExtensionToFileName(newFileName));
48
			modelFilePath = containerPath.append(appendExtensionToModelFileName(newFileName));
49
		}
50
		return newFileName;
51
	}
52
53
	/**
54
	 * @generated
55
	 */
56
	private String removeExtensionFromFileName(String fileName) {
57
		if (fileName.endsWith(getExtension())) {
58
			return fileName.substring(0, fileName.length() - getExtension().length());
59
		}
60
		return fileName;
61
	}
62
63
	/**
64
	 * @generated
65
	 */
66
	private String appendExtensionToModelFileName(String fileName) {
67
		return fileName + ".uml"; //$NON-NLS-1$
68
	}
69
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CentralBufferNodeEditPart.java (+246 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.CentralBufferNodeItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class CentralBufferNodeEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2009;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public CentralBufferNodeEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CentralBufferNodeItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		CentralBufferFigure figure = new CentralBufferFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public CentralBufferFigure getPrimaryShape() {
94
		return (CentralBufferFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class CentralBufferFigure extends org.eclipse.draw2d.RectangleFigure {
151
152
		/**
153
		 * @generated
154
		 */
155
		public CentralBufferFigure() {
156
157
			org.eclipse.draw2d.BorderLayout myGenLayoutManager = new org.eclipse.draw2d.BorderLayout();
158
159
			this.setLayoutManager(myGenLayoutManager);
160
161
			createContents();
162
		}
163
164
		/**
165
		 * @generated
166
		 */
167
		private void createContents() {
168
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
169
			fig_0.setText("\u00ABcentralBuffer\u00BB");
170
171
			setFigureCentralBufferFigure_fixed_central(fig_0);
172
173
			Object layData0 = org.eclipse.draw2d.BorderLayout.TOP;
174
175
			this.add(fig_0, layData0);
176
			org.eclipse.draw2d.RectangleFigure fig_1 = new org.eclipse.draw2d.RectangleFigure();
177
			fig_1.setFill(false);
178
			fig_1.setOutline(false);
179
180
			setFigureCentralBufferFigure_ContentPane(fig_1);
181
182
			Object layData1 = org.eclipse.draw2d.BorderLayout.CENTER;
183
184
			this.add(fig_1, layData1);
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fCentralBufferFigure_fixed_central;
191
192
		/**
193
		 * @generated
194
		 */
195
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureCentralBufferFigure_fixed_central() {
196
			return fCentralBufferFigure_fixed_central;
197
		}
198
199
		/**
200
		 * @generated
201
		 */
202
		private void setFigureCentralBufferFigure_fixed_central(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
203
			fCentralBufferFigure_fixed_central = fig;
204
		}
205
206
		/**
207
		 * @generated
208
		 */
209
		private org.eclipse.draw2d.RectangleFigure fCentralBufferFigure_ContentPane;
210
211
		/**
212
		 * @generated
213
		 */
214
		public org.eclipse.draw2d.RectangleFigure getFigureCentralBufferFigure_ContentPane() {
215
			return fCentralBufferFigure_ContentPane;
216
		}
217
218
		/**
219
		 * @generated
220
		 */
221
		private void setFigureCentralBufferFigure_ContentPane(org.eclipse.draw2d.RectangleFigure fig) {
222
			fCentralBufferFigure_ContentPane = fig;
223
		}
224
225
		/**
226
		 * @generated
227
		 */
228
		private boolean myUseLocalCoordinates = false;
229
230
		/**
231
		 * @generated
232
		 */
233
		protected boolean useLocalCoordinates() {
234
			return myUseLocalCoordinates;
235
		}
236
237
		/**
238
		 * @generated
239
		 */
240
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
241
			myUseLocalCoordinates = useLocalCoordinates;
242
		}
243
244
	}
245
246
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDocumentProvider.java (+204 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.io.IOException;
4
import java.util.ArrayList;
5
import java.util.Collection;
6
import java.util.Collections;
7
import java.util.Iterator;
8
import java.util.List;
9
10
import org.eclipse.core.resources.IFile;
11
import org.eclipse.core.resources.IResource;
12
import org.eclipse.core.resources.IStorage;
13
import org.eclipse.core.runtime.CoreException;
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.SubProgressMonitor;
16
import org.eclipse.core.runtime.jobs.ISchedulingRule;
17
import org.eclipse.core.runtime.jobs.MultiRule;
18
import org.eclipse.emf.common.notify.Notification;
19
import org.eclipse.emf.ecore.EObject;
20
import org.eclipse.emf.ecore.resource.Resource;
21
import org.eclipse.emf.transaction.DemultiplexingListener;
22
import org.eclipse.emf.transaction.NotificationFilter;
23
import org.eclipse.emf.transaction.TransactionalEditingDomain;
24
import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
25
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
26
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramModificationListener;
27
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
28
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
29
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDiagramDocumentProvider;
30
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileDiagramModificationListener;
31
import org.eclipse.gmf.runtime.notation.Diagram;
32
import org.eclipse.ui.IFileEditorInput;
33
34
/**
35
 * @generated
36
 */
37
public class UMLDocumentProvider extends FileDiagramDocumentProvider {
38
39
	/**
40
	 * @generated
41
	 */
42
	private final String contentObjectURI;
43
44
	/**
45
	 * @generated
46
	 */
47
	public UMLDocumentProvider() {
48
		this(null);
49
	}
50
51
	/**
52
	 * @generated
53
	 */
54
	public UMLDocumentProvider(String rootObjectURI) {
55
		this.contentObjectURI = rootObjectURI;
56
	}
57
58
	/**
59
	 * @generated
60
	 */
61
	protected void setDocumentContentFromStorage(IDocument document, IStorage storage) throws CoreException {
62
		super.setDocumentContentFromStorage(document, storage);
63
		if (contentObjectURI == null || false == document.getContent() instanceof EObject) {
64
			return;
65
		}
66
		EObject currentContent = (EObject) document.getContent();
67
		if (currentContent.eResource().getURIFragment(currentContent) == contentObjectURI) {
68
			return; // already there
69
		}
70
		EObject anotherContentObject = currentContent.eResource().getEObject(contentObjectURI);
71
		document.setContent(anotherContentObject);
72
	}
73
74
	/**
75
	 * @generated
76
	 */
77
	protected void saveDocumentToFile(IDocument document, IFile file, boolean overwrite, IProgressMonitor monitor) throws CoreException {
78
		Diagram diagram = (Diagram) document.getContent();
79
		Resource diagramResource = diagram.eResource();
80
		IDiagramDocument diagramDocument = (IDiagramDocument) document;
81
		TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
82
		List resources = domain.getResourceSet().getResources();
83
84
		monitor.beginTask("Saving diagram", resources.size() + 1); //$NON-NLS-1$
85
		super.saveDocumentToFile(document, file, overwrite, new SubProgressMonitor(monitor, 1));
86
		for (Iterator it = resources.iterator(); it.hasNext();) {
87
			Resource nextResource = (Resource) it.next();
88
			monitor.setTaskName("Saving " + nextResource.getURI()); //$NON-NLS-1$
89
			if (nextResource != diagramResource && nextResource.isLoaded() && (!nextResource.isTrackingModification() || nextResource.isModified())) {
90
				try {
91
					nextResource.save(Collections.EMPTY_MAP);
92
				} catch (IOException e) {
93
					UMLDiagramEditorPlugin.getInstance().logError("Unable to save resource: " + nextResource.getURI(), e); //$NON-NLS-1$
94
				}
95
			}
96
			monitor.worked(1);
97
		}
98
		monitor.done();
99
	}
100
101
	/**
102
	 * @generated
103
	 */
104
	protected ISchedulingRule getSaveRule(Object element) {
105
		IDiagramDocument diagramDocument = getDiagramDocument(element);
106
		if (diagramDocument != null) {
107
			Diagram diagram = diagramDocument.getDiagram();
108
			if (diagram != null) {
109
				Collection rules = new ArrayList();
110
				for (Iterator it = diagramDocument.getEditingDomain().getResourceSet().getResources().iterator(); it.hasNext();) {
111
					IFile nextFile = WorkspaceSynchronizer.getFile((Resource) it.next());
112
					if (nextFile != null) {
113
						rules.add(computeSaveSchedulingRule(nextFile));
114
					}
115
				}
116
				return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
117
			}
118
		}
119
		return super.getSaveRule(element);
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected FileInfo createFileInfo(IDocument document, FileSynchronizer synchronizer, IFileEditorInput input) {
126
		assert document instanceof DiagramDocument;
127
128
		DiagramModificationListener diagramListener = new CustomModificationListener(this, (DiagramDocument) document, input);
129
		DiagramFileInfo info = new DiagramFileInfo(document, synchronizer, diagramListener);
130
131
		diagramListener.startListening();
132
		return info;
133
	}
134
135
	/**
136
	 * @generated
137
	 */
138
	private ISchedulingRule computeSaveSchedulingRule(IResource toCreateOrModify) {
139
		if (toCreateOrModify.exists() && toCreateOrModify.isSynchronized(IResource.DEPTH_ZERO))
140
			return fResourceRuleFactory.modifyRule(toCreateOrModify);
141
142
		IResource parent = toCreateOrModify;
143
		do {
144
			/*
145
			 * XXX This is a workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
146
			 * IResourceRuleFactory.createRule should iterate the hierarchy itself.
147
			 */
148
			toCreateOrModify = parent;
149
			parent = toCreateOrModify.getParent();
150
		} while (parent != null && !parent.exists() && !parent.isSynchronized(IResource.DEPTH_ZERO));
151
152
		return fResourceRuleFactory.createRule(toCreateOrModify);
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	private class CustomModificationListener extends FileDiagramModificationListener {
159
160
		/**
161
		 * @generated
162
		 */
163
		private DemultiplexingListener myListener = null;
164
165
		/**
166
		 * @generated
167
		 */
168
		public CustomModificationListener(UMLDocumentProvider documentProviderParameter, DiagramDocument documentParameter, IFileEditorInput inputParameter) {
169
			super(documentProviderParameter, documentParameter, inputParameter);
170
			final DiagramDocument document = documentParameter;
171
			NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET);
172
			myListener = new DemultiplexingListener(diagramResourceModifiedFilter) {
173
174
				protected void handleNotification(TransactionalEditingDomain domain, Notification notification) {
175
					if (notification.getNotifier() instanceof EObject) {
176
						Resource modifiedResource = ((EObject) notification.getNotifier()).eResource();
177
						if (modifiedResource != document.getDiagram().eResource()) {
178
							document.setContent(document.getContent());
179
						}
180
					}
181
182
				}
183
			};
184
		}
185
186
		/**
187
		 * @generated
188
		 */
189
		public void startListening() {
190
			super.startListening();
191
			getEditingDomain().addResourceSetListener(myListener);
192
		}
193
194
		/**
195
		 * @generated
196
		 */
197
		public void stopListening() {
198
			getEditingDomain().removeResourceSetListener(myListener);
199
			super.stopListening();
200
		}
201
202
	}
203
204
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLVisualIDRegistry.java (+1049 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.core.runtime.Platform;
4
import org.eclipse.emf.ecore.EAnnotation;
5
import org.eclipse.emf.ecore.EClass;
6
import org.eclipse.emf.ecore.EObject;
7
import org.eclipse.gmf.runtime.notation.Diagram;
8
import org.eclipse.gmf.runtime.notation.View;
9
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart;
10
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart;
13
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
16
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart;
17
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
18
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart;
19
import org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart;
20
import org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart;
21
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
22
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart;
23
import org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart;
24
import org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart;
25
import org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart;
26
import org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart;
27
import org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart;
28
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
29
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
30
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
31
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
32
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
33
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart;
34
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart;
35
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart;
36
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart;
37
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart;
38
import org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart;
39
import org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart;
40
import org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart;
41
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
42
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart;
43
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
44
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
45
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
46
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart;
47
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart;
48
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart;
49
import org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart;
50
import org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart;
51
import org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart;
52
import org.eclipse.uml2.diagram.activity.expressions.UMLAbstractExpression;
53
import org.eclipse.uml2.diagram.activity.expressions.UMLOCLFactory;
54
import org.eclipse.uml2.uml.AcceptEventAction;
55
import org.eclipse.uml2.uml.Activity;
56
import org.eclipse.uml2.uml.ActivityFinalNode;
57
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
58
import org.eclipse.uml2.uml.CallBehaviorAction;
59
import org.eclipse.uml2.uml.CallOperationAction;
60
import org.eclipse.uml2.uml.CentralBufferNode;
61
import org.eclipse.uml2.uml.ControlFlow;
62
import org.eclipse.uml2.uml.CreateObjectAction;
63
import org.eclipse.uml2.uml.DataStoreNode;
64
import org.eclipse.uml2.uml.DecisionNode;
65
import org.eclipse.uml2.uml.FlowFinalNode;
66
import org.eclipse.uml2.uml.ForkNode;
67
import org.eclipse.uml2.uml.InitialNode;
68
import org.eclipse.uml2.uml.InputPin;
69
import org.eclipse.uml2.uml.JoinNode;
70
import org.eclipse.uml2.uml.MergeNode;
71
import org.eclipse.uml2.uml.ObjectFlow;
72
import org.eclipse.uml2.uml.OpaqueAction;
73
import org.eclipse.uml2.uml.OutputPin;
74
import org.eclipse.uml2.uml.Pin;
75
import org.eclipse.uml2.uml.StructuredActivityNode;
76
import org.eclipse.uml2.uml.UMLPackage;
77
78
/**
79
 * This registry is used to determine which type of visual object should be
80
 * created for the corresponding Diagram, Node, ChildNode or Link represented 
81
 * by a domain model object.
82
 *
83
 * @generated
84
 */
85
public class UMLVisualIDRegistry {
86
87
	/**
88
	 * @generated
89
	 */
90
	private static final String DEBUG_KEY = UMLDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/visualID"; //$NON-NLS-1$
91
92
	/**
93
	 * @generated
94
	 */
95
	public static int getVisualID(View view) {
96
		if (view instanceof Diagram) {
97
			if (ActivityEditPart.MODEL_ID.equals(view.getType())) {
98
				return ActivityEditPart.VISUAL_ID;
99
			} else {
100
				return -1;
101
			}
102
		}
103
		return getVisualID(view.getType());
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	public static String getModelID(View view) {
110
		View diagram = view.getDiagram();
111
		while (view != diagram) {
112
			EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
113
			if (annotation != null) {
114
				return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$
115
			}
116
			view = (View) view.eContainer();
117
		}
118
		return diagram != null ? diagram.getType() : null;
119
	}
120
121
	/**
122
	 * @generated
123
	 */
124
	public static int getVisualID(String type) {
125
		try {
126
			return Integer.parseInt(type);
127
		} catch (NumberFormatException e) {
128
			if (Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption(DEBUG_KEY))) {
129
				UMLDiagramEditorPlugin.getInstance().logError("Unable to parse view type as a visualID number: " + type);
130
			}
131
		}
132
		return -1;
133
	}
134
135
	/**
136
	 * @generated
137
	 */
138
	public static String getType(int visualID) {
139
		return String.valueOf(visualID);
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public static int getDiagramVisualID(EObject domainElement) {
146
		if (domainElement == null) {
147
			return -1;
148
		}
149
		EClass domainElementMetaclass = domainElement.eClass();
150
		return getDiagramVisualID(domainElement, domainElementMetaclass);
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	private static int getDiagramVisualID(EObject domainElement, EClass domainElementMetaclass) {
157
		if (UMLPackage.eINSTANCE.getActivity().isSuperTypeOf(domainElementMetaclass) && isDiagramActivity_1000((Activity) domainElement)) {
158
			return ActivityEditPart.VISUAL_ID;
159
		}
160
		return getUnrecognizedDiagramID(domainElement);
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public static int getNodeVisualID(View containerView, EObject domainElement) {
167
		if (domainElement == null) {
168
			return -1;
169
		}
170
		EClass domainElementMetaclass = domainElement.eClass();
171
		return getNodeVisualID(containerView, domainElement, domainElementMetaclass, null);
172
	}
173
174
	/**
175
	 * @generated
176
	 */
177
	public static int getNodeVisualID(View containerView, EObject domainElement, EClass domainElementMetaclass, String semanticHint) {
178
		String containerModelID = getModelID(containerView);
179
		if (!ActivityEditPart.MODEL_ID.equals(containerModelID)) {
180
			return -1;
181
		}
182
		int containerVisualID;
183
		if (ActivityEditPart.MODEL_ID.equals(containerModelID)) {
184
			containerVisualID = getVisualID(containerView);
185
		} else {
186
			if (containerView instanceof Diagram) {
187
				containerVisualID = ActivityEditPart.VISUAL_ID;
188
			} else {
189
				return -1;
190
			}
191
		}
192
		int nodeVisualID = semanticHint != null ? getVisualID(semanticHint) : -1;
193
		switch (containerVisualID) {
194
		case AcceptEventActionEditPart.VISUAL_ID:
195
			return getUnrecognizedAcceptEventAction_2001ChildNodeID(domainElement, semanticHint);
196
		case AcceptEventAction2EditPart.VISUAL_ID:
197
			return getUnrecognizedAcceptEventAction_2002ChildNodeID(domainElement, semanticHint);
198
		case ActivityFinalNodeEditPart.VISUAL_ID:
199
			return getUnrecognizedActivityFinalNode_2003ChildNodeID(domainElement, semanticHint);
200
		case DecisionNodeEditPart.VISUAL_ID:
201
			return getUnrecognizedDecisionNode_2004ChildNodeID(domainElement, semanticHint);
202
		case MergeNodeEditPart.VISUAL_ID:
203
			return getUnrecognizedMergeNode_2005ChildNodeID(domainElement, semanticHint);
204
		case InitialNodeEditPart.VISUAL_ID:
205
			return getUnrecognizedInitialNode_2006ChildNodeID(domainElement, semanticHint);
206
		case StructuredActivityNodeEditPart.VISUAL_ID:
207
			return getUnrecognizedStructuredActivityNode_2007ChildNodeID(domainElement, semanticHint);
208
		case DataStoreNodeEditPart.VISUAL_ID:
209
			return getUnrecognizedDataStoreNode_2008ChildNodeID(domainElement, semanticHint);
210
		case CentralBufferNodeEditPart.VISUAL_ID:
211
			return getUnrecognizedCentralBufferNode_2009ChildNodeID(domainElement, semanticHint);
212
		case OpaqueActionEditPart.VISUAL_ID:
213
			if (OpaqueActionNameEditPart.VISUAL_ID == nodeVisualID) {
214
				return OpaqueActionNameEditPart.VISUAL_ID;
215
			}
216
			if ((semanticHint == null || OutputPinEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElementMetaclass)
217
					&& (domainElement == null || isNodeOutputPin_3001((OutputPin) domainElement))) {
218
				return OutputPinEditPart.VISUAL_ID;
219
			}
220
			return getUnrecognizedOpaqueAction_2010ChildNodeID(domainElement, semanticHint);
221
		case FlowFinalNodeEditPart.VISUAL_ID:
222
			return getUnrecognizedFlowFinalNode_2011ChildNodeID(domainElement, semanticHint);
223
		case ForkNodeEditPart.VISUAL_ID:
224
			return getUnrecognizedForkNode_2012ChildNodeID(domainElement, semanticHint);
225
		case JoinNodeEditPart.VISUAL_ID:
226
			return getUnrecognizedJoinNode_2013ChildNodeID(domainElement, semanticHint);
227
		case PinEditPart.VISUAL_ID:
228
			if (PinNameEditPart.VISUAL_ID == nodeVisualID) {
229
				return PinNameEditPart.VISUAL_ID;
230
			}
231
			return getUnrecognizedPin_2014ChildNodeID(domainElement, semanticHint);
232
		case CreateObjectActionEditPart.VISUAL_ID:
233
			if (CreateObjectActionNameEditPart.VISUAL_ID == nodeVisualID) {
234
				return CreateObjectActionNameEditPart.VISUAL_ID;
235
			}
236
			if ((semanticHint == null || OutputPin2EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElementMetaclass)
237
					&& (domainElement == null || isNodeOutputPin_3002((OutputPin) domainElement))) {
238
				return OutputPin2EditPart.VISUAL_ID;
239
			}
240
			return getUnrecognizedCreateObjectAction_2015ChildNodeID(domainElement, semanticHint);
241
		case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
242
			if (AddStructuralFeatureValueActionNameEditPart.VISUAL_ID == nodeVisualID) {
243
				return AddStructuralFeatureValueActionNameEditPart.VISUAL_ID;
244
			}
245
			if ((semanticHint == null || InputPinEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
246
					&& (domainElement == null || isNodeInputPin_3003((InputPin) domainElement))) {
247
				return InputPinEditPart.VISUAL_ID;
248
			}
249
			if ((semanticHint == null || InputPin2EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
250
					&& (domainElement == null || isNodeInputPin_3004((InputPin) domainElement))) {
251
				return InputPin2EditPart.VISUAL_ID;
252
			}
253
			if ((semanticHint == null || InputPin3EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
254
					&& (domainElement == null || isNodeInputPin_3005((InputPin) domainElement))) {
255
				return InputPin3EditPart.VISUAL_ID;
256
			}
257
			return getUnrecognizedAddStructuralFeatureValueAction_2016ChildNodeID(domainElement, semanticHint);
258
		case CallBehaviorActionEditPart.VISUAL_ID:
259
			if (CallBehaviorActionNameEditPart.VISUAL_ID == nodeVisualID) {
260
				return CallBehaviorActionNameEditPart.VISUAL_ID;
261
			}
262
			if ((semanticHint == null || OutputPin3EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElementMetaclass)
263
					&& (domainElement == null || isNodeOutputPin_3006((OutputPin) domainElement))) {
264
				return OutputPin3EditPart.VISUAL_ID;
265
			}
266
			if ((semanticHint == null || InputPin4EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
267
					&& (domainElement == null || isNodeInputPin_3007((InputPin) domainElement))) {
268
				return InputPin4EditPart.VISUAL_ID;
269
			}
270
			return getUnrecognizedCallBehaviorAction_2017ChildNodeID(domainElement, semanticHint);
271
		case CallOperationActionEditPart.VISUAL_ID:
272
			if (CallOperationActionNameEditPart.VISUAL_ID == nodeVisualID) {
273
				return CallOperationActionNameEditPart.VISUAL_ID;
274
			}
275
			if ((semanticHint == null || OutputPin3EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElementMetaclass)
276
					&& (domainElement == null || isNodeOutputPin_3006((OutputPin) domainElement))) {
277
				return OutputPin3EditPart.VISUAL_ID;
278
			}
279
			if ((semanticHint == null || InputPin4EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
280
					&& (domainElement == null || isNodeInputPin_3007((InputPin) domainElement))) {
281
				return InputPin4EditPart.VISUAL_ID;
282
			}
283
			if ((semanticHint == null || InputPin5EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElementMetaclass)
284
					&& (domainElement == null || isNodeInputPin_3008((InputPin) domainElement))) {
285
				return InputPin5EditPart.VISUAL_ID;
286
			}
287
			return getUnrecognizedCallOperationAction_2018ChildNodeID(domainElement, semanticHint);
288
		case OutputPinEditPart.VISUAL_ID:
289
			if (OutputPinNameEditPart.VISUAL_ID == nodeVisualID) {
290
				return OutputPinNameEditPart.VISUAL_ID;
291
			}
292
			return getUnrecognizedOutputPin_3001ChildNodeID(domainElement, semanticHint);
293
		case OutputPin2EditPart.VISUAL_ID:
294
			if (OutputPinName2EditPart.VISUAL_ID == nodeVisualID) {
295
				return OutputPinName2EditPart.VISUAL_ID;
296
			}
297
			return getUnrecognizedOutputPin_3002ChildNodeID(domainElement, semanticHint);
298
		case InputPinEditPart.VISUAL_ID:
299
			if (InputPinNameEditPart.VISUAL_ID == nodeVisualID) {
300
				return InputPinNameEditPart.VISUAL_ID;
301
			}
302
			return getUnrecognizedInputPin_3003ChildNodeID(domainElement, semanticHint);
303
		case InputPin2EditPart.VISUAL_ID:
304
			if (InputPinName2EditPart.VISUAL_ID == nodeVisualID) {
305
				return InputPinName2EditPart.VISUAL_ID;
306
			}
307
			return getUnrecognizedInputPin_3004ChildNodeID(domainElement, semanticHint);
308
		case InputPin3EditPart.VISUAL_ID:
309
			if (InputPinName3EditPart.VISUAL_ID == nodeVisualID) {
310
				return InputPinName3EditPart.VISUAL_ID;
311
			}
312
			return getUnrecognizedInputPin_3005ChildNodeID(domainElement, semanticHint);
313
		case OutputPin3EditPart.VISUAL_ID:
314
			if (OutputPinName3EditPart.VISUAL_ID == nodeVisualID) {
315
				return OutputPinName3EditPart.VISUAL_ID;
316
			}
317
			return getUnrecognizedOutputPin_3006ChildNodeID(domainElement, semanticHint);
318
		case InputPin4EditPart.VISUAL_ID:
319
			if (InputPinName4EditPart.VISUAL_ID == nodeVisualID) {
320
				return InputPinName4EditPart.VISUAL_ID;
321
			}
322
			return getUnrecognizedInputPin_3007ChildNodeID(domainElement, semanticHint);
323
		case InputPin5EditPart.VISUAL_ID:
324
			if (InputPinName5EditPart.VISUAL_ID == nodeVisualID) {
325
				return InputPinName5EditPart.VISUAL_ID;
326
			}
327
			return getUnrecognizedInputPin_3008ChildNodeID(domainElement, semanticHint);
328
		case ActivityEditPart.VISUAL_ID:
329
			if ((semanticHint == null || AcceptEventActionEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getAcceptEventAction().isSuperTypeOf(domainElementMetaclass)
330
					&& (domainElement == null || isNodeAcceptEventAction_2001((AcceptEventAction) domainElement))) {
331
				return AcceptEventActionEditPart.VISUAL_ID;
332
			}
333
			if ((semanticHint == null || AcceptEventAction2EditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getAcceptEventAction().isSuperTypeOf(domainElementMetaclass)
334
					&& (domainElement == null || isNodeAcceptEventAction_2002((AcceptEventAction) domainElement))) {
335
				return AcceptEventAction2EditPart.VISUAL_ID;
336
			}
337
			if ((semanticHint == null || ActivityFinalNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getActivityFinalNode().isSuperTypeOf(domainElementMetaclass)
338
					&& (domainElement == null || isNodeActivityFinalNode_2003((ActivityFinalNode) domainElement))) {
339
				return ActivityFinalNodeEditPart.VISUAL_ID;
340
			}
341
			if ((semanticHint == null || DecisionNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getDecisionNode().isSuperTypeOf(domainElementMetaclass)
342
					&& (domainElement == null || isNodeDecisionNode_2004((DecisionNode) domainElement))) {
343
				return DecisionNodeEditPart.VISUAL_ID;
344
			}
345
			if ((semanticHint == null || MergeNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getMergeNode().isSuperTypeOf(domainElementMetaclass)
346
					&& (domainElement == null || isNodeMergeNode_2005((MergeNode) domainElement))) {
347
				return MergeNodeEditPart.VISUAL_ID;
348
			}
349
			if ((semanticHint == null || InitialNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElementMetaclass)
350
					&& (domainElement == null || isNodeInitialNode_2006((InitialNode) domainElement))) {
351
				return InitialNodeEditPart.VISUAL_ID;
352
			}
353
			if ((semanticHint == null || StructuredActivityNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getStructuredActivityNode().isSuperTypeOf(domainElementMetaclass)
354
					&& (domainElement == null || isNodeStructuredActivityNode_2007((StructuredActivityNode) domainElement))) {
355
				return StructuredActivityNodeEditPart.VISUAL_ID;
356
			}
357
			if ((semanticHint == null || DataStoreNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getDataStoreNode().isSuperTypeOf(domainElementMetaclass)
358
					&& (domainElement == null || isNodeDataStoreNode_2008((DataStoreNode) domainElement))) {
359
				return DataStoreNodeEditPart.VISUAL_ID;
360
			}
361
			if ((semanticHint == null || CentralBufferNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getCentralBufferNode().isSuperTypeOf(domainElementMetaclass)
362
					&& (domainElement == null || isNodeCentralBufferNode_2009((CentralBufferNode) domainElement))) {
363
				return CentralBufferNodeEditPart.VISUAL_ID;
364
			}
365
			if ((semanticHint == null || OpaqueActionEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getOpaqueAction().isSuperTypeOf(domainElementMetaclass)
366
					&& (domainElement == null || isNodeOpaqueAction_2010((OpaqueAction) domainElement))) {
367
				return OpaqueActionEditPart.VISUAL_ID;
368
			}
369
			if ((semanticHint == null || FlowFinalNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getFlowFinalNode().isSuperTypeOf(domainElementMetaclass)
370
					&& (domainElement == null || isNodeFlowFinalNode_2011((FlowFinalNode) domainElement))) {
371
				return FlowFinalNodeEditPart.VISUAL_ID;
372
			}
373
			if ((semanticHint == null || ForkNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getForkNode().isSuperTypeOf(domainElementMetaclass)
374
					&& (domainElement == null || isNodeForkNode_2012((ForkNode) domainElement))) {
375
				return ForkNodeEditPart.VISUAL_ID;
376
			}
377
			if ((semanticHint == null || JoinNodeEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getJoinNode().isSuperTypeOf(domainElementMetaclass)
378
					&& (domainElement == null || isNodeJoinNode_2013((JoinNode) domainElement))) {
379
				return JoinNodeEditPart.VISUAL_ID;
380
			}
381
			if ((semanticHint == null || PinEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getPin().isSuperTypeOf(domainElementMetaclass)
382
					&& (domainElement == null || isNodePin_2014((Pin) domainElement))) {
383
				return PinEditPart.VISUAL_ID;
384
			}
385
			if ((semanticHint == null || CreateObjectActionEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getCreateObjectAction().isSuperTypeOf(domainElementMetaclass)
386
					&& (domainElement == null || isNodeCreateObjectAction_2015((CreateObjectAction) domainElement))) {
387
				return CreateObjectActionEditPart.VISUAL_ID;
388
			}
389
			if ((semanticHint == null || AddStructuralFeatureValueActionEditPart.VISUAL_ID == nodeVisualID)
390
					&& UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction().isSuperTypeOf(domainElementMetaclass)
391
					&& (domainElement == null || isNodeAddStructuralFeatureValueAction_2016((AddStructuralFeatureValueAction) domainElement))) {
392
				return AddStructuralFeatureValueActionEditPart.VISUAL_ID;
393
			}
394
			if ((semanticHint == null || CallBehaviorActionEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getCallBehaviorAction().isSuperTypeOf(domainElementMetaclass)
395
					&& (domainElement == null || isNodeCallBehaviorAction_2017((CallBehaviorAction) domainElement))) {
396
				return CallBehaviorActionEditPart.VISUAL_ID;
397
			}
398
			if ((semanticHint == null || CallOperationActionEditPart.VISUAL_ID == nodeVisualID) && UMLPackage.eINSTANCE.getCallOperationAction().isSuperTypeOf(domainElementMetaclass)
399
					&& (domainElement == null || isNodeCallOperationAction_2018((CallOperationAction) domainElement))) {
400
				return CallOperationActionEditPart.VISUAL_ID;
401
			}
402
			return getUnrecognizedActivity_1000ChildNodeID(domainElement, semanticHint);
403
		}
404
		return -1;
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	public static int getLinkWithClassVisualID(EObject domainElement) {
411
		if (domainElement == null) {
412
			return -1;
413
		}
414
		EClass domainElementMetaclass = domainElement.eClass();
415
		return getLinkWithClassVisualID(domainElement, domainElementMetaclass);
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	public static int getLinkWithClassVisualID(EObject domainElement, EClass domainElementMetaclass) {
422
		if (UMLPackage.eINSTANCE.getControlFlow().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isLinkWithClassControlFlow_4001((ControlFlow) domainElement))) {
423
			return ControlFlowEditPart.VISUAL_ID;
424
		} else if (UMLPackage.eINSTANCE.getObjectFlow().isSuperTypeOf(domainElementMetaclass) && (domainElement == null || isLinkWithClassObjectFlow_4002((ObjectFlow) domainElement))) {
425
			return ObjectFlowEditPart.VISUAL_ID;
426
		} else {
427
			return getUnrecognizedLinkWithClassID(domainElement);
428
		}
429
	}
430
431
	/**
432
	 * User can change implementation of this method to check some additional 
433
	 * conditions here.
434
	 *
435
	 * @generated
436
	 */
437
	private static boolean isDiagramActivity_1000(Activity element) {
438
		return true;
439
	}
440
441
	/**
442
	 * User can change implementation of this method to handle some specific
443
	 * situations not covered by default logic.
444
	 *
445
	 * @generated
446
	 */
447
	private static int getUnrecognizedDiagramID(EObject domainElement) {
448
		return -1;
449
	}
450
451
	/**
452
	 * User can change implementation of this method to check some additional 
453
	 * conditions here.
454
	 *
455
	 * @generated
456
	 */
457
	private static boolean isNodeAcceptEventAction_2001(AcceptEventAction element) {
458
		return AcceptEventAction_2001.matches(element);
459
	}
460
461
	/**
462
	 * User can change implementation of this method to check some additional 
463
	 * conditions here.
464
	 *
465
	 * @generated
466
	 */
467
	private static boolean isNodeAcceptEventAction_2002(AcceptEventAction element) {
468
		return AcceptEventAction_2002.matches(element);
469
	}
470
471
	/**
472
	 * User can change implementation of this method to check some additional 
473
	 * conditions here.
474
	 *
475
	 * @generated
476
	 */
477
	private static boolean isNodeActivityFinalNode_2003(ActivityFinalNode element) {
478
		return true;
479
	}
480
481
	/**
482
	 * User can change implementation of this method to check some additional 
483
	 * conditions here.
484
	 *
485
	 * @generated
486
	 */
487
	private static boolean isNodeDecisionNode_2004(DecisionNode element) {
488
		return true;
489
	}
490
491
	/**
492
	 * User can change implementation of this method to check some additional 
493
	 * conditions here.
494
	 *
495
	 * @generated
496
	 */
497
	private static boolean isNodeMergeNode_2005(MergeNode element) {
498
		return true;
499
	}
500
501
	/**
502
	 * User can change implementation of this method to check some additional 
503
	 * conditions here.
504
	 *
505
	 * @generated
506
	 */
507
	private static boolean isNodeInitialNode_2006(InitialNode element) {
508
		return true;
509
	}
510
511
	/**
512
	 * User can change implementation of this method to check some additional 
513
	 * conditions here.
514
	 *
515
	 * @generated
516
	 */
517
	private static boolean isNodeStructuredActivityNode_2007(StructuredActivityNode element) {
518
		return true;
519
	}
520
521
	/**
522
	 * User can change implementation of this method to check some additional 
523
	 * conditions here.
524
	 *
525
	 * @generated
526
	 */
527
	private static boolean isNodeDataStoreNode_2008(DataStoreNode element) {
528
		return true;
529
	}
530
531
	/**
532
	 * User can change implementation of this method to check some additional 
533
	 * conditions here.
534
	 *
535
	 * @generated
536
	 */
537
	private static boolean isNodeCentralBufferNode_2009(CentralBufferNode element) {
538
		return true;
539
	}
540
541
	/**
542
	 * User can change implementation of this method to check some additional 
543
	 * conditions here.
544
	 *
545
	 * @generated
546
	 */
547
	private static boolean isNodeOpaqueAction_2010(OpaqueAction element) {
548
		return true;
549
	}
550
551
	/**
552
	 * User can change implementation of this method to check some additional 
553
	 * conditions here.
554
	 *
555
	 * @generated
556
	 */
557
	private static boolean isNodeFlowFinalNode_2011(FlowFinalNode element) {
558
		return true;
559
	}
560
561
	/**
562
	 * User can change implementation of this method to check some additional 
563
	 * conditions here.
564
	 *
565
	 * @generated
566
	 */
567
	private static boolean isNodeForkNode_2012(ForkNode element) {
568
		return true;
569
	}
570
571
	/**
572
	 * User can change implementation of this method to check some additional 
573
	 * conditions here.
574
	 *
575
	 * @generated
576
	 */
577
	private static boolean isNodeJoinNode_2013(JoinNode element) {
578
		return true;
579
	}
580
581
	/**
582
	 * User can change implementation of this method to check some additional 
583
	 * conditions here.
584
	 *
585
	 * @generated
586
	 */
587
	private static boolean isNodePin_2014(Pin element) {
588
		return true;
589
	}
590
591
	/**
592
	 * User can change implementation of this method to check some additional 
593
	 * conditions here.
594
	 *
595
	 * @generated
596
	 */
597
	private static boolean isNodeCreateObjectAction_2015(CreateObjectAction element) {
598
		return true;
599
	}
600
601
	/**
602
	 * User can change implementation of this method to check some additional 
603
	 * conditions here.
604
	 *
605
	 * @generated
606
	 */
607
	private static boolean isNodeAddStructuralFeatureValueAction_2016(AddStructuralFeatureValueAction element) {
608
		return true;
609
	}
610
611
	/**
612
	 * User can change implementation of this method to check some additional 
613
	 * conditions here.
614
	 *
615
	 * @generated
616
	 */
617
	private static boolean isNodeCallBehaviorAction_2017(CallBehaviorAction element) {
618
		return true;
619
	}
620
621
	/**
622
	 * User can change implementation of this method to check some additional 
623
	 * conditions here.
624
	 *
625
	 * @generated
626
	 */
627
	private static boolean isNodeCallOperationAction_2018(CallOperationAction element) {
628
		return true;
629
	}
630
631
	/**
632
	 * User can change implementation of this method to check some additional 
633
	 * conditions here.
634
	 *
635
	 * @generated
636
	 */
637
	private static boolean isNodeOutputPin_3001(OutputPin element) {
638
		return true;
639
	}
640
641
	/**
642
	 * User can change implementation of this method to check some additional 
643
	 * conditions here.
644
	 *
645
	 * @generated
646
	 */
647
	private static boolean isNodeOutputPin_3002(OutputPin element) {
648
		return true;
649
	}
650
651
	/**
652
	 * User can change implementation of this method to check some additional 
653
	 * conditions here.
654
	 *
655
	 * @generated
656
	 */
657
	private static boolean isNodeInputPin_3003(InputPin element) {
658
		return true;
659
	}
660
661
	/**
662
	 * User can change implementation of this method to check some additional 
663
	 * conditions here.
664
	 *
665
	 * @generated
666
	 */
667
	private static boolean isNodeInputPin_3004(InputPin element) {
668
		return true;
669
	}
670
671
	/**
672
	 * User can change implementation of this method to check some additional 
673
	 * conditions here.
674
	 *
675
	 * @generated
676
	 */
677
	private static boolean isNodeInputPin_3005(InputPin element) {
678
		return true;
679
	}
680
681
	/**
682
	 * User can change implementation of this method to check some additional 
683
	 * conditions here.
684
	 *
685
	 * @generated
686
	 */
687
	private static boolean isNodeOutputPin_3006(OutputPin element) {
688
		return true;
689
	}
690
691
	/**
692
	 * User can change implementation of this method to check some additional 
693
	 * conditions here.
694
	 *
695
	 * @generated
696
	 */
697
	private static boolean isNodeInputPin_3007(InputPin element) {
698
		return true;
699
	}
700
701
	/**
702
	 * User can change implementation of this method to check some additional 
703
	 * conditions here.
704
	 *
705
	 * @generated
706
	 */
707
	private static boolean isNodeInputPin_3008(InputPin element) {
708
		return true;
709
	}
710
711
	/**
712
	 * User can change implementation of this method to handle some specific
713
	 * situations not covered by default logic.
714
	 *
715
	 * @generated
716
	 */
717
	private static int getUnrecognizedAcceptEventAction_2001ChildNodeID(EObject domainElement, String semanticHint) {
718
		return -1;
719
	}
720
721
	/**
722
	 * User can change implementation of this method to handle some specific
723
	 * situations not covered by default logic.
724
	 *
725
	 * @generated
726
	 */
727
	private static int getUnrecognizedAcceptEventAction_2002ChildNodeID(EObject domainElement, String semanticHint) {
728
		return -1;
729
	}
730
731
	/**
732
	 * User can change implementation of this method to handle some specific
733
	 * situations not covered by default logic.
734
	 *
735
	 * @generated
736
	 */
737
	private static int getUnrecognizedActivityFinalNode_2003ChildNodeID(EObject domainElement, String semanticHint) {
738
		return -1;
739
	}
740
741
	/**
742
	 * User can change implementation of this method to handle some specific
743
	 * situations not covered by default logic.
744
	 *
745
	 * @generated
746
	 */
747
	private static int getUnrecognizedDecisionNode_2004ChildNodeID(EObject domainElement, String semanticHint) {
748
		return -1;
749
	}
750
751
	/**
752
	 * User can change implementation of this method to handle some specific
753
	 * situations not covered by default logic.
754
	 *
755
	 * @generated
756
	 */
757
	private static int getUnrecognizedMergeNode_2005ChildNodeID(EObject domainElement, String semanticHint) {
758
		return -1;
759
	}
760
761
	/**
762
	 * User can change implementation of this method to handle some specific
763
	 * situations not covered by default logic.
764
	 *
765
	 * @generated
766
	 */
767
	private static int getUnrecognizedInitialNode_2006ChildNodeID(EObject domainElement, String semanticHint) {
768
		return -1;
769
	}
770
771
	/**
772
	 * User can change implementation of this method to handle some specific
773
	 * situations not covered by default logic.
774
	 *
775
	 * @generated
776
	 */
777
	private static int getUnrecognizedStructuredActivityNode_2007ChildNodeID(EObject domainElement, String semanticHint) {
778
		return -1;
779
	}
780
781
	/**
782
	 * User can change implementation of this method to handle some specific
783
	 * situations not covered by default logic.
784
	 *
785
	 * @generated
786
	 */
787
	private static int getUnrecognizedDataStoreNode_2008ChildNodeID(EObject domainElement, String semanticHint) {
788
		return -1;
789
	}
790
791
	/**
792
	 * User can change implementation of this method to handle some specific
793
	 * situations not covered by default logic.
794
	 *
795
	 * @generated
796
	 */
797
	private static int getUnrecognizedCentralBufferNode_2009ChildNodeID(EObject domainElement, String semanticHint) {
798
		return -1;
799
	}
800
801
	/**
802
	 * User can change implementation of this method to handle some specific
803
	 * situations not covered by default logic.
804
	 *
805
	 * @generated
806
	 */
807
	private static int getUnrecognizedOpaqueAction_2010ChildNodeID(EObject domainElement, String semanticHint) {
808
		return -1;
809
	}
810
811
	/**
812
	 * User can change implementation of this method to handle some specific
813
	 * situations not covered by default logic.
814
	 *
815
	 * @generated
816
	 */
817
	private static int getUnrecognizedFlowFinalNode_2011ChildNodeID(EObject domainElement, String semanticHint) {
818
		return -1;
819
	}
820
821
	/**
822
	 * User can change implementation of this method to handle some specific
823
	 * situations not covered by default logic.
824
	 *
825
	 * @generated
826
	 */
827
	private static int getUnrecognizedForkNode_2012ChildNodeID(EObject domainElement, String semanticHint) {
828
		return -1;
829
	}
830
831
	/**
832
	 * User can change implementation of this method to handle some specific
833
	 * situations not covered by default logic.
834
	 *
835
	 * @generated
836
	 */
837
	private static int getUnrecognizedJoinNode_2013ChildNodeID(EObject domainElement, String semanticHint) {
838
		return -1;
839
	}
840
841
	/**
842
	 * User can change implementation of this method to handle some specific
843
	 * situations not covered by default logic.
844
	 *
845
	 * @generated
846
	 */
847
	private static int getUnrecognizedPin_2014ChildNodeID(EObject domainElement, String semanticHint) {
848
		return -1;
849
	}
850
851
	/**
852
	 * User can change implementation of this method to handle some specific
853
	 * situations not covered by default logic.
854
	 *
855
	 * @generated
856
	 */
857
	private static int getUnrecognizedCreateObjectAction_2015ChildNodeID(EObject domainElement, String semanticHint) {
858
		return -1;
859
	}
860
861
	/**
862
	 * User can change implementation of this method to handle some specific
863
	 * situations not covered by default logic.
864
	 *
865
	 * @generated
866
	 */
867
	private static int getUnrecognizedAddStructuralFeatureValueAction_2016ChildNodeID(EObject domainElement, String semanticHint) {
868
		return -1;
869
	}
870
871
	/**
872
	 * User can change implementation of this method to handle some specific
873
	 * situations not covered by default logic.
874
	 *
875
	 * @generated
876
	 */
877
	private static int getUnrecognizedCallBehaviorAction_2017ChildNodeID(EObject domainElement, String semanticHint) {
878
		return -1;
879
	}
880
881
	/**
882
	 * User can change implementation of this method to handle some specific
883
	 * situations not covered by default logic.
884
	 *
885
	 * @generated
886
	 */
887
	private static int getUnrecognizedCallOperationAction_2018ChildNodeID(EObject domainElement, String semanticHint) {
888
		return -1;
889
	}
890
891
	/**
892
	 * User can change implementation of this method to handle some specific
893
	 * situations not covered by default logic.
894
	 *
895
	 * @generated
896
	 */
897
	private static int getUnrecognizedOutputPin_3001ChildNodeID(EObject domainElement, String semanticHint) {
898
		return -1;
899
	}
900
901
	/**
902
	 * User can change implementation of this method to handle some specific
903
	 * situations not covered by default logic.
904
	 *
905
	 * @generated
906
	 */
907
	private static int getUnrecognizedOutputPin_3002ChildNodeID(EObject domainElement, String semanticHint) {
908
		return -1;
909
	}
910
911
	/**
912
	 * User can change implementation of this method to handle some specific
913
	 * situations not covered by default logic.
914
	 *
915
	 * @generated
916
	 */
917
	private static int getUnrecognizedInputPin_3003ChildNodeID(EObject domainElement, String semanticHint) {
918
		return -1;
919
	}
920
921
	/**
922
	 * User can change implementation of this method to handle some specific
923
	 * situations not covered by default logic.
924
	 *
925
	 * @generated
926
	 */
927
	private static int getUnrecognizedInputPin_3004ChildNodeID(EObject domainElement, String semanticHint) {
928
		return -1;
929
	}
930
931
	/**
932
	 * User can change implementation of this method to handle some specific
933
	 * situations not covered by default logic.
934
	 *
935
	 * @generated
936
	 */
937
	private static int getUnrecognizedInputPin_3005ChildNodeID(EObject domainElement, String semanticHint) {
938
		return -1;
939
	}
940
941
	/**
942
	 * User can change implementation of this method to handle some specific
943
	 * situations not covered by default logic.
944
	 *
945
	 * @generated
946
	 */
947
	private static int getUnrecognizedOutputPin_3006ChildNodeID(EObject domainElement, String semanticHint) {
948
		return -1;
949
	}
950
951
	/**
952
	 * User can change implementation of this method to handle some specific
953
	 * situations not covered by default logic.
954
	 *
955
	 * @generated
956
	 */
957
	private static int getUnrecognizedInputPin_3007ChildNodeID(EObject domainElement, String semanticHint) {
958
		return -1;
959
	}
960
961
	/**
962
	 * User can change implementation of this method to handle some specific
963
	 * situations not covered by default logic.
964
	 *
965
	 * @generated
966
	 */
967
	private static int getUnrecognizedInputPin_3008ChildNodeID(EObject domainElement, String semanticHint) {
968
		return -1;
969
	}
970
971
	/**
972
	 * User can change implementation of this method to handle some specific
973
	 * situations not covered by default logic.
974
	 *
975
	 * @generated
976
	 */
977
	private static int getUnrecognizedActivity_1000ChildNodeID(EObject domainElement, String semanticHint) {
978
		return -1;
979
	}
980
981
	/**
982
	 * User can change implementation of this method to handle some specific
983
	 * situations not covered by default logic.
984
	 *
985
	 * @generated
986
	 */
987
	private static int getUnrecognizedLinkWithClassID(EObject domainElement) {
988
		return -1;
989
	}
990
991
	/**
992
	 * User can change implementation of this method to check some additional 
993
	 * conditions here.
994
	 *
995
	 * @generated
996
	 */
997
	private static boolean isLinkWithClassControlFlow_4001(ControlFlow element) {
998
		return true;
999
	}
1000
1001
	/**
1002
	 * User can change implementation of this method to check some additional 
1003
	 * conditions here.
1004
	 *
1005
	 * @generated
1006
	 */
1007
	private static boolean isLinkWithClassObjectFlow_4002(ObjectFlow element) {
1008
		return true;
1009
	}
1010
1011
	/**
1012
	 * @generated
1013
	 */
1014
	private static final Matcher AcceptEventAction_2001 = new Matcher(UMLOCLFactory.getExpression("self.trigger->isEmpty() or (not self.trigger->forAll(tr | tr.event.oclIsKindOf(uml::TimeEvent)))", //$NON-NLS-1$
1015
			UMLPackage.eINSTANCE.getAcceptEventAction()));
1016
1017
	/**
1018
	 * @generated
1019
	 */
1020
	private static final Matcher AcceptEventAction_2002 = new Matcher(UMLOCLFactory.getExpression(
1021
			"(not self.trigger->isEmpty()) and (self.trigger->forAll(tr | tr.event.oclIsKindOf(uml::TimeEvent)))", //$NON-NLS-1$
1022
			UMLPackage.eINSTANCE.getAcceptEventAction()));
1023
1024
	/**
1025
	 * @generated	
1026
	 */
1027
	static class Matcher {
1028
1029
		/**
1030
		 * @generated	
1031
		 */
1032
		private UMLAbstractExpression condition;
1033
1034
		/**
1035
		 * @generated	
1036
		 */
1037
		Matcher(UMLAbstractExpression conditionExpression) {
1038
			this.condition = conditionExpression;
1039
		}
1040
1041
		/**
1042
		 * @generated	
1043
		 */
1044
		boolean matches(EObject object) {
1045
			Object result = condition.evaluate(object);
1046
			return result instanceof Boolean && ((Boolean) result).booleanValue();
1047
		}
1048
	}// Matcher
1049
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramEditorPlugin.java (+219 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IPath;
7
import org.eclipse.core.runtime.IStatus;
8
import org.eclipse.core.runtime.Path;
9
import org.eclipse.core.runtime.Status;
10
import org.eclipse.emf.common.notify.AdapterFactory;
11
import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
12
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
13
import org.eclipse.emf.edit.provider.IItemLabelProvider;
14
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
15
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
16
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
17
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
18
import org.eclipse.jface.resource.ImageDescriptor;
19
import org.eclipse.swt.graphics.Image;
20
import org.eclipse.ui.plugin.AbstractUIPlugin;
21
import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
22
import org.osgi.framework.BundleContext;
23
24
/**
25
 * @generated
26
 */
27
public class UMLDiagramEditorPlugin extends AbstractUIPlugin {
28
29
	/**
30
	 * @generated
31
	 */
32
	public static final String ID = "org.eclipse.uml2.diagram.activity"; //$NON-NLS-1$
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
38
39
	/**
40
	 * @generated
41
	 */
42
	private static UMLDiagramEditorPlugin instance;
43
44
	/**
45
	 * @generated
46
	 */
47
	private ComposedAdapterFactory adapterFactory;
48
49
	/**
50
	 * @generated
51
	 */
52
	public UMLDiagramEditorPlugin() {
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	public void start(BundleContext context) throws Exception {
59
		super.start(context);
60
		instance = this;
61
		PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
62
		adapterFactory = createAdapterFactory();
63
	}
64
65
	/**
66
	 * @generated
67
	 */
68
	public void stop(BundleContext context) throws Exception {
69
		adapterFactory.dispose();
70
		adapterFactory = null;
71
		instance = null;
72
		super.stop(context);
73
	}
74
75
	/**
76
	 * @generated
77
	 */
78
	public static UMLDiagramEditorPlugin getInstance() {
79
		return instance;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected ComposedAdapterFactory createAdapterFactory() {
86
		List factories = new ArrayList();
87
		fillItemProviderFactories(factories);
88
		return new ComposedAdapterFactory(factories);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void fillItemProviderFactories(List factories) {
95
		factories.add(new UMLItemProviderAdapterFactory());
96
		factories.add(new EcoreItemProviderAdapterFactory());
97
		factories.add(new ResourceItemProviderAdapterFactory());
98
		factories.add(new ReflectiveItemProviderAdapterFactory());
99
	}
100
101
	/**
102
	 * @generated
103
	 */
104
	public AdapterFactory getItemProvidersAdapterFactory() {
105
		return adapterFactory;
106
	}
107
108
	/**
109
	 * @generated
110
	 */
111
	public ImageDescriptor getItemImageDescriptor(Object item) {
112
		IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
113
		if (labelProvider != null) {
114
			return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
115
		}
116
		return null;
117
	}
118
119
	/**
120
	 * Returns an image descriptor for the image file at the given
121
	 * plug-in relative path.
122
	 *
123
	 * @generated
124
	 * @param path the path
125
	 * @return the image descriptor
126
	 */
127
	public static ImageDescriptor getBundledImageDescriptor(String path) {
128
		return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
129
	}
130
131
	/**
132
	 * Respects images residing in any plug-in. If path is relative,
133
	 * then this bundle is looked up for the image, otherwise, for absolute 
134
	 * path, first segment is taken as id of plug-in with image
135
	 *
136
	 * @generated
137
	 * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
138
	 * @return the image descriptor
139
	 */
140
	public static ImageDescriptor findImageDescriptor(String path) {
141
		final IPath p = new Path(path);
142
		if (p.isAbsolute() && p.segmentCount() > 1) {
143
			return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
144
		} else {
145
			return getBundledImageDescriptor(p.makeAbsolute().toString());
146
		}
147
	}
148
149
	/**
150
	 * Returns an image for the image file at the given plug-in relative path.
151
	 * Client do not need to dispose this image. Images will be disposed automatically.
152
	 *
153
	 * @generated
154
	 * @param path the path
155
	 * @return image instance
156
	 */
157
	public Image getBundledImage(String path) {
158
		Image image = getImageRegistry().get(path);
159
		if (image == null) {
160
			getImageRegistry().put(path, getBundledImageDescriptor(path));
161
			image = getImageRegistry().get(path);
162
		}
163
		return image;
164
	}
165
166
	/**
167
	 * @generated
168
	 */
169
	public void logError(String error) {
170
		logError(error, null);
171
	}
172
173
	/**
174
	 * @param throwable actual error or null could be passed
175
	 * @generated
176
	 */
177
	public void logError(String error, Throwable throwable) {
178
		if (error == null && throwable != null) {
179
			error = throwable.getMessage();
180
		}
181
		getLog().log(new Status(IStatus.ERROR, UMLDiagramEditorPlugin.ID, IStatus.OK, error, throwable));
182
		debug(error, throwable);
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	public void logInfo(String message) {
189
		logInfo(message, null);
190
	}
191
192
	/**
193
	 * @param throwable actual error or null could be passed
194
	 * @generated
195
	 */
196
	public void logInfo(String message, Throwable throwable) {
197
		if (message == null && throwable != null) {
198
			message = throwable.getMessage();
199
		}
200
		getLog().log(new Status(IStatus.INFO, UMLDiagramEditorPlugin.ID, IStatus.OK, message, throwable));
201
		debug(message, throwable);
202
	}
203
204
	/**
205
	 * @generated
206
	 */
207
	private void debug(String message, Throwable throwable) {
208
		if (!isDebugging()) {
209
			return;
210
		}
211
		if (message != null) {
212
			System.err.println(message);
213
		}
214
		if (throwable != null) {
215
			throwable.printStackTrace();
216
		}
217
	}
218
219
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLCreationWizard.java (+129 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.lang.reflect.InvocationTargetException;
4
5
import org.eclipse.core.resources.IFile;
6
import org.eclipse.core.runtime.CoreException;
7
import org.eclipse.core.runtime.IProgressMonitor;
8
import org.eclipse.emf.common.util.URI;
9
import org.eclipse.jface.dialogs.ErrorDialog;
10
import org.eclipse.jface.operation.IRunnableWithProgress;
11
import org.eclipse.jface.viewers.IStructuredSelection;
12
import org.eclipse.jface.wizard.Wizard;
13
import org.eclipse.ui.INewWizard;
14
import org.eclipse.ui.IWorkbench;
15
import org.eclipse.ui.actions.WorkspaceModifyOperation;
16
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
17
18
/**
19
 * @generated
20
 */
21
public class UMLCreationWizard extends Wizard implements INewWizard {
22
23
	/**
24
	 * @generated
25
	 */
26
	private IWorkbench workbench;
27
28
	/**
29
	 * @generated
30
	 */
31
	protected IStructuredSelection selection;
32
33
	/**
34
	 * @generated
35
	 */
36
	protected UMLCreationWizardPage page;
37
38
	/**
39
	 * @generated
40
	 */
41
	protected URI diagramURI;
42
43
	/**
44
	 * @generated
45
	 */
46
	private boolean openNewlyCreatedDiagramEditor = true;
47
48
	/**
49
	 * @generated
50
	 */
51
	public IWorkbench getWorkbench() {
52
		return workbench;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	public IStructuredSelection getSelection() {
59
		return selection;
60
	}
61
62
	/**
63
	 * @generated
64
	 */
65
	public final URI getDiagramURI() {
66
		return diagramURI;
67
	}
68
69
	/**
70
	 * @generated
71
	 */
72
	public final boolean isOpenNewlyCreatedDiagramEditor() {
73
		return openNewlyCreatedDiagramEditor;
74
	}
75
76
	/**
77
	 * @generated
78
	 */
79
	public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
80
		this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
81
	}
82
83
	/**
84
	 * @generated
85
	 */
86
	public void init(IWorkbench workbench, IStructuredSelection selection) {
87
		this.workbench = workbench;
88
		this.selection = selection;
89
		setWindowTitle("New UMLActivity Diagram");
90
		setDefaultPageImageDescriptor(UMLDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewUMLWizard.gif")); //$NON-NLS-1$
91
		setNeedsProgressMonitor(true);
92
	}
93
94
	/**
95
	 * @generated
96
	 */
97
	public void addPages() {
98
		page = new UMLCreationWizardPage("CreationWizardPage", getSelection()); //$NON-NLS-1$
99
		page.setTitle("Create UMLActivity Diagram");
100
		page.setDescription("Create a new UMLActivity diagram.");
101
		addPage(page);
102
	}
103
104
	/**
105
	 * @generated
106
	 */
107
	public boolean performFinish() {
108
		IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
109
110
			protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
111
				diagramURI = UMLDiagramEditorUtil.createAndOpenDiagram(page.getContainerFullPath(), page.getFileName(), getWorkbench().getActiveWorkbenchWindow(), monitor,
112
						isOpenNewlyCreatedDiagramEditor(), true);
113
			}
114
		};
115
		try {
116
			getContainer().run(false, true, op);
117
		} catch (InterruptedException e) {
118
			return false;
119
		} catch (InvocationTargetException e) {
120
			if (e.getTargetException() instanceof CoreException) {
121
				ErrorDialog.openError(getContainer().getShell(), "Creation Problems", null, ((CoreException) e.getTargetException()).getStatus());
122
			} else {
123
				UMLDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
124
			}
125
			return false;
126
		}
127
		return diagramURI != null;
128
	}
129
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/AcceptEventActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class AcceptEventActionEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/OutputPin3ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class OutputPin3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/ObjectFlowViewFactory.java (+47 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class ObjectFlowViewFactory extends ConnectionViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createRoutingStyle());
26
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
27
		return styles;
28
	}
29
30
	/**
31
	 * @generated
32
	 */
33
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
34
		if (semanticHint == null) {
35
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart.VISUAL_ID);
36
			view.setType(semanticHint);
37
		}
38
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
39
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
40
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
41
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
42
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
43
			view.getEAnnotations().add(shortcutAnnotation);
44
		}
45
	}
46
47
}
(-)src/org/eclipse/uml2/diagram/activity/sheet/UMLSheetLabelProvider.java (+78 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.sheet;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gmf.runtime.notation.View;
7
import org.eclipse.jface.viewers.DecoratingLabelProvider;
8
import org.eclipse.jface.viewers.IStructuredSelection;
9
import org.eclipse.swt.graphics.Image;
10
import org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorGroup;
11
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
12
13
/**
14
 * @generated
15
 */
16
public class UMLSheetLabelProvider extends DecoratingLabelProvider {
17
18
	/**
19
	 * @generated
20
	 */
21
	public UMLSheetLabelProvider() {
22
		super(new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()), null);
23
	}
24
25
	/**
26
	 * @generated
27
	 */
28
	public String getText(Object element) {
29
		Object selected = unwrap(element);
30
		if (selected instanceof UMLNavigatorGroup) {
31
			return ((UMLNavigatorGroup) selected).getGroupName();
32
		}
33
		return super.getText(selected);
34
	}
35
36
	/**
37
	 * @generated
38
	 */
39
	public Image getImage(Object element) {
40
		return super.getImage(unwrap(element));
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	private Object unwrap(Object element) {
47
		if (element instanceof IStructuredSelection) {
48
			return unwrap(((IStructuredSelection) element).getFirstElement());
49
		}
50
		if (element instanceof EditPart) {
51
			return unwrapEditPart((EditPart) element);
52
		}
53
		if (element instanceof IAdaptable) {
54
			View view = (View) ((IAdaptable) element).getAdapter(View.class);
55
			if (view != null) {
56
				return unwrapView(view);
57
			}
58
		}
59
		return element;
60
	}
61
62
	/**
63
	 * @generated
64
	 */
65
	private Object unwrapEditPart(EditPart p) {
66
		if (p.getModel() instanceof View) {
67
			return unwrapView((View) p.getModel());
68
		}
69
		return p.getModel();
70
	}
71
72
	/**
73
	 * @generated
74
	 */
75
	private Object unwrapView(View view) {
76
		return view.getElement() == null ? view : view.getElement();
77
	}
78
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CallOperationActionViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class CallOperationActionViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(CallOperationActionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinName5EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class InputPinName5EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5013;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(InputPinName5EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public InputPinName5EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.InputPin_3008;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/JoinNodeEditPart.java (+206 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
13
import org.eclipse.gef.requests.CreateRequest;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
16
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
17
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
18
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.uml2.diagram.activity.edit.policies.JoinNodeItemSemanticEditPolicy;
21
22
/**
23
 * @generated
24
 */
25
public class JoinNodeEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2013;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public JoinNodeEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new JoinNodeItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		VerticalForkJoinFigure figure = new VerticalForkJoinFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public VerticalForkJoinFigure getPrimaryShape() {
96
		return (VerticalForkJoinFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected NodeFigure createNodePlate() {
103
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50));
104
		return result;
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	public EditPolicy getPrimaryDragEditPolicy() {
111
		EditPolicy result = super.getPrimaryDragEditPolicy();
112
		if (result instanceof ResizableEditPolicy) {
113
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
114
115
			ep.setResizeDirections(PositionConstants.NORTH | PositionConstants.SOUTH);
116
117
		}
118
		return result;
119
	}
120
121
	/**
122
	 * Creates figure for this edit part.
123
	 * 
124
	 * Body of this method does not depend on settings in generation model
125
	 * so you may safely remove <i>generated</i> tag and modify it.
126
	 * 
127
	 * @generated
128
	 */
129
	protected NodeFigure createNodeFigure() {
130
		NodeFigure figure = createNodePlate();
131
		figure.setLayoutManager(new StackLayout());
132
		IFigure shape = createNodeShape();
133
		figure.add(shape);
134
		contentPane = setupContentPane(shape);
135
		return figure;
136
	}
137
138
	/**
139
	 * Default implementation treats passed figure as content pane.
140
	 * Respects layout one may have set for generated figure.
141
	 * @param nodeShape instance of generated figure class
142
	 * @generated
143
	 */
144
	protected IFigure setupContentPane(IFigure nodeShape) {
145
		if (nodeShape.getLayoutManager() == null) {
146
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
147
			layout.setSpacing(getMapMode().DPtoLP(5));
148
			nodeShape.setLayoutManager(layout);
149
		}
150
		return nodeShape; // use nodeShape itself as contentPane
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	public IFigure getContentPane() {
157
		if (contentPane != null) {
158
			return contentPane;
159
		}
160
		return super.getContentPane();
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public class VerticalForkJoinFigure extends org.eclipse.draw2d.RectangleFigure {
167
168
		/**
169
		 * @generated
170
		 */
171
		public VerticalForkJoinFigure() {
172
173
			this.setBackgroundColor(org.eclipse.draw2d.ColorConstants.black);
174
			this.setPreferredSize(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50));
175
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(4), getMapMode().DPtoLP(50)));
176
			createContents();
177
		}
178
179
		/**
180
		 * @generated
181
		 */
182
		private void createContents() {
183
		}
184
185
		/**
186
		 * @generated
187
		 */
188
		private boolean myUseLocalCoordinates = false;
189
190
		/**
191
		 * @generated
192
		 */
193
		protected boolean useLocalCoordinates() {
194
			return myUseLocalCoordinates;
195
		}
196
197
		/**
198
		 * @generated
199
		 */
200
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
201
			myUseLocalCoordinates = useLocalCoordinates;
202
		}
203
204
	}
205
206
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPin2EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.OutputPin2ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class OutputPin2EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3002;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public OutputPin2EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPin2ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return OutputPin2EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(OutputPinName2EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof OutputPinName2EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLInitDiagramFileAction.java (+98 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.core.resources.IFile;
4
import org.eclipse.emf.common.util.URI;
5
import org.eclipse.emf.common.util.WrappedException;
6
import org.eclipse.emf.ecore.EObject;
7
import org.eclipse.emf.ecore.resource.Resource;
8
import org.eclipse.emf.ecore.resource.ResourceSet;
9
import org.eclipse.emf.transaction.TransactionalEditingDomain;
10
import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
11
import org.eclipse.jface.action.IAction;
12
import org.eclipse.jface.dialogs.IDialogSettings;
13
import org.eclipse.jface.dialogs.MessageDialog;
14
import org.eclipse.jface.viewers.ISelection;
15
import org.eclipse.jface.viewers.IStructuredSelection;
16
import org.eclipse.jface.viewers.StructuredSelection;
17
import org.eclipse.jface.wizard.Wizard;
18
import org.eclipse.jface.wizard.WizardDialog;
19
import org.eclipse.ui.IObjectActionDelegate;
20
import org.eclipse.ui.IWorkbenchPart;
21
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
22
23
/**
24
 * @generated
25
 */
26
public class UMLInitDiagramFileAction implements IObjectActionDelegate {
27
28
	/**
29
	 * @generated
30
	 */
31
	private IWorkbenchPart myPart;
32
33
	/**
34
	 * @generated
35
	 */
36
	private IFile mySelectedModelFile;
37
38
	/**
39
	 * @generated
40
	 */
41
	private IStructuredSelection mySelection;
42
43
	/**
44
	 * @generated
45
	 */
46
	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
47
		myPart = targetPart;
48
	}
49
50
	/**
51
	 * @generated
52
	 */
53
	public void selectionChanged(IAction action, ISelection selection) {
54
		mySelectedModelFile = null;
55
		mySelection = StructuredSelection.EMPTY;
56
		action.setEnabled(false);
57
		if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
58
			return;
59
		}
60
		mySelection = (IStructuredSelection) selection;
61
		mySelectedModelFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
62
		action.setEnabled(true);
63
	}
64
65
	/**
66
	 * @generated
67
	 */
68
	public void run(IAction action) {
69
		TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
70
		ResourceSet resourceSet = editingDomain.getResourceSet();
71
		EObject diagramRoot = null;
72
		try {
73
			Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);
74
			diagramRoot = (EObject) resource.getContents().get(0);
75
		} catch (WrappedException ex) {
76
			UMLDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + mySelectedModelFile.getFullPath().toString(), ex); //$NON-NLS-1$
77
		}
78
		if (diagramRoot == null) {
79
			MessageDialog.openError(myPart.getSite().getShell(), "Error", "Model file loading failed");
80
			return;
81
		}
82
		Wizard wizard = new UMLNewDiagramFileWizard(mySelectedModelFile, myPart.getSite().getPage(), mySelection, diagramRoot, editingDomain);
83
		IDialogSettings pluginDialogSettings = UMLDiagramEditorPlugin.getInstance().getDialogSettings();
84
		IDialogSettings initDiagramFileSettings = pluginDialogSettings.getSection("InisDiagramFile"); //$NON-NLS-1$
85
		if (initDiagramFileSettings == null) {
86
			initDiagramFileSettings = pluginDialogSettings.addNewSection("InisDiagramFile"); //$NON-NLS-1$
87
		}
88
		wizard.setDialogSettings(initDiagramFileSettings);
89
		wizard.setForcePreviousAndNextButtons(false);
90
		wizard.setWindowTitle("Initialize new " + ActivityEditPart.MODEL_ID + " diagram file");
91
92
		WizardDialog dialog = new WizardDialog(myPart.getSite().getShell(), wizard);
93
		dialog.create();
94
		dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
95
		dialog.open();
96
	}
97
98
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLEditPartProvider.java (+141 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.lang.ref.WeakReference;
4
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPartFactory;
7
import org.eclipse.gmf.runtime.common.core.service.IOperation;
8
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
9
import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;
10
import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
11
import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.UMLEditPartFactory;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class UMLEditPartProvider extends AbstractEditPartProvider {
21
22
	/**
23
	 * @generated
24
	 */
25
	private EditPartFactory factory;
26
27
	/**
28
	 * @generated
29
	 */
30
	private boolean allowCaching;
31
32
	/**
33
	 * @generated
34
	 */
35
	private WeakReference cachedPart;
36
37
	/**
38
	 * @generated
39
	 */
40
	private WeakReference cachedView;
41
42
	/**
43
	 * @generated
44
	 */
45
	public UMLEditPartProvider() {
46
		setFactory(new UMLEditPartFactory());
47
		setAllowCaching(true);
48
	}
49
50
	/**
51
	 * @generated
52
	 */
53
	public final EditPartFactory getFactory() {
54
		return factory;
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected void setFactory(EditPartFactory factory) {
61
		this.factory = factory;
62
	}
63
64
	/**
65
	 * @generated
66
	 */
67
	public final boolean isAllowCaching() {
68
		return allowCaching;
69
	}
70
71
	/**
72
	 * @generated
73
	 */
74
	protected synchronized void setAllowCaching(boolean allowCaching) {
75
		this.allowCaching = allowCaching;
76
		if (!allowCaching) {
77
			cachedPart = null;
78
			cachedView = null;
79
		}
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IGraphicalEditPart createEditPart(View view) {
86
		EditPart part = factory.createEditPart(null, view);
87
		if (part instanceof IGraphicalEditPart) {
88
			return (IGraphicalEditPart) part;
89
		}
90
		return null;
91
	}
92
93
	/**
94
	 * @generated
95
	 */
96
	protected IGraphicalEditPart getCachedPart(View view) {
97
		if (cachedView != null && cachedView.get() == view) {
98
			return (IGraphicalEditPart) cachedPart.get();
99
		}
100
		return null;
101
	}
102
103
	/**
104
	 * @generated
105
	 */
106
	public synchronized IGraphicalEditPart createGraphicEditPart(View view) {
107
		if (isAllowCaching()) {
108
			IGraphicalEditPart part = getCachedPart(view);
109
			cachedPart = null;
110
			cachedView = null;
111
			if (part != null) {
112
				return part;
113
			}
114
		}
115
		return createEditPart(view);
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	public synchronized boolean provides(IOperation operation) {
122
		if (operation instanceof CreateGraphicEditPartOperation) {
123
			View view = ((IEditPartOperation) operation).getView();
124
			if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(view))) {
125
				return false;
126
			}
127
			if (isAllowCaching() && getCachedPart(view) != null) {
128
				return true;
129
			}
130
			IGraphicalEditPart part = createEditPart(view);
131
			if (part != null) {
132
				if (isAllowCaching()) {
133
					cachedPart = new WeakReference(part);
134
					cachedView = new WeakReference(view);
135
				}
136
				return true;
137
			}
138
		}
139
		return false;
140
	}
141
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/DecisionNodeEditPart.java (+252 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.DecisionNodeItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class DecisionNodeEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2004;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public DecisionNodeEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DecisionNodeItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		ScalableRhombFigure figure = new ScalableRhombFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public ScalableRhombFigure getPrimaryShape() {
94
		return (ScalableRhombFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(20), getMapMode().DPtoLP(40));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class ScalableRhombFigure extends org.eclipse.draw2d.Shape {
151
152
		/**
153
		 * @generated
154
		 */
155
		private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
156
157
		/**
158
		 * @generated
159
		 */
160
		private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
161
162
		/**
163
		 * @generated
164
		 */
165
		public void addPoint(org.eclipse.draw2d.geometry.Point point) {
166
			myTemplate.addPoint(point);
167
			myTemplateBounds = null;
168
		}
169
170
		/**
171
		 * @generated
172
		 */
173
		protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
174
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
175
			graphics.pushState();
176
			graphics.translate(bounds.x, bounds.y);
177
			graphics.fillPolygon(scalePointList());
178
			graphics.popState();
179
		}
180
181
		/**
182
		 * @generated
183
		 */
184
		protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
185
			org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
186
			graphics.pushState();
187
			graphics.translate(bounds.x, bounds.y);
188
			graphics.drawPolygon(scalePointList());
189
			graphics.popState();
190
		}
191
192
		/**
193
		 * @generated
194
		 */
195
		private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds() {
196
			if (myTemplateBounds == null) {
197
				myTemplateBounds = new org.eclipse.draw2d.geometry.Rectangle();
198
				myTemplateBounds = myTemplate.getBounds().union(0, 0);
199
				//just safety -- we are going to use this as divider 
200
				if (myTemplateBounds.width < 1) {
201
					myTemplateBounds.width = 1;
202
				}
203
				if (myTemplateBounds.height < 1) {
204
					myTemplateBounds.height = 1;
205
				}
206
			}
207
			return myTemplateBounds;
208
		}
209
210
		/**
211
		 * @generated
212
		 */
213
		private int[] scalePointList() {
214
			org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
215
			org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
216
217
			float xScale = ((float) actualBounds.width) / pointsBounds.width;
218
			float yScale = ((float) actualBounds.height) / pointsBounds.height;
219
220
			if (xScale == 1 && yScale == 1) {
221
				return myTemplate.toIntArray();
222
			}
223
			int[] scaled = (int[]) myTemplate.toIntArray().clone();
224
			for (int i = 0; i < scaled.length; i += 2) {
225
				scaled[i] = (int) Math.floor(scaled[i] * xScale);
226
				scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
227
			}
228
			return scaled;
229
		}
230
231
		/**
232
		 * @generated
233
		 */
234
		public ScalableRhombFigure() {
235
236
			this.setFill(true);
237
			this.addPoint(new org.eclipse.draw2d.geometry.Point(20, 0));
238
			this.addPoint(new org.eclipse.draw2d.geometry.Point(40, 20));
239
			this.addPoint(new org.eclipse.draw2d.geometry.Point(20, 40));
240
			this.addPoint(new org.eclipse.draw2d.geometry.Point(0, 20));
241
			createContents();
242
		}
243
244
		/**
245
		 * @generated
246
		 */
247
		private void createContents() {
248
		}
249
250
	}
251
252
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLViewProvider.java (+253 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
7
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
8
import org.eclipse.gmf.runtime.notation.View;
9
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart;
10
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart;
13
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
16
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart;
17
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
18
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart;
19
import org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart;
20
import org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart;
21
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
22
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart;
23
import org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart;
24
import org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart;
25
import org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart;
26
import org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart;
27
import org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart;
28
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
29
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
30
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
31
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
32
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
33
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart;
34
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart;
35
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart;
36
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart;
37
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart;
38
import org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart;
39
import org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart;
40
import org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart;
41
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
42
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart;
43
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
44
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
45
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
46
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart;
47
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart;
48
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart;
49
import org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart;
50
import org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart;
51
import org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart;
52
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
53
import org.eclipse.uml2.diagram.activity.view.factories.AcceptEventAction2ViewFactory;
54
import org.eclipse.uml2.diagram.activity.view.factories.AcceptEventActionViewFactory;
55
import org.eclipse.uml2.diagram.activity.view.factories.ActivityFinalNodeViewFactory;
56
import org.eclipse.uml2.diagram.activity.view.factories.ActivityViewFactory;
57
import org.eclipse.uml2.diagram.activity.view.factories.AddStructuralFeatureValueActionNameViewFactory;
58
import org.eclipse.uml2.diagram.activity.view.factories.AddStructuralFeatureValueActionViewFactory;
59
import org.eclipse.uml2.diagram.activity.view.factories.CallBehaviorActionNameViewFactory;
60
import org.eclipse.uml2.diagram.activity.view.factories.CallBehaviorActionViewFactory;
61
import org.eclipse.uml2.diagram.activity.view.factories.CallOperationActionNameViewFactory;
62
import org.eclipse.uml2.diagram.activity.view.factories.CallOperationActionViewFactory;
63
import org.eclipse.uml2.diagram.activity.view.factories.CentralBufferNodeViewFactory;
64
import org.eclipse.uml2.diagram.activity.view.factories.ControlFlowViewFactory;
65
import org.eclipse.uml2.diagram.activity.view.factories.CreateObjectActionNameViewFactory;
66
import org.eclipse.uml2.diagram.activity.view.factories.CreateObjectActionViewFactory;
67
import org.eclipse.uml2.diagram.activity.view.factories.DataStoreNodeViewFactory;
68
import org.eclipse.uml2.diagram.activity.view.factories.DecisionNodeViewFactory;
69
import org.eclipse.uml2.diagram.activity.view.factories.FlowFinalNodeViewFactory;
70
import org.eclipse.uml2.diagram.activity.view.factories.ForkNodeViewFactory;
71
import org.eclipse.uml2.diagram.activity.view.factories.InitialNodeViewFactory;
72
import org.eclipse.uml2.diagram.activity.view.factories.InputPin2ViewFactory;
73
import org.eclipse.uml2.diagram.activity.view.factories.InputPin3ViewFactory;
74
import org.eclipse.uml2.diagram.activity.view.factories.InputPin4ViewFactory;
75
import org.eclipse.uml2.diagram.activity.view.factories.InputPin5ViewFactory;
76
import org.eclipse.uml2.diagram.activity.view.factories.InputPinName2ViewFactory;
77
import org.eclipse.uml2.diagram.activity.view.factories.InputPinName3ViewFactory;
78
import org.eclipse.uml2.diagram.activity.view.factories.InputPinName4ViewFactory;
79
import org.eclipse.uml2.diagram.activity.view.factories.InputPinName5ViewFactory;
80
import org.eclipse.uml2.diagram.activity.view.factories.InputPinNameViewFactory;
81
import org.eclipse.uml2.diagram.activity.view.factories.InputPinViewFactory;
82
import org.eclipse.uml2.diagram.activity.view.factories.JoinNodeViewFactory;
83
import org.eclipse.uml2.diagram.activity.view.factories.MergeNodeViewFactory;
84
import org.eclipse.uml2.diagram.activity.view.factories.ObjectFlowViewFactory;
85
import org.eclipse.uml2.diagram.activity.view.factories.OpaqueActionNameViewFactory;
86
import org.eclipse.uml2.diagram.activity.view.factories.OpaqueActionViewFactory;
87
import org.eclipse.uml2.diagram.activity.view.factories.OutputPin2ViewFactory;
88
import org.eclipse.uml2.diagram.activity.view.factories.OutputPin3ViewFactory;
89
import org.eclipse.uml2.diagram.activity.view.factories.OutputPinName2ViewFactory;
90
import org.eclipse.uml2.diagram.activity.view.factories.OutputPinName3ViewFactory;
91
import org.eclipse.uml2.diagram.activity.view.factories.OutputPinNameViewFactory;
92
import org.eclipse.uml2.diagram.activity.view.factories.OutputPinViewFactory;
93
import org.eclipse.uml2.diagram.activity.view.factories.PinNameViewFactory;
94
import org.eclipse.uml2.diagram.activity.view.factories.PinViewFactory;
95
import org.eclipse.uml2.diagram.activity.view.factories.StructuredActivityNodeViewFactory;
96
97
/**
98
 * @generated
99
 */
100
public class UMLViewProvider extends AbstractViewProvider {
101
102
	/**
103
	 * @generated
104
	 */
105
	protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
106
		EObject semanticElement = getSemanticElement(semanticAdapter);
107
		if (ActivityEditPart.MODEL_ID.equals(diagramKind) && UMLVisualIDRegistry.getDiagramVisualID(semanticElement) != -1) {
108
			return ActivityViewFactory.class;
109
		}
110
		return null;
111
	}
112
113
	/**
114
	 * @generated
115
	 */
116
	protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
117
		if (containerView == null) {
118
			return null;
119
		}
120
		IElementType elementType = getSemanticElementType(semanticAdapter);
121
		if (elementType != null && !UMLElementTypes.isKnownElementType(elementType)) {
122
			return null;
123
		}
124
		EClass semanticType = getSemanticEClass(semanticAdapter);
125
		EObject semanticElement = getSemanticElement(semanticAdapter);
126
		int nodeVID = UMLVisualIDRegistry.getNodeVisualID(containerView, semanticElement, semanticType, semanticHint);
127
		switch (nodeVID) {
128
		case AcceptEventActionEditPart.VISUAL_ID:
129
			return AcceptEventActionViewFactory.class;
130
		case AcceptEventAction2EditPart.VISUAL_ID:
131
			return AcceptEventAction2ViewFactory.class;
132
		case ActivityFinalNodeEditPart.VISUAL_ID:
133
			return ActivityFinalNodeViewFactory.class;
134
		case DecisionNodeEditPart.VISUAL_ID:
135
			return DecisionNodeViewFactory.class;
136
		case MergeNodeEditPart.VISUAL_ID:
137
			return MergeNodeViewFactory.class;
138
		case InitialNodeEditPart.VISUAL_ID:
139
			return InitialNodeViewFactory.class;
140
		case StructuredActivityNodeEditPart.VISUAL_ID:
141
			return StructuredActivityNodeViewFactory.class;
142
		case DataStoreNodeEditPart.VISUAL_ID:
143
			return DataStoreNodeViewFactory.class;
144
		case CentralBufferNodeEditPart.VISUAL_ID:
145
			return CentralBufferNodeViewFactory.class;
146
		case OpaqueActionEditPart.VISUAL_ID:
147
			return OpaqueActionViewFactory.class;
148
		case OpaqueActionNameEditPart.VISUAL_ID:
149
			return OpaqueActionNameViewFactory.class;
150
		case FlowFinalNodeEditPart.VISUAL_ID:
151
			return FlowFinalNodeViewFactory.class;
152
		case ForkNodeEditPart.VISUAL_ID:
153
			return ForkNodeViewFactory.class;
154
		case JoinNodeEditPart.VISUAL_ID:
155
			return JoinNodeViewFactory.class;
156
		case PinEditPart.VISUAL_ID:
157
			return PinViewFactory.class;
158
		case PinNameEditPart.VISUAL_ID:
159
			return PinNameViewFactory.class;
160
		case CreateObjectActionEditPart.VISUAL_ID:
161
			return CreateObjectActionViewFactory.class;
162
		case CreateObjectActionNameEditPart.VISUAL_ID:
163
			return CreateObjectActionNameViewFactory.class;
164
		case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
165
			return AddStructuralFeatureValueActionViewFactory.class;
166
		case AddStructuralFeatureValueActionNameEditPart.VISUAL_ID:
167
			return AddStructuralFeatureValueActionNameViewFactory.class;
168
		case CallBehaviorActionEditPart.VISUAL_ID:
169
			return CallBehaviorActionViewFactory.class;
170
		case CallBehaviorActionNameEditPart.VISUAL_ID:
171
			return CallBehaviorActionNameViewFactory.class;
172
		case CallOperationActionEditPart.VISUAL_ID:
173
			return CallOperationActionViewFactory.class;
174
		case CallOperationActionNameEditPart.VISUAL_ID:
175
			return CallOperationActionNameViewFactory.class;
176
		case OutputPinEditPart.VISUAL_ID:
177
			return OutputPinViewFactory.class;
178
		case OutputPinNameEditPart.VISUAL_ID:
179
			return OutputPinNameViewFactory.class;
180
		case OutputPin2EditPart.VISUAL_ID:
181
			return OutputPin2ViewFactory.class;
182
		case OutputPinName2EditPart.VISUAL_ID:
183
			return OutputPinName2ViewFactory.class;
184
		case InputPinEditPart.VISUAL_ID:
185
			return InputPinViewFactory.class;
186
		case InputPinNameEditPart.VISUAL_ID:
187
			return InputPinNameViewFactory.class;
188
		case InputPin2EditPart.VISUAL_ID:
189
			return InputPin2ViewFactory.class;
190
		case InputPinName2EditPart.VISUAL_ID:
191
			return InputPinName2ViewFactory.class;
192
		case InputPin3EditPart.VISUAL_ID:
193
			return InputPin3ViewFactory.class;
194
		case InputPinName3EditPart.VISUAL_ID:
195
			return InputPinName3ViewFactory.class;
196
		case OutputPin3EditPart.VISUAL_ID:
197
			return OutputPin3ViewFactory.class;
198
		case OutputPinName3EditPart.VISUAL_ID:
199
			return OutputPinName3ViewFactory.class;
200
		case InputPin4EditPart.VISUAL_ID:
201
			return InputPin4ViewFactory.class;
202
		case InputPinName4EditPart.VISUAL_ID:
203
			return InputPinName4ViewFactory.class;
204
		case InputPin5EditPart.VISUAL_ID:
205
			return InputPin5ViewFactory.class;
206
		case InputPinName5EditPart.VISUAL_ID:
207
			return InputPinName5ViewFactory.class;
208
		}
209
		return null;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
216
		IElementType elementType = getSemanticElementType(semanticAdapter);
217
		if (elementType != null && !UMLElementTypes.isKnownElementType(elementType)) {
218
			return null;
219
		}
220
		EClass semanticType = getSemanticEClass(semanticAdapter);
221
		if (semanticType == null) {
222
			return null;
223
		}
224
		EObject semanticElement = getSemanticElement(semanticAdapter);
225
		int linkVID = UMLVisualIDRegistry.getLinkWithClassVisualID(semanticElement, semanticType);
226
		switch (linkVID) {
227
		case ControlFlowEditPart.VISUAL_ID:
228
			return ControlFlowViewFactory.class;
229
		case ObjectFlowEditPart.VISUAL_ID:
230
			return ObjectFlowViewFactory.class;
231
		}
232
		return getUnrecognizedConnectorViewClass(semanticAdapter, containerView, semanticHint);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
239
		if (semanticAdapter == null) {
240
			return null;
241
		}
242
		return (IElementType) semanticAdapter.getAdapter(IElementType.class);
243
	}
244
245
	/**
246
	 * @generated
247
	 */
248
	private Class getUnrecognizedConnectorViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
249
		// Handle unrecognized child node classes here
250
		return null;
251
	}
252
253
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/AcceptEventAction2ViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class AcceptEventAction2ViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CallBehaviorActionCanonicalEditPolicy.java (+61 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Iterator;
4
import java.util.LinkedList;
5
import java.util.List;
6
7
import org.eclipse.emf.ecore.EObject;
8
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
9
import org.eclipse.gmf.runtime.notation.View;
10
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
12
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
13
import org.eclipse.uml2.uml.CallAction;
14
import org.eclipse.uml2.uml.InvocationAction;
15
16
/**
17
 * @generated
18
 */
19
public class CallBehaviorActionCanonicalEditPolicy extends CanonicalEditPolicy {
20
21
	/**
22
	 * @generated
23
	 */
24
	protected List getSemanticChildrenList() {
25
		List result = new LinkedList();
26
		EObject modelObject = ((View) getHost().getModel()).getElement();
27
		View viewObject = (View) getHost().getModel();
28
		EObject nextValue;
29
		int nodeVID;
30
		for (Iterator values = ((CallAction) modelObject).getResults().iterator(); values.hasNext();) {
31
			nextValue = (EObject) values.next();
32
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
33
			if (OutputPin3EditPart.VISUAL_ID == nodeVID) {
34
				result.add(nextValue);
35
			}
36
		}
37
		for (Iterator values = ((InvocationAction) modelObject).getArguments().iterator(); values.hasNext();) {
38
			nextValue = (EObject) values.next();
39
			nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject, nextValue);
40
			if (InputPin4EditPart.VISUAL_ID == nodeVID) {
41
				result.add(nextValue);
42
			}
43
		}
44
		return result;
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected boolean shouldDeleteView(View view) {
51
		return view.isSetElement() && view.getElement() != null && view.getElement().eIsProxy();
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected String getDefaultFactoryHint() {
58
		return null;
59
	}
60
61
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPinName2EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class OutputPinName2EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5004;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(OutputPinName2EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public OutputPinName2EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.OutputPin_3002;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinNameEditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class InputPinNameEditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5006;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(InputPinNameEditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public InputPinNameEditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.InputPin_3003;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/DataStoreNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class DataStoreNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/OutputPinEditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class OutputPinEditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorActionProvider.java (+154 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorInput;
4
5
import org.eclipse.gmf.runtime.notation.Diagram;
6
7
import org.eclipse.jface.action.Action;
8
import org.eclipse.jface.action.IMenuManager;
9
10
import org.eclipse.jface.viewers.IStructuredSelection;
11
12
import org.eclipse.ui.IActionBars;
13
import org.eclipse.ui.IWorkbenchPage;
14
import org.eclipse.ui.PartInitException;
15
16
import org.eclipse.ui.navigator.CommonActionProvider;
17
import org.eclipse.ui.navigator.ICommonActionConstants;
18
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
19
import org.eclipse.ui.navigator.ICommonMenuConstants;
20
import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
21
22
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
23
24
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditor;
25
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
26
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
27
28
/**
29
 * @generated
30
 */
31
public class UMLNavigatorActionProvider extends CommonActionProvider {
32
33
	/**
34
	 * @generated
35
	 */
36
	private boolean myContribute;
37
38
	/**
39
	 * @generated
40
	 */
41
	private OpenDiagramAction myOpenDiagramAction;
42
43
	/**
44
	 * @generated
45
	 */
46
	public void init(ICommonActionExtensionSite aSite) {
47
		super.init(aSite);
48
		if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
49
			myContribute = true;
50
			makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
51
		} else {
52
			myContribute = false;
53
		}
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
60
		myOpenDiagramAction = new OpenDiagramAction(viewerSite);
61
	}
62
63
	/**
64
	 * @generated
65
	 */
66
	public void fillActionBars(IActionBars actionBars) {
67
		if (!myContribute) {
68
			return;
69
		}
70
		IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
71
		myOpenDiagramAction.selectionChanged(selection);
72
		if (myOpenDiagramAction.isEnabled()) {
73
			actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, myOpenDiagramAction);
74
		}
75
	}
76
77
	/**
78
	 * @generated
79
	 */
80
	public void fillContextMenu(IMenuManager menu) {
81
		/*		if (!myContribute || getContext().getSelection().isEmpty()) {
82
		 return;
83
		 }
84
85
		 IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
86
87
		 myOpenDiagramAction.selectionChanged(selection);
88
		 if (myOpenDiagramAction.isEnabled()) {
89
		 menu.insertAfter(ICommonMenuConstants.GROUP_OPEN, myOpenDiagramAction);
90
		 }*/
91
	}
92
93
	/**
94
	 * @generated
95
	 */
96
	private class OpenDiagramAction extends Action {
97
98
		/**
99
		 * @generated
100
		 */
101
		private Diagram myDiagram;
102
103
		/**
104
		 * @generated
105
		 */
106
		private ICommonViewerWorkbenchSite myViewerSite;
107
108
		/**
109
		 * @generated
110
		 */
111
		public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
112
			super("Open Diagram");
113
			myViewerSite = viewerSite;
114
		}
115
116
		/**
117
		 * @generated
118
		 */
119
		public final void selectionChanged(IStructuredSelection selection) {
120
			myDiagram = null;
121
			if (selection.size() == 1) {
122
				Object selectedElement = selection.getFirstElement();
123
				if (selectedElement instanceof UMLNavigatorItem) {
124
					selectedElement = ((UMLNavigatorItem) selectedElement).getView();
125
				}
126
				if (selectedElement instanceof Diagram) {
127
					Diagram diagram = (Diagram) selectedElement;
128
					if (ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(diagram))) {
129
						myDiagram = diagram;
130
					}
131
				}
132
			}
133
			setEnabled(myDiagram != null);
134
		}
135
136
		/**
137
		 * @generated
138
		 */
139
		public void run() {
140
			if (myDiagram == null) {
141
				return;
142
			}
143
			DiagramEditorInput editorInput = new DiagramEditorInput(myDiagram);
144
			IWorkbenchPage page = myViewerSite.getPage();
145
			try {
146
				page.openEditor(editorInput, UMLDiagramEditor.ID);
147
			} catch (PartInitException e) {
148
				UMLDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e);
149
			}
150
		}
151
152
	}
153
154
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/OutputPinItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class OutputPinItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ControlFlowItemSemanticEditPolicy.java (+18 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.gef.commands.Command;
4
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
5
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
6
7
/**
8
 * @generated
9
 */
10
public class ControlFlowItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
11
12
	/**
13
	 * @generated
14
	 */
15
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
16
		return getMSLWrapper(new DestroyElementCommand(req));
17
	}
18
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CallBehaviorActionEditPart.java (+422 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.requests.CreateRequest;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
17
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
18
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
19
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.notation.View;
23
import org.eclipse.uml2.diagram.activity.edit.policies.CallBehaviorActionCanonicalEditPolicy;
24
import org.eclipse.uml2.diagram.activity.edit.policies.CallBehaviorActionItemSemanticEditPolicy;
25
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
26
27
/**
28
 * @generated
29
 */
30
public class CallBehaviorActionEditPart extends AbstractBorderedShapeEditPart {
31
32
	/**
33
	 * @generated
34
	 */
35
	public static final int VISUAL_ID = 2017;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure contentPane;
41
42
	/**
43
	 * @generated
44
	 */
45
	protected IFigure primaryShape;
46
47
	/**
48
	 * @generated
49
	 */
50
	public CallBehaviorActionEditPart(View view) {
51
		super(view);
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected void createDefaultEditPolicies() {
58
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
59
		super.createDefaultEditPolicies();
60
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CallBehaviorActionItemSemanticEditPolicy());
61
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
62
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new CallBehaviorActionCanonicalEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected EditPolicy createChildEditPolicy(EditPart child) {
74
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
75
				if (result == null) {
76
					result = new NonResizableEditPolicy();
77
				}
78
				return result;
79
			}
80
81
			protected Command getMoveChildrenCommand(Request request) {
82
				return null;
83
			}
84
85
			protected Command getCreateCommand(CreateRequest request) {
86
				return null;
87
			}
88
		};
89
		return lep;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected IFigure createNodeShape() {
96
		ActionCallBehaviorFigure figure = new ActionCallBehaviorFigure();
97
		return primaryShape = figure;
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	public ActionCallBehaviorFigure getPrimaryShape() {
104
		return (ActionCallBehaviorFigure) primaryShape;
105
	}
106
107
	/**
108
	 * @generated 
109
	 */
110
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
111
		if (editPart instanceof OutputPin3EditPart) {
112
			return getBorderedFigure().getBorderItemContainer();
113
		}
114
		if (editPart instanceof InputPin4EditPart) {
115
			return getBorderedFigure().getBorderItemContainer();
116
		}
117
118
		return super.getContentPaneFor(editPart);
119
	}
120
121
	/**
122
	 * @generated
123
	 */
124
	protected boolean addFixedChild(EditPart childEditPart) {
125
		if (childEditPart instanceof CallBehaviorActionNameEditPart) {
126
			((CallBehaviorActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureActionCallBehaviorFigure_name());
127
			return true;
128
		}
129
		if (childEditPart instanceof OutputPin3EditPart) {
130
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.EAST);
131
			getBorderedFigure().getBorderItemContainer().add(((OutputPin3EditPart) childEditPart).getFigure(), locator);
132
			return true;
133
		}
134
		if (childEditPart instanceof InputPin4EditPart) {
135
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.WEST);
136
			getBorderedFigure().getBorderItemContainer().add(((InputPin4EditPart) childEditPart).getFigure(), locator);
137
			return true;
138
		}
139
		return false;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	protected boolean removeFixedChild(EditPart childEditPart) {
146
		if (childEditPart instanceof OutputPin3EditPart) {
147
			getBorderedFigure().getBorderItemContainer().remove(((OutputPin3EditPart) childEditPart).getFigure());
148
			return true;
149
		}
150
		if (childEditPart instanceof InputPin4EditPart) {
151
			getBorderedFigure().getBorderItemContainer().remove(((InputPin4EditPart) childEditPart).getFigure());
152
			return true;
153
		}
154
		return false;
155
	}
156
157
	/**
158
	 * @generated
159
	 */
160
	protected NodeFigure createNodePlate() {
161
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(50));
162
		return result;
163
	}
164
165
	/**
166
	 * Creates figure for this edit part.
167
	 * 
168
	 * Body of this method does not depend on settings in generation model
169
	 * so you may safely remove <i>generated</i> tag and modify it.
170
	 * 
171
	 * @generated
172
	 */
173
	protected NodeFigure createMainFigure() {
174
		NodeFigure figure = createNodePlate();
175
		figure.setLayoutManager(new StackLayout());
176
		IFigure shape = createNodeShape();
177
		figure.add(shape);
178
		contentPane = setupContentPane(shape);
179
		return figure;
180
	}
181
182
	/**
183
	 * Default implementation treats passed figure as content pane.
184
	 * Respects layout one may have set for generated figure.
185
	 * @param nodeShape instance of generated figure class
186
	 * @generated
187
	 */
188
	protected IFigure setupContentPane(IFigure nodeShape) {
189
		if (nodeShape.getLayoutManager() == null) {
190
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
191
			layout.setSpacing(getMapMode().DPtoLP(5));
192
			nodeShape.setLayoutManager(layout);
193
		}
194
		return nodeShape; // use nodeShape itself as contentPane
195
	}
196
197
	/**
198
	 * @generated
199
	 */
200
	public IFigure getContentPane() {
201
		if (contentPane != null) {
202
			return contentPane;
203
		}
204
		return super.getContentPane();
205
	}
206
207
	/**
208
	 * @generated
209
	 */
210
	public EditPart getPrimaryChildEditPart() {
211
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(CallBehaviorActionNameEditPart.VISUAL_ID));
212
	}
213
214
	/**
215
	 * @generated
216
	 */
217
	protected void addChildVisual(EditPart childEditPart, int index) {
218
		if (addFixedChild(childEditPart)) {
219
			return;
220
		}
221
		super.addChildVisual(childEditPart, -1);
222
	}
223
224
	/**
225
	 * @generated
226
	 */
227
	protected void removeChildVisual(EditPart childEditPart) {
228
		if (removeFixedChild(childEditPart)) {
229
			return;
230
		}
231
		super.removeChildVisual(childEditPart);
232
	}
233
234
	/**
235
	 * @generated
236
	 */
237
	public class ActionCallBehaviorFigure extends org.eclipse.draw2d.RoundedRectangle {
238
239
		/**
240
		 * @generated
241
		 */
242
		public ActionCallBehaviorFigure() {
243
244
			org.eclipse.draw2d.BorderLayout myGenLayoutManager = new org.eclipse.draw2d.BorderLayout();
245
246
			this.setLayoutManager(myGenLayoutManager);
247
248
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
249
250
			createContents();
251
		}
252
253
		/**
254
		 * @generated
255
		 */
256
		private void createContents() {
257
			org.eclipse.draw2d.RectangleFigure fig_0 = new org.eclipse.draw2d.RectangleFigure();
258
			fig_0.setFill(false);
259
			fig_0.setOutline(false);
260
261
			org.eclipse.draw2d.BorderLayout layouter0 = new org.eclipse.draw2d.BorderLayout();
262
263
			fig_0.setLayoutManager(layouter0);
264
265
			setFigureActionCallBehaviorFigure_AuxBottom(fig_0);
266
267
			Object layData0 = org.eclipse.draw2d.BorderLayout.BOTTOM;
268
269
			this.add(fig_0, layData0);
270
			org.eclipse.draw2d.RectangleFigure fig_1 = new org.eclipse.draw2d.RectangleFigure();
271
			fig_1.setFill(false);
272
			fig_1.setOutline(false);
273
274
			org.eclipse.draw2d.StackLayout layouter1 = new org.eclipse.draw2d.StackLayout();
275
276
			fig_1.setLayoutManager(layouter1);
277
278
			Object layData1 = org.eclipse.draw2d.BorderLayout.LEFT;
279
280
			fig_0.add(fig_1, layData1);
281
			org.eclipse.uml2.diagram.common.draw2d.PolylineContainer fig_2 = new org.eclipse.uml2.diagram.common.draw2d.PolylineContainer();
282
283
			fig_2.setPreferredSize(getMapMode().DPtoLP(20), getMapMode().DPtoLP(20));
284
285
			Object layData2 = null;
286
287
			fig_1.add(fig_2, layData2);
288
			org.eclipse.draw2d.Polyline fig_3 = new org.eclipse.draw2d.Polyline();
289
290
			fig_3.setLineWidth(2);
291
			fig_3.setForegroundColor(org.eclipse.draw2d.ColorConstants.darkBlue);
292
			fig_3.addPoint(new org.eclipse.draw2d.geometry.Point(10, 4));
293
			fig_3.addPoint(new org.eclipse.draw2d.geometry.Point(10, 16));
294
295
			Object layData3 = null;
296
297
			fig_2.add(fig_3, layData3);
298
			org.eclipse.draw2d.Polyline fig_4 = new org.eclipse.draw2d.Polyline();
299
300
			fig_4.setLineWidth(2);
301
			fig_4.setForegroundColor(org.eclipse.draw2d.ColorConstants.darkBlue);
302
			fig_4.addPoint(new org.eclipse.draw2d.geometry.Point(10, 10));
303
			fig_4.addPoint(new org.eclipse.draw2d.geometry.Point(5, 10));
304
			fig_4.addPoint(new org.eclipse.draw2d.geometry.Point(5, 16));
305
306
			Object layData4 = null;
307
308
			fig_2.add(fig_4, layData4);
309
			org.eclipse.draw2d.Polyline fig_5 = new org.eclipse.draw2d.Polyline();
310
311
			fig_5.setLineWidth(2);
312
			fig_5.setForegroundColor(org.eclipse.draw2d.ColorConstants.darkBlue);
313
			fig_5.addPoint(new org.eclipse.draw2d.geometry.Point(10, 10));
314
			fig_5.addPoint(new org.eclipse.draw2d.geometry.Point(15, 10));
315
			fig_5.addPoint(new org.eclipse.draw2d.geometry.Point(15, 16));
316
317
			Object layData5 = null;
318
319
			fig_2.add(fig_5, layData5);
320
			org.eclipse.draw2d.RectangleFigure fig_6 = new org.eclipse.draw2d.RectangleFigure();
321
			fig_6.setFill(false);
322
			fig_6.setOutline(false);
323
324
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout layouter6 = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
325
326
			fig_6.setLayoutManager(layouter6);
327
328
			setFigureActionCallBehaviorFigure_AuxCenter(fig_6);
329
330
			Object layData6 = org.eclipse.draw2d.BorderLayout.CENTER;
331
332
			this.add(fig_6, layData6);
333
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_7 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
334
335
			fig_7.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
336
337
			setFigureActionCallBehaviorFigure_name(fig_7);
338
339
			Object layData7 = null;
340
341
			fig_6.add(fig_7, layData7);
342
		}
343
344
		/**
345
		 * @generated
346
		 */
347
		private org.eclipse.draw2d.RectangleFigure fActionCallBehaviorFigure_AuxBottom;
348
349
		/**
350
		 * @generated
351
		 */
352
		public org.eclipse.draw2d.RectangleFigure getFigureActionCallBehaviorFigure_AuxBottom() {
353
			return fActionCallBehaviorFigure_AuxBottom;
354
		}
355
356
		/**
357
		 * @generated
358
		 */
359
		private void setFigureActionCallBehaviorFigure_AuxBottom(org.eclipse.draw2d.RectangleFigure fig) {
360
			fActionCallBehaviorFigure_AuxBottom = fig;
361
		}
362
363
		/**
364
		 * @generated
365
		 */
366
		private org.eclipse.draw2d.RectangleFigure fActionCallBehaviorFigure_AuxCenter;
367
368
		/**
369
		 * @generated
370
		 */
371
		public org.eclipse.draw2d.RectangleFigure getFigureActionCallBehaviorFigure_AuxCenter() {
372
			return fActionCallBehaviorFigure_AuxCenter;
373
		}
374
375
		/**
376
		 * @generated
377
		 */
378
		private void setFigureActionCallBehaviorFigure_AuxCenter(org.eclipse.draw2d.RectangleFigure fig) {
379
			fActionCallBehaviorFigure_AuxCenter = fig;
380
		}
381
382
		/**
383
		 * @generated
384
		 */
385
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fActionCallBehaviorFigure_name;
386
387
		/**
388
		 * @generated
389
		 */
390
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureActionCallBehaviorFigure_name() {
391
			return fActionCallBehaviorFigure_name;
392
		}
393
394
		/**
395
		 * @generated
396
		 */
397
		private void setFigureActionCallBehaviorFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
398
			fActionCallBehaviorFigure_name = fig;
399
		}
400
401
		/**
402
		 * @generated
403
		 */
404
		private boolean myUseLocalCoordinates = false;
405
406
		/**
407
		 * @generated
408
		 */
409
		protected boolean useLocalCoordinates() {
410
			return myUseLocalCoordinates;
411
		}
412
413
		/**
414
		 * @generated
415
		 */
416
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
417
			myUseLocalCoordinates = useLocalCoordinates;
418
		}
419
420
	}
421
422
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinName5ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class InputPinName5ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/JoinNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class JoinNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorGroup.java (+103 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import java.util.Collection;
4
import java.util.LinkedList;
5
6
/**
7
 * @generated
8
 */
9
public class UMLNavigatorGroup extends UMLAbstractNavigatorItem {
10
11
	/**
12
	 * @generated
13
	 */
14
	private String myGroupName;
15
16
	/**
17
	 * @generated
18
	 */
19
	private String myIcon;
20
21
	/**
22
	 * @generated
23
	 */
24
	private String myModelID;
25
26
	/**
27
	 * @generated
28
	 */
29
	private Collection myChildren = new LinkedList();
30
31
	/**
32
	 * @generated
33
	 */
34
	UMLNavigatorGroup(String groupName, String icon, String modelID, Object parent) {
35
		super(parent);
36
		myGroupName = groupName;
37
		myIcon = icon;
38
		myModelID = modelID;
39
	}
40
41
	/**
42
	 * @generated
43
	 */
44
	public String getGroupName() {
45
		return myGroupName;
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	public String getIcon() {
52
		return myIcon;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	public Object[] getChildren() {
59
		return myChildren.toArray();
60
	}
61
62
	/**
63
	 * @generated
64
	 */
65
	public void addChildren(Collection children) {
66
		myChildren.addAll(children);
67
	}
68
69
	/**
70
	 * @generated
71
	 */
72
	public void addChild(Object child) {
73
		myChildren.add(child);
74
	}
75
76
	/**
77
	 * @generated
78
	 */
79
	public boolean isEmpty() {
80
		return myChildren.size() == 0;
81
	}
82
83
	/**
84
	 * @generated
85
	 */
86
	public String getModelID() {
87
		return myModelID;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public boolean equals(Object obj) {
94
		if (obj instanceof UMLNavigatorGroup) {
95
			UMLNavigatorGroup anotherGroup = (UMLNavigatorGroup) obj;
96
			if (getGroupName().equals(anotherGroup.getGroupName())) {
97
				return getParent().equals(anotherGroup.getParent());
98
			}
99
		}
100
		return super.equals(obj);
101
	}
102
103
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CallBehaviorActionItemSemanticEditPolicy.java (+282 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
13
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
14
import org.eclipse.gmf.runtime.notation.View;
15
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
16
import org.eclipse.uml2.uml.Activity;
17
import org.eclipse.uml2.uml.ActivityNode;
18
import org.eclipse.uml2.uml.ControlFlow;
19
import org.eclipse.uml2.uml.ObjectFlow;
20
import org.eclipse.uml2.uml.UMLPackage;
21
22
/**
23
 * @generated
24
 */
25
public class CallBehaviorActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
26
27
	/**
28
	 * @generated
29
	 */
30
	protected Command getCreateCommand(CreateElementRequest req) {
31
		if (UMLElementTypes.OutputPin_3006 == req.getElementType()) {
32
			if (req.getContainmentFeature() == null) {
33
				req.setContainmentFeature(UMLPackage.eINSTANCE.getCallAction_Result());
34
			}
35
			return getMSLWrapper(new CreateOutputPin_3006Command(req));
36
		}
37
		if (UMLElementTypes.InputPin_3007 == req.getElementType()) {
38
			if (req.getContainmentFeature() == null) {
39
				req.setContainmentFeature(UMLPackage.eINSTANCE.getInvocationAction_Argument());
40
			}
41
			return getMSLWrapper(new CreateInputPin_3007Command(req));
42
		}
43
		return super.getCreateCommand(req);
44
	}
45
46
	/**
47
	 * @generated
48
	 */
49
	private static class CreateOutputPin_3006Command extends CreateElementCommand {
50
51
		/**
52
		 * @generated
53
		 */
54
		public CreateOutputPin_3006Command(CreateElementRequest req) {
55
			super(req);
56
		}
57
58
		/**
59
		 * @generated
60
		 */
61
		protected EClass getEClassToEdit() {
62
			return UMLPackage.eINSTANCE.getCallBehaviorAction();
63
		};
64
65
		/**
66
		 * @generated
67
		 */
68
		protected EObject getElementToEdit() {
69
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
70
			if (container instanceof View) {
71
				container = ((View) container).getElement();
72
			}
73
			return container;
74
		}
75
	}
76
77
	/**
78
	 * @generated
79
	 */
80
	private static class CreateInputPin_3007Command extends CreateElementCommand {
81
82
		/**
83
		 * @generated
84
		 */
85
		public CreateInputPin_3007Command(CreateElementRequest req) {
86
			super(req);
87
		}
88
89
		/**
90
		 * @generated
91
		 */
92
		protected EClass getEClassToEdit() {
93
			return UMLPackage.eINSTANCE.getCallBehaviorAction();
94
		};
95
96
		/**
97
		 * @generated
98
		 */
99
		protected EObject getElementToEdit() {
100
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
101
			if (container instanceof View) {
102
				container = ((View) container).getElement();
103
			}
104
			return container;
105
		}
106
	}
107
108
	/**
109
	 * @generated
110
	 */
111
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
112
		return getMSLWrapper(new DestroyElementCommand(req) {
113
114
			protected EObject getElementToDestroy() {
115
				View view = (View) getHost().getModel();
116
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
117
				if (annotation != null) {
118
					return view;
119
				}
120
				return super.getElementToDestroy();
121
			}
122
123
		});
124
	}
125
126
	/**
127
	 * @generated
128
	 */
129
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
130
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
131
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
132
		}
133
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
134
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
135
		}
136
		return super.getCreateRelationshipCommand(req);
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
143
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		return new Command() {
147
		};
148
	}
149
150
	/**
151
	 * @generated
152
	 */
153
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
154
		if (!(req.getSource() instanceof ActivityNode)) {
155
			return UnexecutableCommand.INSTANCE;
156
		}
157
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
158
		if (element == null) {
159
			return UnexecutableCommand.INSTANCE;
160
		}
161
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
162
			return UnexecutableCommand.INSTANCE;
163
		}
164
		if (req.getContainmentFeature() == null) {
165
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
166
		}
167
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
168
169
			protected EObject getElementToEdit() {
170
				return element;
171
			}
172
		});
173
	}
174
175
	/**
176
	 * @generated
177
	 */
178
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
179
180
		/**
181
		 * @generated
182
		 */
183
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
184
			super(req);
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EClass getEClassToEdit() {
191
			return UMLPackage.eINSTANCE.getActivity();
192
		};
193
194
		/**
195
		 * @generated
196
		 */
197
		protected void setElementToEdit(EObject element) {
198
			throw new UnsupportedOperationException();
199
		}
200
201
		/**
202
		 * @generated
203
		 */
204
		protected EObject doDefaultElementCreation() {
205
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
206
			if (newElement != null) {
207
				newElement.setTarget((ActivityNode) getTarget());
208
				newElement.setSource((ActivityNode) getSource());
209
			}
210
			return newElement;
211
		}
212
	}
213
214
	/**
215
	 * @generated
216
	 */
217
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
218
		return new Command() {
219
		};
220
	}
221
222
	/**
223
	 * @generated
224
	 */
225
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
226
		if (!(req.getSource() instanceof ActivityNode)) {
227
			return UnexecutableCommand.INSTANCE;
228
		}
229
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
230
		if (element == null) {
231
			return UnexecutableCommand.INSTANCE;
232
		}
233
		if (req.getContainmentFeature() == null) {
234
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
235
		}
236
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
237
238
			protected EObject getElementToEdit() {
239
				return element;
240
			}
241
		});
242
	}
243
244
	/**
245
	 * @generated
246
	 */
247
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
248
249
		/**
250
		 * @generated
251
		 */
252
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
253
			super(req);
254
		}
255
256
		/**
257
		 * @generated
258
		 */
259
		protected EClass getEClassToEdit() {
260
			return UMLPackage.eINSTANCE.getActivity();
261
		};
262
263
		/**
264
		 * @generated
265
		 */
266
		protected void setElementToEdit(EObject element) {
267
			throw new UnsupportedOperationException();
268
		}
269
270
		/**
271
		 * @generated
272
		 */
273
		protected EObject doDefaultElementCreation() {
274
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
275
			if (newElement != null) {
276
				newElement.setTarget((ActivityNode) getTarget());
277
				newElement.setSource((ActivityNode) getSource());
278
			}
279
			return newElement;
280
		}
281
	}
282
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InputPin3ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InputPin3ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InputPin3EditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class InputPin3EditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/AddStructuralFeatureValueActionNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class AddStructuralFeatureValueActionNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5009;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public AddStructuralFeatureValueActionNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.AddStructuralFeatureValueAction_2016;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InitialNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InitialNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/CreateObjectActionItemSemanticEditPolicy.java (+250 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
13
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
14
import org.eclipse.gmf.runtime.notation.View;
15
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
16
import org.eclipse.uml2.uml.Activity;
17
import org.eclipse.uml2.uml.ActivityNode;
18
import org.eclipse.uml2.uml.ControlFlow;
19
import org.eclipse.uml2.uml.CreateObjectAction;
20
import org.eclipse.uml2.uml.ObjectFlow;
21
import org.eclipse.uml2.uml.UMLPackage;
22
23
/**
24
 * @generated
25
 */
26
public class CreateObjectActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
27
28
	/**
29
	 * @generated
30
	 */
31
	protected Command getCreateCommand(CreateElementRequest req) {
32
		if (UMLElementTypes.OutputPin_3002 == req.getElementType()) {
33
			CreateObjectAction container = (CreateObjectAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer());
34
			if (container.getResult() != null) {
35
				return super.getCreateCommand(req);
36
			}
37
			if (req.getContainmentFeature() == null) {
38
				req.setContainmentFeature(UMLPackage.eINSTANCE.getCreateObjectAction_Result());
39
			}
40
			return getMSLWrapper(new CreateOutputPin_3002Command(req));
41
		}
42
		return super.getCreateCommand(req);
43
	}
44
45
	/**
46
	 * @generated
47
	 */
48
	private static class CreateOutputPin_3002Command extends CreateElementCommand {
49
50
		/**
51
		 * @generated
52
		 */
53
		public CreateOutputPin_3002Command(CreateElementRequest req) {
54
			super(req);
55
		}
56
57
		/**
58
		 * @generated
59
		 */
60
		protected EClass getEClassToEdit() {
61
			return UMLPackage.eINSTANCE.getCreateObjectAction();
62
		};
63
64
		/**
65
		 * @generated
66
		 */
67
		protected EObject getElementToEdit() {
68
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
69
			if (container instanceof View) {
70
				container = ((View) container).getElement();
71
			}
72
			return container;
73
		}
74
	}
75
76
	/**
77
	 * @generated
78
	 */
79
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
80
		return getMSLWrapper(new DestroyElementCommand(req) {
81
82
			protected EObject getElementToDestroy() {
83
				View view = (View) getHost().getModel();
84
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
85
				if (annotation != null) {
86
					return view;
87
				}
88
				return super.getElementToDestroy();
89
			}
90
91
		});
92
	}
93
94
	/**
95
	 * @generated
96
	 */
97
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
98
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
99
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
100
		}
101
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
102
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
103
		}
104
		return super.getCreateRelationshipCommand(req);
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
111
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
112
			return UnexecutableCommand.INSTANCE;
113
		}
114
		return new Command() {
115
		};
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
122
		if (!(req.getSource() instanceof ActivityNode)) {
123
			return UnexecutableCommand.INSTANCE;
124
		}
125
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
126
		if (element == null) {
127
			return UnexecutableCommand.INSTANCE;
128
		}
129
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
130
			return UnexecutableCommand.INSTANCE;
131
		}
132
		if (req.getContainmentFeature() == null) {
133
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
134
		}
135
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
136
137
			protected EObject getElementToEdit() {
138
				return element;
139
			}
140
		});
141
	}
142
143
	/**
144
	 * @generated
145
	 */
146
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
147
148
		/**
149
		 * @generated
150
		 */
151
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
152
			super(req);
153
		}
154
155
		/**
156
		 * @generated
157
		 */
158
		protected EClass getEClassToEdit() {
159
			return UMLPackage.eINSTANCE.getActivity();
160
		};
161
162
		/**
163
		 * @generated
164
		 */
165
		protected void setElementToEdit(EObject element) {
166
			throw new UnsupportedOperationException();
167
		}
168
169
		/**
170
		 * @generated
171
		 */
172
		protected EObject doDefaultElementCreation() {
173
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
174
			if (newElement != null) {
175
				newElement.setTarget((ActivityNode) getTarget());
176
				newElement.setSource((ActivityNode) getSource());
177
			}
178
			return newElement;
179
		}
180
	}
181
182
	/**
183
	 * @generated
184
	 */
185
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
186
		return new Command() {
187
		};
188
	}
189
190
	/**
191
	 * @generated
192
	 */
193
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
194
		if (!(req.getSource() instanceof ActivityNode)) {
195
			return UnexecutableCommand.INSTANCE;
196
		}
197
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
198
		if (element == null) {
199
			return UnexecutableCommand.INSTANCE;
200
		}
201
		if (req.getContainmentFeature() == null) {
202
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
203
		}
204
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
205
206
			protected EObject getElementToEdit() {
207
				return element;
208
			}
209
		});
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
216
217
		/**
218
		 * @generated
219
		 */
220
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
221
			super(req);
222
		}
223
224
		/**
225
		 * @generated
226
		 */
227
		protected EClass getEClassToEdit() {
228
			return UMLPackage.eINSTANCE.getActivity();
229
		};
230
231
		/**
232
		 * @generated
233
		 */
234
		protected void setElementToEdit(EObject element) {
235
			throw new UnsupportedOperationException();
236
		}
237
238
		/**
239
		 * @generated
240
		 */
241
		protected EObject doDefaultElementCreation() {
242
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
243
			if (newElement != null) {
244
				newElement.setTarget((ActivityNode) getTarget());
245
				newElement.setSource((ActivityNode) getSource());
246
			}
247
			return newElement;
248
		}
249
	}
250
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLStructuralFeaturesParser.java (+102 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.text.FieldPosition;
4
import java.text.MessageFormat;
5
import java.util.ArrayList;
6
import java.util.Iterator;
7
import java.util.List;
8
9
import org.eclipse.core.runtime.IAdaptable;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.ecore.EStructuralFeature;
13
import org.eclipse.emf.transaction.TransactionalEditingDomain;
14
import org.eclipse.emf.transaction.util.TransactionUtil;
15
import org.eclipse.gmf.runtime.common.core.command.ICommand;
16
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
19
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
20
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
21
22
/**
23
 * @generated
24
 */
25
public class UMLStructuralFeaturesParser extends UMLAbstractParser {
26
27
	/**
28
	 * @generated
29
	 */
30
	private List features;
31
32
	/**
33
	 * @generated
34
	 */
35
	public UMLStructuralFeaturesParser(List features) {
36
		this.features = features;
37
	}
38
39
	/**
40
	 * @generated
41
	 */
42
	protected String getStringByPattern(IAdaptable adapter, int flags, String pattern, MessageFormat processor) {
43
		EObject element = (EObject) adapter.getAdapter(EObject.class);
44
		List values = new ArrayList(features.size());
45
		for (Iterator it = features.iterator(); it.hasNext();) {
46
			EStructuralFeature feature = (EStructuralFeature) it.next();
47
			Object value = element.eGet(feature);
48
			value = getValidValue(feature, value);
49
			values.add(value);
50
		}
51
		return processor.format(values.toArray(new Object[values.size()]), new StringBuffer(), new FieldPosition(0)).toString();
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected IParserEditStatus validateValues(Object[] values) {
58
		if (values.length != features.size()) {
59
			return ParserEditStatus.UNEDITABLE_STATUS;
60
		}
61
		for (int i = 0; i < values.length; i++) {
62
			Object value = getValidNewValue((EStructuralFeature) features.get(i), values[i]);
63
			if (value instanceof InvalidValue) {
64
				return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
65
			}
66
		}
67
		return ParserEditStatus.EDITABLE_STATUS;
68
	}
69
70
	/**
71
	 * @generated
72
	 */
73
	public ICommand getParseCommand(IAdaptable adapter, Object[] values) {
74
		EObject element = (EObject) adapter.getAdapter(EObject.class);
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
79
		if (editingDomain == null) {
80
			return UnexecutableCommand.INSTANCE;
81
		}
82
		CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
83
		for (int i = 0; i < values.length; i++) {
84
			EStructuralFeature feature = (EStructuralFeature) features.get(i);
85
			command.compose(getModificationCommand(element, feature, values[i]));
86
		}
87
		return command;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public boolean isAffectingEvent(Object event, int flags) {
94
		if (event instanceof Notification) {
95
			Object feature = ((Notification) event).getFeature();
96
			if (features.contains(feature)) {
97
				return true;
98
			}
99
		}
100
		return false;
101
	}
102
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/OutputPinEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class OutputPinEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPinName4EditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class InputPinName4EditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5011;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(InputPinName4EditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public InputPinName4EditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.InputPin_3007;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)build.properties (+7 lines)
Added Link Here
1
bin.includes = .,\
2
               META-INF/,\
3
               plugin.xml,\
4
               plugin.properties
5
jars.compile.order = .
6
source.. = src/
7
output.. = bin/
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/StructuredActivityNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class StructuredActivityNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/JoinNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class JoinNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLParserProvider.java (+419 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
5
import org.eclipse.gmf.runtime.common.core.service.IOperation;
6
import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
7
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
8
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
9
import org.eclipse.gmf.runtime.notation.View;
10
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart;
11
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart;
12
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart;
13
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart;
15
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart;
16
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart;
17
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart;
18
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart;
19
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart;
20
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart;
21
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart;
22
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart;
23
import org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart;
24
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
25
import org.eclipse.uml2.uml.UMLPackage;
26
27
/**
28
 * @generated
29
 */
30
public class UMLParserProvider extends AbstractProvider implements IParserProvider {
31
32
	/**
33
	 * @generated
34
	 */
35
	private IParser outputPinOutputPinName_5003Parser;
36
37
	/**
38
	 * @generated
39
	 */
40
	private IParser getOutputPinOutputPinName_5003Parser() {
41
		if (outputPinOutputPinName_5003Parser == null) {
42
			outputPinOutputPinName_5003Parser = createOutputPinOutputPinName_5003Parser();
43
		}
44
		return outputPinOutputPinName_5003Parser;
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected IParser createOutputPinOutputPinName_5003Parser() {
51
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
52
		return parser;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	private IParser outputPinOutputPinName_5004Parser;
59
60
	/**
61
	 * @generated
62
	 */
63
	private IParser getOutputPinOutputPinName_5004Parser() {
64
		if (outputPinOutputPinName_5004Parser == null) {
65
			outputPinOutputPinName_5004Parser = createOutputPinOutputPinName_5004Parser();
66
		}
67
		return outputPinOutputPinName_5004Parser;
68
	}
69
70
	/**
71
	 * @generated
72
	 */
73
	protected IParser createOutputPinOutputPinName_5004Parser() {
74
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
75
		return parser;
76
	}
77
78
	/**
79
	 * @generated
80
	 */
81
	private IParser inputPinInputPinName_5006Parser;
82
83
	/**
84
	 * @generated
85
	 */
86
	private IParser getInputPinInputPinName_5006Parser() {
87
		if (inputPinInputPinName_5006Parser == null) {
88
			inputPinInputPinName_5006Parser = createInputPinInputPinName_5006Parser();
89
		}
90
		return inputPinInputPinName_5006Parser;
91
	}
92
93
	/**
94
	 * @generated
95
	 */
96
	protected IParser createInputPinInputPinName_5006Parser() {
97
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
98
		return parser;
99
	}
100
101
	/**
102
	 * @generated
103
	 */
104
	private IParser inputPinInputPinName_5007Parser;
105
106
	/**
107
	 * @generated
108
	 */
109
	private IParser getInputPinInputPinName_5007Parser() {
110
		if (inputPinInputPinName_5007Parser == null) {
111
			inputPinInputPinName_5007Parser = createInputPinInputPinName_5007Parser();
112
		}
113
		return inputPinInputPinName_5007Parser;
114
	}
115
116
	/**
117
	 * @generated
118
	 */
119
	protected IParser createInputPinInputPinName_5007Parser() {
120
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
121
		return parser;
122
	}
123
124
	/**
125
	 * @generated
126
	 */
127
	private IParser inputPinInputPinName_5008Parser;
128
129
	/**
130
	 * @generated
131
	 */
132
	private IParser getInputPinInputPinName_5008Parser() {
133
		if (inputPinInputPinName_5008Parser == null) {
134
			inputPinInputPinName_5008Parser = createInputPinInputPinName_5008Parser();
135
		}
136
		return inputPinInputPinName_5008Parser;
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected IParser createInputPinInputPinName_5008Parser() {
143
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
144
		return parser;
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	private IParser outputPinOutputPinName_5010Parser;
151
152
	/**
153
	 * @generated
154
	 */
155
	private IParser getOutputPinOutputPinName_5010Parser() {
156
		if (outputPinOutputPinName_5010Parser == null) {
157
			outputPinOutputPinName_5010Parser = createOutputPinOutputPinName_5010Parser();
158
		}
159
		return outputPinOutputPinName_5010Parser;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	protected IParser createOutputPinOutputPinName_5010Parser() {
166
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
167
		return parser;
168
	}
169
170
	/**
171
	 * @generated
172
	 */
173
	private IParser inputPinInputPinName_5011Parser;
174
175
	/**
176
	 * @generated
177
	 */
178
	private IParser getInputPinInputPinName_5011Parser() {
179
		if (inputPinInputPinName_5011Parser == null) {
180
			inputPinInputPinName_5011Parser = createInputPinInputPinName_5011Parser();
181
		}
182
		return inputPinInputPinName_5011Parser;
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	protected IParser createInputPinInputPinName_5011Parser() {
189
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
190
		return parser;
191
	}
192
193
	/**
194
	 * @generated
195
	 */
196
	private IParser inputPinInputPinName_5013Parser;
197
198
	/**
199
	 * @generated
200
	 */
201
	private IParser getInputPinInputPinName_5013Parser() {
202
		if (inputPinInputPinName_5013Parser == null) {
203
			inputPinInputPinName_5013Parser = createInputPinInputPinName_5013Parser();
204
		}
205
		return inputPinInputPinName_5013Parser;
206
	}
207
208
	/**
209
	 * @generated
210
	 */
211
	protected IParser createInputPinInputPinName_5013Parser() {
212
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
213
		return parser;
214
	}
215
216
	/**
217
	 * @generated
218
	 */
219
	private IParser opaqueActionOpaqueActionName_5001Parser;
220
221
	/**
222
	 * @generated
223
	 */
224
	private IParser getOpaqueActionOpaqueActionName_5001Parser() {
225
		if (opaqueActionOpaqueActionName_5001Parser == null) {
226
			opaqueActionOpaqueActionName_5001Parser = createOpaqueActionOpaqueActionName_5001Parser();
227
		}
228
		return opaqueActionOpaqueActionName_5001Parser;
229
	}
230
231
	/**
232
	 * @generated
233
	 */
234
	protected IParser createOpaqueActionOpaqueActionName_5001Parser() {
235
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
236
		return parser;
237
	}
238
239
	/**
240
	 * @generated
241
	 */
242
	private IParser pinPinName_5002Parser;
243
244
	/**
245
	 * @generated
246
	 */
247
	private IParser getPinPinName_5002Parser() {
248
		if (pinPinName_5002Parser == null) {
249
			pinPinName_5002Parser = createPinPinName_5002Parser();
250
		}
251
		return pinPinName_5002Parser;
252
	}
253
254
	/**
255
	 * @generated
256
	 */
257
	protected IParser createPinPinName_5002Parser() {
258
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
259
		return parser;
260
	}
261
262
	/**
263
	 * @generated
264
	 */
265
	private IParser createObjectActionCreateObjectActionName_5005Parser;
266
267
	/**
268
	 * @generated
269
	 */
270
	private IParser getCreateObjectActionCreateObjectActionName_5005Parser() {
271
		if (createObjectActionCreateObjectActionName_5005Parser == null) {
272
			createObjectActionCreateObjectActionName_5005Parser = createCreateObjectActionCreateObjectActionName_5005Parser();
273
		}
274
		return createObjectActionCreateObjectActionName_5005Parser;
275
	}
276
277
	/**
278
	 * @generated
279
	 */
280
	protected IParser createCreateObjectActionCreateObjectActionName_5005Parser() {
281
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
282
		return parser;
283
	}
284
285
	/**
286
	 * @generated
287
	 */
288
	private IParser addStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser;
289
290
	/**
291
	 * @generated
292
	 */
293
	private IParser getAddStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser() {
294
		if (addStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser == null) {
295
			addStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser = createAddStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser();
296
		}
297
		return addStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser;
298
	}
299
300
	/**
301
	 * @generated
302
	 */
303
	protected IParser createAddStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser() {
304
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
305
		return parser;
306
	}
307
308
	/**
309
	 * @generated
310
	 */
311
	private IParser callBehaviorActionCallBehaviorActionName_5012Parser;
312
313
	/**
314
	 * @generated
315
	 */
316
	private IParser getCallBehaviorActionCallBehaviorActionName_5012Parser() {
317
		if (callBehaviorActionCallBehaviorActionName_5012Parser == null) {
318
			callBehaviorActionCallBehaviorActionName_5012Parser = createCallBehaviorActionCallBehaviorActionName_5012Parser();
319
		}
320
		return callBehaviorActionCallBehaviorActionName_5012Parser;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected IParser createCallBehaviorActionCallBehaviorActionName_5012Parser() {
327
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
328
		return parser;
329
	}
330
331
	/**
332
	 * @generated
333
	 */
334
	private IParser callOperationActionCallOperationActionName_5014Parser;
335
336
	/**
337
	 * @generated
338
	 */
339
	private IParser getCallOperationActionCallOperationActionName_5014Parser() {
340
		if (callOperationActionCallOperationActionName_5014Parser == null) {
341
			callOperationActionCallOperationActionName_5014Parser = createCallOperationActionCallOperationActionName_5014Parser();
342
		}
343
		return callOperationActionCallOperationActionName_5014Parser;
344
	}
345
346
	/**
347
	 * @generated
348
	 */
349
	protected IParser createCallOperationActionCallOperationActionName_5014Parser() {
350
		UMLStructuralFeatureParser parser = new UMLStructuralFeatureParser(UMLPackage.eINSTANCE.getNamedElement_Name());
351
		return parser;
352
	}
353
354
	/**
355
	 * @generated
356
	 */
357
	protected IParser getParser(int visualID) {
358
		switch (visualID) {
359
		case OutputPinNameEditPart.VISUAL_ID:
360
			return getOutputPinOutputPinName_5003Parser();
361
		case OutputPinName2EditPart.VISUAL_ID:
362
			return getOutputPinOutputPinName_5004Parser();
363
		case InputPinNameEditPart.VISUAL_ID:
364
			return getInputPinInputPinName_5006Parser();
365
		case InputPinName2EditPart.VISUAL_ID:
366
			return getInputPinInputPinName_5007Parser();
367
		case InputPinName3EditPart.VISUAL_ID:
368
			return getInputPinInputPinName_5008Parser();
369
		case OutputPinName3EditPart.VISUAL_ID:
370
			return getOutputPinOutputPinName_5010Parser();
371
		case InputPinName4EditPart.VISUAL_ID:
372
			return getInputPinInputPinName_5011Parser();
373
		case InputPinName5EditPart.VISUAL_ID:
374
			return getInputPinInputPinName_5013Parser();
375
		case OpaqueActionNameEditPart.VISUAL_ID:
376
			return getOpaqueActionOpaqueActionName_5001Parser();
377
		case PinNameEditPart.VISUAL_ID:
378
			return getPinPinName_5002Parser();
379
		case CreateObjectActionNameEditPart.VISUAL_ID:
380
			return getCreateObjectActionCreateObjectActionName_5005Parser();
381
		case AddStructuralFeatureValueActionNameEditPart.VISUAL_ID:
382
			return getAddStructuralFeatureValueActionAddStructuralFeatureValueActionName_5009Parser();
383
		case CallBehaviorActionNameEditPart.VISUAL_ID:
384
			return getCallBehaviorActionCallBehaviorActionName_5012Parser();
385
		case CallOperationActionNameEditPart.VISUAL_ID:
386
			return getCallOperationActionCallOperationActionName_5014Parser();
387
		}
388
		return null;
389
	}
390
391
	/**
392
	 * @generated
393
	 */
394
	public IParser getParser(IAdaptable hint) {
395
		String vid = (String) hint.getAdapter(String.class);
396
		if (vid != null) {
397
			return getParser(UMLVisualIDRegistry.getVisualID(vid));
398
		}
399
		View view = (View) hint.getAdapter(View.class);
400
		if (view != null) {
401
			return getParser(UMLVisualIDRegistry.getVisualID(view));
402
		}
403
		return null;
404
	}
405
406
	/**
407
	 * @generated
408
	 */
409
	public boolean provides(IOperation operation) {
410
		if (operation instanceof GetParserOperation) {
411
			IAdaptable hint = ((GetParserOperation) operation).getHint();
412
			if (UMLElementTypes.getElement(hint) == null) {
413
				return false;
414
			}
415
			return getParser(hint) != null;
416
		}
417
		return false;
418
	}
419
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinNameViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class InputPinNameViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ForkNodeItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class ForkNodeItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CallBehaviorActionNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class CallBehaviorActionNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InitialNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class InitialNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)custom-src/org/eclipse/uml2/diagram/activity/providers/AcceptEventAction_2002_Initializer.java (+45 lines)
Added Link Here
1
/*
2
 * Copyright (c) 2006 Borland Software Corporation
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    Michael Golubev (Borland) - initial API and implementation
11
 */
12
13
package org.eclipse.uml2.diagram.activity.providers;
14
15
import org.eclipse.emf.ecore.EObject;
16
import org.eclipse.uml2.uml.AcceptEventAction;
17
import org.eclipse.uml2.uml.TimeEvent;
18
import org.eclipse.uml2.uml.Trigger;
19
import org.eclipse.uml2.uml.UMLFactory;
20
21
public class AcceptEventAction_2002_Initializer extends UMLElementTypes.Initializers.ObjectInitializer {
22
	public AcceptEventAction_2002_Initializer(){
23
		super(null);
24
	}
25
	
26
	@Override
27
	public void init(EObject instance) {
28
		if (instance instanceof AcceptEventAction) {
29
			AcceptEventAction action = (AcceptEventAction) instance;
30
			org.eclipse.uml2.uml.Package pakkage = action.getNearestPackage();
31
			if (pakkage != null) {
32
				Trigger trigger = action.createTrigger(null);
33
				TimeEvent event = UMLFactory.eINSTANCE.createTimeEvent();
34
				pakkage.getPackagedElements().add(event);
35
				trigger.setEvent(event);
36
			}
37
		}
38
	}
39
	
40
	@Override
41
	protected void init() {
42
		throw new UnsupportedOperationException("Default generation artifact. Should not be called");
43
	}
44
45
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CreateObjectActionNameEditPart.java (+545 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.ArrayList;
4
import java.util.Collections;
5
import java.util.List;
6
7
import org.eclipse.draw2d.IFigure;
8
import org.eclipse.draw2d.Label;
9
import org.eclipse.draw2d.geometry.Point;
10
import org.eclipse.emf.common.notify.Notification;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.transaction.RunnableWithResult;
13
import org.eclipse.gef.AccessibleEditPart;
14
import org.eclipse.gef.EditPolicy;
15
import org.eclipse.gef.GraphicalEditPart;
16
import org.eclipse.gef.Request;
17
import org.eclipse.gef.commands.Command;
18
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
19
import org.eclipse.gef.handles.NonResizableHandleKit;
20
import org.eclipse.gef.requests.DirectEditRequest;
21
import org.eclipse.gef.tools.DirectEditManager;
22
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
23
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
24
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
25
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
26
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
27
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
28
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
29
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
30
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
31
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
32
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
33
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
34
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
35
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
36
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
37
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
38
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
39
import org.eclipse.gmf.runtime.notation.FontStyle;
40
import org.eclipse.gmf.runtime.notation.NotationPackage;
41
import org.eclipse.gmf.runtime.notation.View;
42
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
43
import org.eclipse.jface.viewers.ICellEditorValidator;
44
import org.eclipse.swt.SWT;
45
import org.eclipse.swt.accessibility.AccessibleEvent;
46
import org.eclipse.swt.graphics.Color;
47
import org.eclipse.swt.graphics.FontData;
48
import org.eclipse.swt.graphics.Image;
49
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
50
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
51
52
/**
53
 * @generated
54
 */
55
public class CreateObjectActionNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
56
57
	/**
58
	 * @generated
59
	 */
60
	public static final int VISUAL_ID = 5005;
61
62
	/**
63
	 * @generated
64
	 */
65
	private DirectEditManager manager;
66
67
	/**
68
	 * @generated
69
	 */
70
	private IParser parser;
71
72
	/**
73
	 * @generated
74
	 */
75
	private List parserElements;
76
77
	/**
78
	 * @generated
79
	 */
80
	private String defaultText;
81
82
	/**
83
	 * @generated
84
	 */
85
	public CreateObjectActionNameEditPart(View view) {
86
		super(view);
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected void createDefaultEditPolicies() {
93
		super.createDefaultEditPolicies();
94
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
95
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
96
97
			protected List createSelectionHandles() {
98
				List handles = new ArrayList();
99
				NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
100
				return handles;
101
			}
102
103
			public Command getCommand(Request request) {
104
				return null;
105
			}
106
107
			public boolean understandsRequest(Request request) {
108
				return false;
109
			}
110
		});
111
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	protected String getLabelTextHelper(IFigure figure) {
118
		if (figure instanceof WrapLabel) {
119
			return ((WrapLabel) figure).getText();
120
		} else {
121
			return ((Label) figure).getText();
122
		}
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected void setLabelTextHelper(IFigure figure, String text) {
129
		if (figure instanceof WrapLabel) {
130
			((WrapLabel) figure).setText(text);
131
		} else {
132
			((Label) figure).setText(text);
133
		}
134
	}
135
136
	/**
137
	 * @generated
138
	 */
139
	protected Image getLabelIconHelper(IFigure figure) {
140
		if (figure instanceof WrapLabel) {
141
			return ((WrapLabel) figure).getIcon();
142
		} else {
143
			return ((Label) figure).getIcon();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected void setLabelIconHelper(IFigure figure, Image icon) {
151
		if (figure instanceof WrapLabel) {
152
			((WrapLabel) figure).setIcon(icon);
153
		} else {
154
			((Label) figure).setIcon(icon);
155
		}
156
	}
157
158
	/**
159
	 * @generated
160
	 */
161
	public void setLabel(WrapLabel figure) {
162
		unregisterVisuals();
163
		setFigure(figure);
164
		defaultText = getLabelTextHelper(figure);
165
		registerVisuals();
166
		refreshVisuals();
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected List getModelChildren() {
173
		return Collections.EMPTY_LIST;
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
180
		return null;
181
	}
182
183
	/**
184
	 * @generated
185
	 */
186
	protected EObject getParserElement() {
187
		EObject element = resolveSemanticElement();
188
		return element != null ? element : (View) getModel();
189
	}
190
191
	/**
192
	 * @generated
193
	 */
194
	protected Image getLabelIcon() {
195
		return null;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	protected String getLabelText() {
202
		String text = null;
203
		if (getParser() != null) {
204
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
205
		}
206
		if (text == null || text.length() == 0) {
207
			text = defaultText;
208
		}
209
		return text;
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	public void setLabelText(String text) {
216
		setLabelTextHelper(getFigure(), text);
217
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
218
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
219
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
220
		}
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	public String getEditText() {
227
		if (getParser() == null) {
228
			return ""; //$NON-NLS-1$
229
		}
230
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
231
	}
232
233
	/**
234
	 * @generated
235
	 */
236
	protected boolean isEditable() {
237
		return getEditText() != null;
238
	}
239
240
	/**
241
	 * @generated
242
	 */
243
	public ICellEditorValidator getEditTextValidator() {
244
		return new ICellEditorValidator() {
245
246
			public String isValid(final Object value) {
247
				if (value instanceof String) {
248
					final EObject element = getParserElement();
249
					final IParser parser = getParser();
250
					try {
251
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
252
253
							public void run() {
254
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
255
							}
256
						});
257
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
258
					} catch (InterruptedException ie) {
259
						ie.printStackTrace();
260
					}
261
				}
262
263
				// shouldn't get here
264
				return null;
265
			}
266
		};
267
	}
268
269
	/**
270
	 * @generated
271
	 */
272
	public IContentAssistProcessor getCompletionProcessor() {
273
		if (getParser() == null) {
274
			return null;
275
		}
276
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	public ParserOptions getParserOptions() {
283
		return ParserOptions.NONE;
284
	}
285
286
	/**
287
	 * @generated
288
	 */
289
	public IParser getParser() {
290
		if (parser == null) {
291
			String parserHint = ((View) getModel()).getType();
292
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
293
294
				public Object getAdapter(Class adapter) {
295
					if (IElementType.class.equals(adapter)) {
296
						return UMLElementTypes.CreateObjectAction_2015;
297
					}
298
					return super.getAdapter(adapter);
299
				}
300
			};
301
			parser = ParserService.getInstance().getParser(hintAdapter);
302
		}
303
		return parser;
304
	}
305
306
	/**
307
	 * @generated
308
	 */
309
	protected DirectEditManager getManager() {
310
		if (manager == null) {
311
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
312
		}
313
		return manager;
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void setManager(DirectEditManager manager) {
320
		this.manager = manager;
321
	}
322
323
	/**
324
	 * @generated
325
	 */
326
	protected void performDirectEdit() {
327
		getManager().show();
328
	}
329
330
	/**
331
	 * @generated
332
	 */
333
	protected void performDirectEdit(Point eventLocation) {
334
		if (getManager().getClass() == TextDirectEditManager.class) {
335
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
336
		}
337
	}
338
339
	/**
340
	 * @generated
341
	 */
342
	private void performDirectEdit(char initialCharacter) {
343
		if (getManager() instanceof TextDirectEditManager) {
344
			((TextDirectEditManager) getManager()).show(initialCharacter);
345
		} else {
346
			performDirectEdit();
347
		}
348
	}
349
350
	/**
351
	 * @generated
352
	 */
353
	protected void performDirectEditRequest(Request request) {
354
		final Request theRequest = request;
355
		try {
356
			getEditingDomain().runExclusive(new Runnable() {
357
358
				public void run() {
359
					if (isActive() && isEditable()) {
360
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
361
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
362
							performDirectEdit(initialChar.charValue());
363
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
364
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
365
							performDirectEdit(editRequest.getLocation());
366
						} else {
367
							performDirectEdit();
368
						}
369
					}
370
				}
371
			});
372
		} catch (InterruptedException e) {
373
			e.printStackTrace();
374
		}
375
	}
376
377
	/**
378
	 * @generated
379
	 */
380
	protected void refreshVisuals() {
381
		super.refreshVisuals();
382
		refreshLabel();
383
		refreshFont();
384
		refreshFontColor();
385
		refreshUnderline();
386
		refreshStrikeThrough();
387
	}
388
389
	/**
390
	 * @generated
391
	 */
392
	protected void refreshLabel() {
393
		setLabelTextHelper(getFigure(), getLabelText());
394
		setLabelIconHelper(getFigure(), getLabelIcon());
395
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
396
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
397
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
398
		}
399
	}
400
401
	/**
402
	 * @generated
403
	 */
404
	protected void refreshUnderline() {
405
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
406
		if (style != null && getFigure() instanceof WrapLabel) {
407
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
408
		}
409
	}
410
411
	/**
412
	 * @generated
413
	 */
414
	protected void refreshStrikeThrough() {
415
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
416
		if (style != null && getFigure() instanceof WrapLabel) {
417
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
418
		}
419
	}
420
421
	/**
422
	 * @generated
423
	 */
424
	protected void refreshFont() {
425
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
426
		if (style != null) {
427
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
428
			setFont(fontData);
429
		}
430
	}
431
432
	/**
433
	 * @generated
434
	 */
435
	protected void setFontColor(Color color) {
436
		getFigure().setForegroundColor(color);
437
	}
438
439
	/**
440
	 * @generated
441
	 */
442
	protected void addSemanticListeners() {
443
		if (getParser() instanceof ISemanticParser) {
444
			EObject element = resolveSemanticElement();
445
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
446
			for (int i = 0; i < parserElements.size(); i++) {
447
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
448
			}
449
		} else {
450
			super.addSemanticListeners();
451
		}
452
	}
453
454
	/**
455
	 * @generated
456
	 */
457
	protected void removeSemanticListeners() {
458
		if (parserElements != null) {
459
			for (int i = 0; i < parserElements.size(); i++) {
460
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
461
			}
462
		} else {
463
			super.removeSemanticListeners();
464
		}
465
	}
466
467
	/**
468
	 * @generated
469
	 */
470
	protected AccessibleEditPart getAccessibleEditPart() {
471
		if (accessibleEP == null) {
472
			accessibleEP = new AccessibleGraphicalEditPart() {
473
474
				public void getName(AccessibleEvent e) {
475
					e.result = getLabelTextHelper(getFigure());
476
				}
477
			};
478
		}
479
		return accessibleEP;
480
	}
481
482
	/**
483
	 * @generated
484
	 */
485
	private View getFontStyleOwnerView() {
486
		return getPrimaryView();
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	protected void addNotationalListeners() {
493
		super.addNotationalListeners();
494
		addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
495
	}
496
497
	/**
498
	 * @generated
499
	 */
500
	protected void removeNotationalListeners() {
501
		super.removeNotationalListeners();
502
		removeListenerFilter("PrimaryView"); //$NON-NLS-1$
503
	}
504
505
	/**
506
	 * @generated
507
	 */
508
	protected void handleNotificationEvent(Notification event) {
509
		Object feature = event.getFeature();
510
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
511
			Integer c = (Integer) event.getNewValue();
512
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
513
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
514
			refreshUnderline();
515
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
516
			refreshStrikeThrough();
517
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
518
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
519
			refreshFont();
520
		} else {
521
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
522
				refreshLabel();
523
			}
524
			if (getParser() instanceof ISemanticParser) {
525
				ISemanticParser modelParser = (ISemanticParser) getParser();
526
				if (modelParser.areSemanticElementsAffected(null, event)) {
527
					removeSemanticListeners();
528
					if (resolveSemanticElement() != null) {
529
						addSemanticListeners();
530
					}
531
					refreshLabel();
532
				}
533
			}
534
		}
535
		super.handleNotificationEvent(event);
536
	}
537
538
	/**
539
	 * @generated
540
	 */
541
	protected IFigure createFigure() {
542
		// Parent should assign one using setLabel method
543
		return null;
544
	}
545
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/CallOperationActionNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class CallOperationActionNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/FlowFinalNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class FlowFinalNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InputPinEditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class InputPinEditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/CreateObjectActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class CreateObjectActionEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/PinNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class PinNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLCreationWizardPage.java (+111 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import java.io.ByteArrayInputStream;
4
import java.io.InputStream;
5
6
import org.eclipse.core.resources.ResourcesPlugin;
7
import org.eclipse.core.runtime.IPath;
8
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.util.DiagramFileCreator;
9
import org.eclipse.jface.viewers.IStructuredSelection;
10
import org.eclipse.swt.widgets.Composite;
11
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
12
13
/**
14
 * @generated
15
 */
16
public class UMLCreationWizardPage extends WizardNewFileCreationPage {
17
18
	/**
19
	 * @generated
20
	 */
21
	private static final String DOMAIN_EXT = ".uml"; //$NON-NLS-1$
22
23
	/**
24
	 * @generated
25
	 */
26
	private static final String DIAGRAM_EXT = ".umlactivity_diagram"; //$NON-NLS-1$
27
28
	/**
29
	 * @generated
30
	 */
31
	public UMLCreationWizardPage(String pageName, IStructuredSelection selection) {
32
		super(pageName, selection);
33
	}
34
35
	/**
36
	 * @generated
37
	 */
38
	protected String getDefaultFileName() {
39
		return "default"; //$NON-NLS-1$
40
	}
41
42
	/**
43
	 * @generated
44
	 */
45
	public String getFileName() {
46
		String fileName = super.getFileName();
47
		if (fileName != null && !fileName.endsWith(DIAGRAM_EXT)) {
48
			fileName += DIAGRAM_EXT;
49
		}
50
		return fileName;
51
	}
52
53
	/**
54
	 * @generated
55
	 */
56
	private String getUniqueFileName(IPath containerPath, String fileName) {
57
		String newFileName = fileName;
58
		IPath diagramFilePath = containerPath.append(newFileName + DIAGRAM_EXT);
59
		IPath modelFilePath = containerPath.append(newFileName + DOMAIN_EXT);
60
		int i = 1;
61
		while (exists(diagramFilePath) || exists(modelFilePath)) {
62
			i++;
63
			newFileName = fileName + i;
64
			diagramFilePath = containerPath.append(newFileName + DIAGRAM_EXT);
65
			modelFilePath = containerPath.append(newFileName + DOMAIN_EXT);
66
		}
67
		return newFileName;
68
	}
69
70
	/**
71
	 * @generated
72
	 */
73
	public void createControl(Composite parent) {
74
		super.createControl(parent);
75
		IPath path = getContainerFullPath();
76
		if (path != null) {
77
			String fileName = getUniqueFileName(path, getDefaultFileName());
78
			setFileName(fileName);
79
		} else {
80
			setFileName(getDefaultFileName());
81
		}
82
		setPageComplete(validatePage());
83
	}
84
85
	/**
86
	 * @generated
87
	 */
88
	protected boolean validatePage() {
89
		if (super.validatePage()) {
90
			String fileName = getFileName();
91
			if (fileName == null) {
92
				return false;
93
			}
94
			fileName = fileName.substring(0, fileName.length() - DIAGRAM_EXT.length()) + DOMAIN_EXT;
95
			IPath path = getContainerFullPath().append(fileName);
96
			if (exists(path)) {
97
				setErrorMessage("Model file already exists: " + path.lastSegment());
98
				return false;
99
			}
100
			return true;
101
		}
102
		return false;
103
	}
104
105
	/**
106
	 * @generated
107
	 */
108
	public static boolean exists(IPath path) {
109
		return ResourcesPlugin.getWorkspace().getRoot().exists(path);
110
	}
111
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OpaqueActionViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class OpaqueActionViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(OpaqueActionNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)plugin.properties (+19 lines)
Added Link Here
1
pluginName=Activity Diagram Plugin
2
providerName=Eclipse
3
4
editorName=UMLActivity Diagram Editor
5
newWizardName=UMLActivity Diagram
6
newWizardDesc=Creates UMLActivity diagram.
7
8
initDiagramActionLabel=Initialize umlactivity_diagram diagram file
9
loadResourceActionLabel=Load Resource...
10
11
navigatorContentName=*.umlactivity_diagram diagram contents
12
###
13
# Property Sheet
14
15
tab.appearance=Appearance
16
tab.diagram=Rulers & Grid
17
tab.domain=Core
18
###
19
	
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OpaqueActionNameViewFactory.java (+29 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
8
import org.eclipse.gmf.runtime.notation.View;
9
10
/**
11
 * @generated
12
 */
13
public class OpaqueActionNameViewFactory extends BasicNodeViewFactory {
14
15
	/**
16
	 * @generated
17
	 */
18
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
19
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
20
	}
21
22
	/**
23
	 * @generated
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		return styles;
28
	}
29
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/OpaqueActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class OpaqueActionEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/DataStoreNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class DataStoreNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ObjectFlowItemSemanticEditPolicy.java (+18 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.gef.commands.Command;
4
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
5
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
6
7
/**
8
 * @generated
9
 */
10
public class ObjectFlowItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
11
12
	/**
13
	 * @generated
14
	 */
15
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
16
		return getMSLWrapper(new DestroyElementCommand(req));
17
	}
18
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/InputPin4EditPart.java (+304 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Iterator;
4
5
import org.eclipse.draw2d.IFigure;
6
import org.eclipse.draw2d.PositionConstants;
7
import org.eclipse.draw2d.StackLayout;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.EditPolicy;
10
import org.eclipse.gef.GraphicalEditPart;
11
import org.eclipse.gef.Request;
12
import org.eclipse.gef.commands.Command;
13
import org.eclipse.gef.editparts.LayerManager;
14
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
15
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
16
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
17
import org.eclipse.gef.requests.CreateRequest;
18
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
21
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
22
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
23
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
24
import org.eclipse.gmf.runtime.notation.View;
25
import org.eclipse.uml2.diagram.activity.edit.policies.InputPin4ItemSemanticEditPolicy;
26
import org.eclipse.uml2.diagram.activity.edit.policies.UMLExtNodeLabelHostLayoutEditPolicy;
27
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
28
29
/**
30
 * @generated
31
 */
32
public class InputPin4EditPart extends AbstractBorderItemEditPart {
33
34
	/**
35
	 * @generated
36
	 */
37
	public static final int VISUAL_ID = 3007;
38
39
	/**
40
	 * @generated
41
	 */
42
	protected IFigure contentPane;
43
44
	/**
45
	 * @generated
46
	 */
47
	protected IFigure primaryShape;
48
49
	/**
50
	 * @generated
51
	 */
52
	public InputPin4EditPart(View view) {
53
		super(view);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected void createDefaultEditPolicies() {
60
		super.createDefaultEditPolicies();
61
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
62
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPin4ItemSemanticEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected void decorateChild(EditPart child) {
74
				if (isExternalLabel(child)) {
75
					return;
76
				}
77
				super.decorateChild(child);
78
			}
79
80
			protected EditPolicy createChildEditPolicy(EditPart child) {
81
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
82
				if (result == null) {
83
					result = new NonResizableEditPolicy();
84
				}
85
				return result;
86
			}
87
88
			protected Command getMoveChildrenCommand(Request request) {
89
				return null;
90
			}
91
92
			protected Command getCreateCommand(CreateRequest request) {
93
				return null;
94
			}
95
		};
96
		UMLExtNodeLabelHostLayoutEditPolicy xlep = new UMLExtNodeLabelHostLayoutEditPolicy() {
97
98
			protected boolean isExternalLabel(EditPart editPart) {
99
				return InputPin4EditPart.this.isExternalLabel(editPart);
100
			}
101
		};
102
		xlep.setRealLayoutEditPolicy(lep);
103
		return xlep;
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	protected IFigure createNodeShape() {
110
		SmallSquareFigure figure = new SmallSquareFigure();
111
		return primaryShape = figure;
112
	}
113
114
	/**
115
	 * @generated
116
	 */
117
	public SmallSquareFigure getPrimaryShape() {
118
		return (SmallSquareFigure) primaryShape;
119
	}
120
121
	/**
122
	 * @generated 
123
	 */
124
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
125
		if (isExternalLabel(editPart)) {
126
			return getExternalLabelsContainer();
127
		}
128
129
		return super.getContentPaneFor(editPart);
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	protected NodeFigure createNodePlate() {
136
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
137
		//FIXME: workaround for #154536
138
		result.getBounds().setSize(result.getPreferredSize());
139
		return result;
140
	}
141
142
	/**
143
	 * @generated
144
	 */
145
	public EditPolicy getPrimaryDragEditPolicy() {
146
		EditPolicy result = super.getPrimaryDragEditPolicy();
147
		if (result instanceof ResizableEditPolicy) {
148
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
149
150
			ep.setResizeDirections(PositionConstants.NONE);
151
152
		}
153
		return result;
154
	}
155
156
	/**
157
	 * Creates figure for this edit part.
158
	 * 
159
	 * Body of this method does not depend on settings in generation model
160
	 * so you may safely remove <i>generated</i> tag and modify it.
161
	 * 
162
	 * @generated
163
	 */
164
	protected NodeFigure createNodeFigure() {
165
		NodeFigure figure = createNodePlate();
166
		figure.setLayoutManager(new StackLayout());
167
		IFigure shape = createNodeShape();
168
		figure.add(shape);
169
		contentPane = setupContentPane(shape);
170
		return figure;
171
	}
172
173
	/**
174
	 * Default implementation treats passed figure as content pane.
175
	 * Respects layout one may have set for generated figure.
176
	 * @param nodeShape instance of generated figure class
177
	 * @generated
178
	 */
179
	protected IFigure setupContentPane(IFigure nodeShape) {
180
		if (nodeShape.getLayoutManager() == null) {
181
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
182
			layout.setSpacing(getMapMode().DPtoLP(5));
183
			nodeShape.setLayoutManager(layout);
184
		}
185
		return nodeShape; // use nodeShape itself as contentPane
186
	}
187
188
	/**
189
	 * @generated
190
	 */
191
	public IFigure getContentPane() {
192
		if (contentPane != null) {
193
			return contentPane;
194
		}
195
		return super.getContentPane();
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public EditPart getPrimaryChildEditPart() {
202
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(InputPinName4EditPart.VISUAL_ID));
203
	}
204
205
	/**
206
	 * @generated
207
	 */
208
	protected boolean isExternalLabel(EditPart childEditPart) {
209
		if (childEditPart instanceof InputPinName4EditPart) {
210
			return true;
211
		}
212
		return false;
213
	}
214
215
	/**
216
	 * @generated
217
	 */
218
	protected IFigure getExternalLabelsContainer() {
219
		LayerManager root = (LayerManager) getRoot();
220
		return root.getLayer(UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER);
221
	}
222
223
	/**
224
	 * @generated
225
	 */
226
	protected void addChildVisual(EditPart childEditPart, int index) {
227
		if (isExternalLabel(childEditPart)) {
228
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
229
			getExternalLabelsContainer().add(labelFigure);
230
			return;
231
		}
232
		super.addChildVisual(childEditPart, -1);
233
	}
234
235
	/**
236
	 * @generated
237
	 */
238
	protected void removeChildVisual(EditPart childEditPart) {
239
		if (isExternalLabel(childEditPart)) {
240
			IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
241
			getExternalLabelsContainer().remove(labelFigure);
242
			return;
243
		}
244
		super.removeChildVisual(childEditPart);
245
	}
246
247
	/**
248
	 * @generated
249
	 */
250
	public void removeNotify() {
251
		for (Iterator it = getChildren().iterator(); it.hasNext();) {
252
			EditPart childEditPart = (EditPart) it.next();
253
			if (isExternalLabel(childEditPart)) {
254
				IFigure labelFigure = ((GraphicalEditPart) childEditPart).getFigure();
255
				getExternalLabelsContainer().remove(labelFigure);
256
			}
257
		}
258
		super.removeNotify();
259
	}
260
261
	/**
262
	 * @generated
263
	 */
264
	public class SmallSquareFigure extends org.eclipse.draw2d.RectangleFigure {
265
266
		/**
267
		 * @generated
268
		 */
269
		public SmallSquareFigure() {
270
271
			this.setPreferredSize(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15));
272
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
273
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(15), getMapMode().DPtoLP(15)));
274
			createContents();
275
		}
276
277
		/**
278
		 * @generated
279
		 */
280
		private void createContents() {
281
		}
282
283
		/**
284
		 * @generated
285
		 */
286
		private boolean myUseLocalCoordinates = false;
287
288
		/**
289
		 * @generated
290
		 */
291
		protected boolean useLocalCoordinates() {
292
			return myUseLocalCoordinates;
293
		}
294
295
		/**
296
		 * @generated
297
		 */
298
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
299
			myUseLocalCoordinates = useLocalCoordinates;
300
		}
301
302
	}
303
304
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/FlowFinalNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class FlowFinalNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InputPin5ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InputPin5ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/AcceptEventActionItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class AcceptEventActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/OutputPin2EditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class OutputPin2EditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-).project (+28 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.eclipse.uml2.diagram.activity</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.jdt.core.javanature</nature>
26
		<nature>org.eclipse.pde.PluginNature</nature>
27
	</natures>
28
</projectDescription>
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/OutputPinNameEditPart.java (+524 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import java.util.Collections;
4
import java.util.List;
5
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.geometry.Point;
9
import org.eclipse.emf.common.notify.Notification;
10
import org.eclipse.emf.ecore.EObject;
11
import org.eclipse.emf.transaction.RunnableWithResult;
12
import org.eclipse.gef.AccessibleEditPart;
13
import org.eclipse.gef.EditPolicy;
14
import org.eclipse.gef.Request;
15
import org.eclipse.gef.requests.DirectEditRequest;
16
import org.eclipse.gef.tools.DirectEditManager;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
18
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
19
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
20
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
21
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
22
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
23
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
24
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
25
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
26
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
27
import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
28
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
29
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
30
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
31
import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
32
import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
33
import org.eclipse.gmf.runtime.notation.FontStyle;
34
import org.eclipse.gmf.runtime.notation.NotationPackage;
35
import org.eclipse.gmf.runtime.notation.View;
36
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
37
import org.eclipse.jface.viewers.ICellEditorValidator;
38
import org.eclipse.swt.SWT;
39
import org.eclipse.swt.accessibility.AccessibleEvent;
40
import org.eclipse.swt.graphics.Color;
41
import org.eclipse.swt.graphics.FontData;
42
import org.eclipse.swt.graphics.Image;
43
import org.eclipse.uml2.diagram.activity.edit.policies.UMLTextSelectionEditPolicy;
44
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
45
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
46
47
/**
48
 * @generated
49
 */
50
public class OutputPinNameEditPart extends UMLExtNodeLabelEditPart implements ITextAwareEditPart {
51
52
	/**
53
	 * @generated
54
	 */
55
	public static final int VISUAL_ID = 5003;
56
57
	/**
58
	 * @generated
59
	 */
60
	private DirectEditManager manager;
61
62
	/**
63
	 * @generated
64
	 */
65
	private IParser parser;
66
67
	/**
68
	 * @generated
69
	 */
70
	private List parserElements;
71
72
	/**
73
	 * @generated
74
	 */
75
	private String defaultText;
76
77
	/**
78
	 * @generated
79
	 */
80
	static {
81
		registerSnapBackPosition(UMLVisualIDRegistry.getType(OutputPinNameEditPart.VISUAL_ID), new Point(0, 0));
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public OutputPinNameEditPart(View view) {
88
		super(view);
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	protected void createDefaultEditPolicies() {
95
		super.createDefaultEditPolicies();
96
		installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
97
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected String getLabelTextHelper(IFigure figure) {
104
		if (figure instanceof WrapLabel) {
105
			return ((WrapLabel) figure).getText();
106
		} else {
107
			return ((Label) figure).getText();
108
		}
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	protected void setLabelTextHelper(IFigure figure, String text) {
115
		if (figure instanceof WrapLabel) {
116
			((WrapLabel) figure).setText(text);
117
		} else {
118
			((Label) figure).setText(text);
119
		}
120
	}
121
122
	/**
123
	 * @generated
124
	 */
125
	protected Image getLabelIconHelper(IFigure figure) {
126
		if (figure instanceof WrapLabel) {
127
			return ((WrapLabel) figure).getIcon();
128
		} else {
129
			return ((Label) figure).getIcon();
130
		}
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected void setLabelIconHelper(IFigure figure, Image icon) {
137
		if (figure instanceof WrapLabel) {
138
			((WrapLabel) figure).setIcon(icon);
139
		} else {
140
			((Label) figure).setIcon(icon);
141
		}
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public void setLabel(IFigure figure) {
148
		unregisterVisuals();
149
		setFigure(figure);
150
		defaultText = getLabelTextHelper(figure);
151
		registerVisuals();
152
		refreshVisuals();
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected List getModelChildren() {
159
		return Collections.EMPTY_LIST;
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
166
		return null;
167
	}
168
169
	/**
170
	 * @generated
171
	 */
172
	protected EObject getParserElement() {
173
		EObject element = resolveSemanticElement();
174
		return element != null ? element : (View) getModel();
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Image getLabelIcon() {
181
		return null;
182
	}
183
184
	/**
185
	 * @generated
186
	 */
187
	protected String getLabelText() {
188
		String text = null;
189
		if (getParser() != null) {
190
			text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
191
		}
192
		if (text == null || text.length() == 0) {
193
			text = defaultText;
194
		}
195
		return text;
196
	}
197
198
	/**
199
	 * @generated
200
	 */
201
	public void setLabelText(String text) {
202
		setLabelTextHelper(getFigure(), text);
203
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
204
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
205
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
206
		}
207
	}
208
209
	/**
210
	 * @generated
211
	 */
212
	public String getEditText() {
213
		if (getParser() == null) {
214
			return ""; //$NON-NLS-1$
215
		}
216
		return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
217
	}
218
219
	/**
220
	 * @generated
221
	 */
222
	protected boolean isEditable() {
223
		return getEditText() != null;
224
	}
225
226
	/**
227
	 * @generated
228
	 */
229
	public ICellEditorValidator getEditTextValidator() {
230
		return new ICellEditorValidator() {
231
232
			public String isValid(final Object value) {
233
				if (value instanceof String) {
234
					final EObject element = getParserElement();
235
					final IParser parser = getParser();
236
					try {
237
						IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
238
239
							public void run() {
240
								setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
241
							}
242
						});
243
						return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
244
					} catch (InterruptedException ie) {
245
						ie.printStackTrace();
246
					}
247
				}
248
249
				// shouldn't get here
250
				return null;
251
			}
252
		};
253
	}
254
255
	/**
256
	 * @generated
257
	 */
258
	public IContentAssistProcessor getCompletionProcessor() {
259
		if (getParser() == null) {
260
			return null;
261
		}
262
		return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
263
	}
264
265
	/**
266
	 * @generated
267
	 */
268
	public ParserOptions getParserOptions() {
269
		return ParserOptions.NONE;
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	public IParser getParser() {
276
		if (parser == null) {
277
			String parserHint = ((View) getModel()).getType();
278
			ParserHintAdapter hintAdapter = new ParserHintAdapter(getParserElement(), parserHint) {
279
280
				public Object getAdapter(Class adapter) {
281
					if (IElementType.class.equals(adapter)) {
282
						return UMLElementTypes.OutputPin_3001;
283
					}
284
					return super.getAdapter(adapter);
285
				}
286
			};
287
			parser = ParserService.getInstance().getParser(hintAdapter);
288
		}
289
		return parser;
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	protected DirectEditManager getManager() {
296
		if (manager == null) {
297
			setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this)));
298
		}
299
		return manager;
300
	}
301
302
	/**
303
	 * @generated
304
	 */
305
	protected void setManager(DirectEditManager manager) {
306
		this.manager = manager;
307
	}
308
309
	/**
310
	 * @generated
311
	 */
312
	protected void performDirectEdit() {
313
		getManager().show();
314
	}
315
316
	/**
317
	 * @generated
318
	 */
319
	protected void performDirectEdit(Point eventLocation) {
320
		if (getManager().getClass() == TextDirectEditManager.class) {
321
			((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
322
		}
323
	}
324
325
	/**
326
	 * @generated
327
	 */
328
	private void performDirectEdit(char initialCharacter) {
329
		if (getManager() instanceof TextDirectEditManager) {
330
			((TextDirectEditManager) getManager()).show(initialCharacter);
331
		} else {
332
			performDirectEdit();
333
		}
334
	}
335
336
	/**
337
	 * @generated
338
	 */
339
	protected void performDirectEditRequest(Request request) {
340
		final Request theRequest = request;
341
		try {
342
			getEditingDomain().runExclusive(new Runnable() {
343
344
				public void run() {
345
					if (isActive() && isEditable()) {
346
						if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
347
							Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
348
							performDirectEdit(initialChar.charValue());
349
						} else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
350
							DirectEditRequest editRequest = (DirectEditRequest) theRequest;
351
							performDirectEdit(editRequest.getLocation());
352
						} else {
353
							performDirectEdit();
354
						}
355
					}
356
				}
357
			});
358
		} catch (InterruptedException e) {
359
			e.printStackTrace();
360
		}
361
	}
362
363
	/**
364
	 * @generated
365
	 */
366
	protected void refreshVisuals() {
367
		super.refreshVisuals();
368
		refreshLabel();
369
		refreshFont();
370
		refreshFontColor();
371
		refreshUnderline();
372
		refreshStrikeThrough();
373
	}
374
375
	/**
376
	 * @generated
377
	 */
378
	protected void refreshLabel() {
379
		setLabelTextHelper(getFigure(), getLabelText());
380
		setLabelIconHelper(getFigure(), getLabelIcon());
381
		Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
382
		if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
383
			((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
384
		}
385
	}
386
387
	/**
388
	 * @generated
389
	 */
390
	protected void refreshUnderline() {
391
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
392
		if (style != null && getFigure() instanceof WrapLabel) {
393
			((WrapLabel) getFigure()).setTextUnderline(style.isUnderline());
394
		}
395
	}
396
397
	/**
398
	 * @generated
399
	 */
400
	protected void refreshStrikeThrough() {
401
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
402
		if (style != null && getFigure() instanceof WrapLabel) {
403
			((WrapLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	protected void refreshFont() {
411
		FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
412
		if (style != null) {
413
			FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
414
			setFont(fontData);
415
		}
416
	}
417
418
	/**
419
	 * @generated
420
	 */
421
	protected void setFontColor(Color color) {
422
		getFigure().setForegroundColor(color);
423
	}
424
425
	/**
426
	 * @generated
427
	 */
428
	protected void addSemanticListeners() {
429
		if (getParser() instanceof ISemanticParser) {
430
			EObject element = resolveSemanticElement();
431
			parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
432
			for (int i = 0; i < parserElements.size(); i++) {
433
				addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
434
			}
435
		} else {
436
			super.addSemanticListeners();
437
		}
438
	}
439
440
	/**
441
	 * @generated
442
	 */
443
	protected void removeSemanticListeners() {
444
		if (parserElements != null) {
445
			for (int i = 0; i < parserElements.size(); i++) {
446
				removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
447
			}
448
		} else {
449
			super.removeSemanticListeners();
450
		}
451
	}
452
453
	/**
454
	 * @generated
455
	 */
456
	protected AccessibleEditPart getAccessibleEditPart() {
457
		if (accessibleEP == null) {
458
			accessibleEP = new AccessibleGraphicalEditPart() {
459
460
				public void getName(AccessibleEvent e) {
461
					e.result = getLabelTextHelper(getFigure());
462
				}
463
			};
464
		}
465
		return accessibleEP;
466
	}
467
468
	/**
469
	 * @generated
470
	 */
471
	private View getFontStyleOwnerView() {
472
		return getPrimaryView();
473
	}
474
475
	/**
476
	 * @generated
477
	 */
478
	protected void handleNotificationEvent(Notification event) {
479
		Object feature = event.getFeature();
480
		if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
481
			Integer c = (Integer) event.getNewValue();
482
			setFontColor(DiagramColorRegistry.getInstance().getColor(c));
483
		} else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
484
			refreshUnderline();
485
		} else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
486
			refreshStrikeThrough();
487
		} else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
488
				|| NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
489
			refreshFont();
490
		} else {
491
			if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
492
				refreshLabel();
493
			}
494
			if (getParser() instanceof ISemanticParser) {
495
				ISemanticParser modelParser = (ISemanticParser) getParser();
496
				if (modelParser.areSemanticElementsAffected(null, event)) {
497
					removeSemanticListeners();
498
					if (resolveSemanticElement() != null) {
499
						addSemanticListeners();
500
					}
501
					refreshLabel();
502
				}
503
			}
504
		}
505
		super.handleNotificationEvent(event);
506
	}
507
508
	/**
509
	 * @generated
510
	 */
511
	protected IFigure createFigure() {
512
		IFigure label = createFigurePrim();
513
		defaultText = getLabelTextHelper(label);
514
		return label;
515
	}
516
517
	/**
518
	 * @generated
519
	 */
520
	protected IFigure createFigurePrim() {
521
		return new WrapLabel();
522
	}
523
524
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorContentProvider.java (+856 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.HashMap;
6
import java.util.HashSet;
7
import java.util.Iterator;
8
import java.util.List;
9
import java.util.Set;
10
11
import org.eclipse.core.resources.IFile;
12
import org.eclipse.emf.common.util.URI;
13
import org.eclipse.emf.ecore.resource.Resource;
14
import org.eclipse.emf.ecore.resource.ResourceSet;
15
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
16
import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
17
import org.eclipse.gmf.runtime.notation.Edge;
18
import org.eclipse.gmf.runtime.notation.Node;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.jface.viewers.Viewer;
21
import org.eclipse.ui.IMemento;
22
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
23
import org.eclipse.ui.navigator.ICommonContentProvider;
24
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart;
25
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart;
26
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
27
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart;
28
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
29
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
30
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
31
import org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart;
32
import org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart;
33
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
34
import org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart;
35
import org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart;
36
import org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart;
37
import org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart;
38
import org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart;
39
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
40
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
41
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
42
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
43
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
44
import org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart;
45
import org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart;
46
import org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart;
47
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
48
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
49
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
50
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
51
import org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart;
52
import org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart;
53
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
54
55
/**
56
 * @generated
57
 */
58
public class UMLNavigatorContentProvider implements ICommonContentProvider {
59
60
	/**
61
	 * @generated
62
	 */
63
	private static final Object[] EMPTY_ARRAY = new Object[0];
64
65
	/**
66
	 * @generated
67
	 */
68
	public void dispose() {
69
	}
70
71
	/**
72
	 * @generated
73
	 */
74
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
75
	}
76
77
	/**
78
	 * @generated
79
	 */
80
	public Object[] getElements(Object inputElement) {
81
		return getChildren(inputElement);
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	public Object[] getChildren(Object parentElement) {
88
		if (parentElement instanceof UMLAbstractNavigatorItem) {
89
			UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) parentElement;
90
			if (!ActivityEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
91
				return EMPTY_ARRAY;
92
			}
93
94
			if (abstractNavigatorItem instanceof UMLNavigatorItem) {
95
				UMLNavigatorItem navigatorItem = (UMLNavigatorItem) abstractNavigatorItem;
96
				switch (navigatorItem.getVisualID()) {
97
				case AcceptEventActionEditPart.VISUAL_ID: {
98
					Collection result = new ArrayList();
99
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
100
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
101
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
102
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
103
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
104
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
105
					if (!outgoinglinks.isEmpty()) {
106
						result.add(outgoinglinks);
107
					}
108
					if (!incominglinks.isEmpty()) {
109
						result.add(incominglinks);
110
					}
111
					return result.toArray();
112
				}
113
				case AcceptEventAction2EditPart.VISUAL_ID: {
114
					Collection result = new ArrayList();
115
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
116
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
117
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
118
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
119
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
120
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
121
					if (!outgoinglinks.isEmpty()) {
122
						result.add(outgoinglinks);
123
					}
124
					if (!incominglinks.isEmpty()) {
125
						result.add(incominglinks);
126
					}
127
					return result.toArray();
128
				}
129
				case ActivityFinalNodeEditPart.VISUAL_ID: {
130
					Collection result = new ArrayList();
131
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
132
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
133
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
134
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
135
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
136
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
137
					if (!outgoinglinks.isEmpty()) {
138
						result.add(outgoinglinks);
139
					}
140
					if (!incominglinks.isEmpty()) {
141
						result.add(incominglinks);
142
					}
143
					return result.toArray();
144
				}
145
				case DecisionNodeEditPart.VISUAL_ID: {
146
					Collection result = new ArrayList();
147
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
148
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
149
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
150
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
151
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
152
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
153
					if (!outgoinglinks.isEmpty()) {
154
						result.add(outgoinglinks);
155
					}
156
					if (!incominglinks.isEmpty()) {
157
						result.add(incominglinks);
158
					}
159
					return result.toArray();
160
				}
161
				case MergeNodeEditPart.VISUAL_ID: {
162
					Collection result = new ArrayList();
163
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
164
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
165
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
166
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
167
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
168
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
169
					if (!outgoinglinks.isEmpty()) {
170
						result.add(outgoinglinks);
171
					}
172
					if (!incominglinks.isEmpty()) {
173
						result.add(incominglinks);
174
					}
175
					return result.toArray();
176
				}
177
				case InitialNodeEditPart.VISUAL_ID: {
178
					Collection result = new ArrayList();
179
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
180
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
181
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
182
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
183
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
184
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
185
					if (!outgoinglinks.isEmpty()) {
186
						result.add(outgoinglinks);
187
					}
188
					if (!incominglinks.isEmpty()) {
189
						result.add(incominglinks);
190
					}
191
					return result.toArray();
192
				}
193
				case StructuredActivityNodeEditPart.VISUAL_ID: {
194
					Collection result = new ArrayList();
195
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
196
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
197
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
198
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
199
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
200
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
201
					if (!outgoinglinks.isEmpty()) {
202
						result.add(outgoinglinks);
203
					}
204
					if (!incominglinks.isEmpty()) {
205
						result.add(incominglinks);
206
					}
207
					return result.toArray();
208
				}
209
				case DataStoreNodeEditPart.VISUAL_ID: {
210
					Collection result = new ArrayList();
211
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
212
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
213
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
214
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
215
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
216
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
217
					if (!outgoinglinks.isEmpty()) {
218
						result.add(outgoinglinks);
219
					}
220
					if (!incominglinks.isEmpty()) {
221
						result.add(incominglinks);
222
					}
223
					return result.toArray();
224
				}
225
				case CentralBufferNodeEditPart.VISUAL_ID: {
226
					Collection result = new ArrayList();
227
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
228
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
229
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
230
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
231
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
232
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
233
					if (!outgoinglinks.isEmpty()) {
234
						result.add(outgoinglinks);
235
					}
236
					if (!incominglinks.isEmpty()) {
237
						result.add(incominglinks);
238
					}
239
					return result.toArray();
240
				}
241
				case OpaqueActionEditPart.VISUAL_ID: {
242
					Collection result = new ArrayList();
243
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(OutputPinEditPart.VISUAL_ID), navigatorItem));
244
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
245
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
246
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
247
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
248
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
249
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
250
					if (!outgoinglinks.isEmpty()) {
251
						result.add(outgoinglinks);
252
					}
253
					if (!incominglinks.isEmpty()) {
254
						result.add(incominglinks);
255
					}
256
					return result.toArray();
257
				}
258
				case FlowFinalNodeEditPart.VISUAL_ID: {
259
					Collection result = new ArrayList();
260
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
261
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
262
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
263
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
264
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
265
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
266
					if (!outgoinglinks.isEmpty()) {
267
						result.add(outgoinglinks);
268
					}
269
					if (!incominglinks.isEmpty()) {
270
						result.add(incominglinks);
271
					}
272
					return result.toArray();
273
				}
274
				case ForkNodeEditPart.VISUAL_ID: {
275
					Collection result = new ArrayList();
276
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
277
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
278
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
279
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
280
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
281
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
282
					if (!outgoinglinks.isEmpty()) {
283
						result.add(outgoinglinks);
284
					}
285
					if (!incominglinks.isEmpty()) {
286
						result.add(incominglinks);
287
					}
288
					return result.toArray();
289
				}
290
				case JoinNodeEditPart.VISUAL_ID: {
291
					Collection result = new ArrayList();
292
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
293
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
294
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
295
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
296
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
297
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
298
					if (!outgoinglinks.isEmpty()) {
299
						result.add(outgoinglinks);
300
					}
301
					if (!incominglinks.isEmpty()) {
302
						result.add(incominglinks);
303
					}
304
					return result.toArray();
305
				}
306
				case PinEditPart.VISUAL_ID: {
307
					Collection result = new ArrayList();
308
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
309
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
310
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
311
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
312
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
313
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
314
					if (!outgoinglinks.isEmpty()) {
315
						result.add(outgoinglinks);
316
					}
317
					if (!incominglinks.isEmpty()) {
318
						result.add(incominglinks);
319
					}
320
					return result.toArray();
321
				}
322
				case CreateObjectActionEditPart.VISUAL_ID: {
323
					Collection result = new ArrayList();
324
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(OutputPin2EditPart.VISUAL_ID), navigatorItem));
325
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
326
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
327
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
328
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
329
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
330
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
331
					if (!outgoinglinks.isEmpty()) {
332
						result.add(outgoinglinks);
333
					}
334
					if (!incominglinks.isEmpty()) {
335
						result.add(incominglinks);
336
					}
337
					return result.toArray();
338
				}
339
				case AddStructuralFeatureValueActionEditPart.VISUAL_ID: {
340
					Collection result = new ArrayList();
341
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPinEditPart.VISUAL_ID), navigatorItem));
342
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPin2EditPart.VISUAL_ID), navigatorItem));
343
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPin3EditPart.VISUAL_ID), navigatorItem));
344
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
345
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
346
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
347
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
348
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
349
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
350
					if (!outgoinglinks.isEmpty()) {
351
						result.add(outgoinglinks);
352
					}
353
					if (!incominglinks.isEmpty()) {
354
						result.add(incominglinks);
355
					}
356
					return result.toArray();
357
				}
358
				case CallBehaviorActionEditPart.VISUAL_ID: {
359
					Collection result = new ArrayList();
360
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), navigatorItem));
361
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), navigatorItem));
362
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
363
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
364
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
365
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
366
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
367
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
368
					if (!outgoinglinks.isEmpty()) {
369
						result.add(outgoinglinks);
370
					}
371
					if (!incominglinks.isEmpty()) {
372
						result.add(incominglinks);
373
					}
374
					return result.toArray();
375
				}
376
				case CallOperationActionEditPart.VISUAL_ID: {
377
					Collection result = new ArrayList();
378
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), navigatorItem));
379
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), navigatorItem));
380
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InputPin5EditPart.VISUAL_ID), navigatorItem));
381
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
382
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
383
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
384
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
385
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
386
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
387
					if (!outgoinglinks.isEmpty()) {
388
						result.add(outgoinglinks);
389
					}
390
					if (!incominglinks.isEmpty()) {
391
						result.add(incominglinks);
392
					}
393
					return result.toArray();
394
				}
395
				case OutputPinEditPart.VISUAL_ID: {
396
					Collection result = new ArrayList();
397
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
398
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
399
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
400
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
401
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
402
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
403
					if (!outgoinglinks.isEmpty()) {
404
						result.add(outgoinglinks);
405
					}
406
					if (!incominglinks.isEmpty()) {
407
						result.add(incominglinks);
408
					}
409
					return result.toArray();
410
				}
411
				case OutputPin2EditPart.VISUAL_ID: {
412
					Collection result = new ArrayList();
413
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
414
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
415
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
416
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
417
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
418
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
419
					if (!outgoinglinks.isEmpty()) {
420
						result.add(outgoinglinks);
421
					}
422
					if (!incominglinks.isEmpty()) {
423
						result.add(incominglinks);
424
					}
425
					return result.toArray();
426
				}
427
				case InputPinEditPart.VISUAL_ID: {
428
					Collection result = new ArrayList();
429
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
430
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
431
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
432
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
433
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
434
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
435
					if (!outgoinglinks.isEmpty()) {
436
						result.add(outgoinglinks);
437
					}
438
					if (!incominglinks.isEmpty()) {
439
						result.add(incominglinks);
440
					}
441
					return result.toArray();
442
				}
443
				case InputPin2EditPart.VISUAL_ID: {
444
					Collection result = new ArrayList();
445
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
446
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
447
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
448
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
449
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
450
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
451
					if (!outgoinglinks.isEmpty()) {
452
						result.add(outgoinglinks);
453
					}
454
					if (!incominglinks.isEmpty()) {
455
						result.add(incominglinks);
456
					}
457
					return result.toArray();
458
				}
459
				case InputPin3EditPart.VISUAL_ID: {
460
					Collection result = new ArrayList();
461
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
462
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
463
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
464
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
465
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
466
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
467
					if (!outgoinglinks.isEmpty()) {
468
						result.add(outgoinglinks);
469
					}
470
					if (!incominglinks.isEmpty()) {
471
						result.add(incominglinks);
472
					}
473
					return result.toArray();
474
				}
475
				case OutputPin3EditPart.VISUAL_ID: {
476
					Collection result = new ArrayList();
477
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
478
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
479
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
480
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
481
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
482
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
483
					if (!outgoinglinks.isEmpty()) {
484
						result.add(outgoinglinks);
485
					}
486
					if (!incominglinks.isEmpty()) {
487
						result.add(incominglinks);
488
					}
489
					return result.toArray();
490
				}
491
				case InputPin4EditPart.VISUAL_ID: {
492
					Collection result = new ArrayList();
493
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
494
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
495
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
496
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
497
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
498
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
499
					if (!outgoinglinks.isEmpty()) {
500
						result.add(outgoinglinks);
501
					}
502
					if (!incominglinks.isEmpty()) {
503
						result.add(incominglinks);
504
					}
505
					return result.toArray();
506
				}
507
				case InputPin5EditPart.VISUAL_ID: {
508
					Collection result = new ArrayList();
509
					UMLNavigatorGroup incominglinks = new UMLNavigatorGroup("incoming links", "icons/incomingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
510
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), false, incominglinks));
511
					UMLNavigatorGroup outgoinglinks = new UMLNavigatorGroup("outgoing links", "icons/outgoingLinksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
512
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), true, outgoinglinks));
513
					incominglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), false, incominglinks));
514
					outgoinglinks.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), true, outgoinglinks));
515
					if (!outgoinglinks.isEmpty()) {
516
						result.add(outgoinglinks);
517
					}
518
					if (!incominglinks.isEmpty()) {
519
						result.add(incominglinks);
520
					}
521
					return result.toArray();
522
				}
523
				case ActivityEditPart.VISUAL_ID: {
524
					Collection result = new ArrayList();
525
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(AcceptEventActionEditPart.VISUAL_ID), navigatorItem));
526
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(AcceptEventAction2EditPart.VISUAL_ID), navigatorItem));
527
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(ActivityFinalNodeEditPart.VISUAL_ID), navigatorItem));
528
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(DecisionNodeEditPart.VISUAL_ID), navigatorItem));
529
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(MergeNodeEditPart.VISUAL_ID), navigatorItem));
530
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(InitialNodeEditPart.VISUAL_ID), navigatorItem));
531
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(StructuredActivityNodeEditPart.VISUAL_ID), navigatorItem));
532
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(DataStoreNodeEditPart.VISUAL_ID), navigatorItem));
533
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(CentralBufferNodeEditPart.VISUAL_ID), navigatorItem));
534
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(OpaqueActionEditPart.VISUAL_ID), navigatorItem));
535
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(FlowFinalNodeEditPart.VISUAL_ID), navigatorItem));
536
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(ForkNodeEditPart.VISUAL_ID), navigatorItem));
537
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(JoinNodeEditPart.VISUAL_ID), navigatorItem));
538
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(PinEditPart.VISUAL_ID), navigatorItem));
539
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(CreateObjectActionEditPart.VISUAL_ID), navigatorItem));
540
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionEditPart.VISUAL_ID), navigatorItem));
541
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(CallBehaviorActionEditPart.VISUAL_ID), navigatorItem));
542
					result.addAll(getChildByType(navigatorItem.getView().getChildren(), UMLVisualIDRegistry.getType(CallOperationActionEditPart.VISUAL_ID), navigatorItem));
543
					UMLNavigatorGroup links = new UMLNavigatorGroup("links", "icons/linksNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
544
					links.addChildren(getViewByType(navigatorItem.getView().getDiagram().getEdges(), UMLVisualIDRegistry.getType(ControlFlowEditPart.VISUAL_ID), links));
545
					links.addChildren(getViewByType(navigatorItem.getView().getDiagram().getEdges(), UMLVisualIDRegistry.getType(ObjectFlowEditPart.VISUAL_ID), links));
546
					if (!links.isEmpty()) {
547
						result.add(links);
548
					}
549
					return result.toArray();
550
				}
551
				case ControlFlowEditPart.VISUAL_ID: {
552
					Collection result = new ArrayList();
553
					UMLNavigatorGroup target = new UMLNavigatorGroup("target", "icons/linkTargetNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
554
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventActionEditPart.VISUAL_ID), true, target));
555
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventAction2EditPart.VISUAL_ID), true, target));
556
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ActivityFinalNodeEditPart.VISUAL_ID), true, target));
557
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DecisionNodeEditPart.VISUAL_ID), true, target));
558
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(MergeNodeEditPart.VISUAL_ID), true, target));
559
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InitialNodeEditPart.VISUAL_ID), true, target));
560
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(StructuredActivityNodeEditPart.VISUAL_ID), true, target));
561
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DataStoreNodeEditPart.VISUAL_ID), true, target));
562
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CentralBufferNodeEditPart.VISUAL_ID), true, target));
563
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OpaqueActionEditPart.VISUAL_ID), true, target));
564
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(FlowFinalNodeEditPart.VISUAL_ID), true, target));
565
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ForkNodeEditPart.VISUAL_ID), true, target));
566
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(JoinNodeEditPart.VISUAL_ID), true, target));
567
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(PinEditPart.VISUAL_ID), true, target));
568
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CreateObjectActionEditPart.VISUAL_ID), true, target));
569
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionEditPart.VISUAL_ID), true, target));
570
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallBehaviorActionEditPart.VISUAL_ID), true, target));
571
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallOperationActionEditPart.VISUAL_ID), true, target));
572
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPinEditPart.VISUAL_ID), true, target));
573
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin2EditPart.VISUAL_ID), true, target));
574
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPinEditPart.VISUAL_ID), true, target));
575
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin2EditPart.VISUAL_ID), true, target));
576
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin3EditPart.VISUAL_ID), true, target));
577
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), true, target));
578
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), true, target));
579
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin5EditPart.VISUAL_ID), true, target));
580
					UMLNavigatorGroup source = new UMLNavigatorGroup("source", "icons/linkSourceNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
581
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventActionEditPart.VISUAL_ID), false, source));
582
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventAction2EditPart.VISUAL_ID), false, source));
583
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ActivityFinalNodeEditPart.VISUAL_ID), false, source));
584
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DecisionNodeEditPart.VISUAL_ID), false, source));
585
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(MergeNodeEditPart.VISUAL_ID), false, source));
586
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InitialNodeEditPart.VISUAL_ID), false, source));
587
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(StructuredActivityNodeEditPart.VISUAL_ID), false, source));
588
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DataStoreNodeEditPart.VISUAL_ID), false, source));
589
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CentralBufferNodeEditPart.VISUAL_ID), false, source));
590
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OpaqueActionEditPart.VISUAL_ID), false, source));
591
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(FlowFinalNodeEditPart.VISUAL_ID), false, source));
592
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ForkNodeEditPart.VISUAL_ID), false, source));
593
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(JoinNodeEditPart.VISUAL_ID), false, source));
594
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(PinEditPart.VISUAL_ID), false, source));
595
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CreateObjectActionEditPart.VISUAL_ID), false, source));
596
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionEditPart.VISUAL_ID), false, source));
597
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallBehaviorActionEditPart.VISUAL_ID), false, source));
598
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallOperationActionEditPart.VISUAL_ID), false, source));
599
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPinEditPart.VISUAL_ID), false, source));
600
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin2EditPart.VISUAL_ID), false, source));
601
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPinEditPart.VISUAL_ID), false, source));
602
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin2EditPart.VISUAL_ID), false, source));
603
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin3EditPart.VISUAL_ID), false, source));
604
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), false, source));
605
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), false, source));
606
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin5EditPart.VISUAL_ID), false, source));
607
					if (!target.isEmpty()) {
608
						result.add(target);
609
					}
610
					if (!source.isEmpty()) {
611
						result.add(source);
612
					}
613
					return result.toArray();
614
				}
615
				case ObjectFlowEditPart.VISUAL_ID: {
616
					Collection result = new ArrayList();
617
					UMLNavigatorGroup target = new UMLNavigatorGroup("target", "icons/linkTargetNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
618
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventActionEditPart.VISUAL_ID), true, target));
619
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventAction2EditPart.VISUAL_ID), true, target));
620
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ActivityFinalNodeEditPart.VISUAL_ID), true, target));
621
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DecisionNodeEditPart.VISUAL_ID), true, target));
622
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(MergeNodeEditPart.VISUAL_ID), true, target));
623
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InitialNodeEditPart.VISUAL_ID), true, target));
624
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(StructuredActivityNodeEditPart.VISUAL_ID), true, target));
625
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DataStoreNodeEditPart.VISUAL_ID), true, target));
626
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CentralBufferNodeEditPart.VISUAL_ID), true, target));
627
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OpaqueActionEditPart.VISUAL_ID), true, target));
628
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(FlowFinalNodeEditPart.VISUAL_ID), true, target));
629
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ForkNodeEditPart.VISUAL_ID), true, target));
630
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(JoinNodeEditPart.VISUAL_ID), true, target));
631
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(PinEditPart.VISUAL_ID), true, target));
632
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CreateObjectActionEditPart.VISUAL_ID), true, target));
633
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionEditPart.VISUAL_ID), true, target));
634
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallBehaviorActionEditPart.VISUAL_ID), true, target));
635
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallOperationActionEditPart.VISUAL_ID), true, target));
636
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPinEditPart.VISUAL_ID), true, target));
637
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin2EditPart.VISUAL_ID), true, target));
638
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPinEditPart.VISUAL_ID), true, target));
639
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin2EditPart.VISUAL_ID), true, target));
640
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin3EditPart.VISUAL_ID), true, target));
641
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), true, target));
642
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), true, target));
643
					target.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin5EditPart.VISUAL_ID), true, target));
644
					UMLNavigatorGroup source = new UMLNavigatorGroup("source", "icons/linkSourceNavigatorGroup.gif", ActivityEditPart.MODEL_ID, navigatorItem);
645
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventActionEditPart.VISUAL_ID), false, source));
646
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AcceptEventAction2EditPart.VISUAL_ID), false, source));
647
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ActivityFinalNodeEditPart.VISUAL_ID), false, source));
648
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DecisionNodeEditPart.VISUAL_ID), false, source));
649
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(MergeNodeEditPart.VISUAL_ID), false, source));
650
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InitialNodeEditPart.VISUAL_ID), false, source));
651
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(StructuredActivityNodeEditPart.VISUAL_ID), false, source));
652
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(DataStoreNodeEditPart.VISUAL_ID), false, source));
653
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CentralBufferNodeEditPart.VISUAL_ID), false, source));
654
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OpaqueActionEditPart.VISUAL_ID), false, source));
655
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(FlowFinalNodeEditPart.VISUAL_ID), false, source));
656
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(ForkNodeEditPart.VISUAL_ID), false, source));
657
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(JoinNodeEditPart.VISUAL_ID), false, source));
658
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(PinEditPart.VISUAL_ID), false, source));
659
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CreateObjectActionEditPart.VISUAL_ID), false, source));
660
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionEditPart.VISUAL_ID), false, source));
661
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallBehaviorActionEditPart.VISUAL_ID), false, source));
662
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(CallOperationActionEditPart.VISUAL_ID), false, source));
663
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPinEditPart.VISUAL_ID), false, source));
664
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin2EditPart.VISUAL_ID), false, source));
665
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPinEditPart.VISUAL_ID), false, source));
666
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin2EditPart.VISUAL_ID), false, source));
667
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin3EditPart.VISUAL_ID), false, source));
668
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(OutputPin3EditPart.VISUAL_ID), false, source));
669
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin4EditPart.VISUAL_ID), false, source));
670
					source.addChildren(getConnectedViews(navigatorItem.getView(), UMLVisualIDRegistry.getType(InputPin5EditPart.VISUAL_ID), false, source));
671
					if (!target.isEmpty()) {
672
						result.add(target);
673
					}
674
					if (!source.isEmpty()) {
675
						result.add(source);
676
					}
677
					return result.toArray();
678
				}
679
				}
680
			} else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
681
				UMLNavigatorGroup group = (UMLNavigatorGroup) parentElement;
682
				return group.getChildren();
683
			}
684
		} else if (parentElement instanceof IFile) {
685
			IFile file = (IFile) parentElement;
686
			AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) GMFEditingDomainFactory.INSTANCE.createEditingDomain();
687
			editingDomain.setResourceToReadOnlyMap(new HashMap() {
688
689
				public Object get(Object key) {
690
					if (!containsKey(key)) {
691
						put(key, Boolean.TRUE);
692
					}
693
					return super.get(key);
694
				}
695
			});
696
			ResourceSet resourceSet = editingDomain.getResourceSet();
697
698
			URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString());
699
			Resource resource = resourceSet.getResource(fileURI, true);
700
701
			Collection result = new ArrayList();
702
			result.addAll(getViewByType(resource.getContents(), ActivityEditPart.MODEL_ID, file));
703
			return result.toArray();
704
		}
705
		return EMPTY_ARRAY;
706
	}
707
708
	/**
709
	 * @generated
710
	 */
711
	public Object getParent(Object element) {
712
		if (element instanceof UMLAbstractNavigatorItem) {
713
			UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
714
			if (!ActivityEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
715
				return null;
716
			}
717
			return abstractNavigatorItem.getParent();
718
		}
719
		return null;
720
	}
721
722
	/**
723
	 * @generated
724
	 */
725
	public boolean hasChildren(Object element) {
726
		return element instanceof IFile || getChildren(element).length > 0;
727
	}
728
729
	/**
730
	 * @generated
731
	 */
732
	public void init(ICommonContentExtensionSite aConfig) {
733
	}
734
735
	/**
736
	 * @generated
737
	 */
738
	public void restoreState(IMemento aMemento) {
739
	}
740
741
	/**
742
	 * @generated
743
	 */
744
	public void saveState(IMemento aMemento) {
745
	}
746
747
	/**
748
	 * @generated
749
	 */
750
	private Collection getViewByType(Collection childViews, String type, Object parent) {
751
		Collection result = new ArrayList();
752
		for (Iterator it = childViews.iterator(); it.hasNext();) {
753
			Object next = it.next();
754
			if (false == next instanceof View) {
755
				continue;
756
			}
757
			View nextView = (View) next;
758
			if (type.equals(nextView.getType())) {
759
				result.add(new UMLNavigatorItem(nextView, parent));
760
			}
761
		}
762
		return result;
763
	}
764
765
	/**
766
	 * @generated
767
	 */
768
	private Collection getChildByType(Collection childViews, String type, Object parent) {
769
		Collection result = new ArrayList();
770
		List children = new ArrayList(childViews);
771
		for (int i = 0; i < children.size(); i++) {
772
			if (false == children.get(i) instanceof View) {
773
				continue;
774
			}
775
			View nextChild = (View) children.get(i);
776
			if (type.equals(nextChild.getType())) {
777
				result.add(new UMLNavigatorItem(nextChild, parent));
778
			} else if (!stopGettingChildren(nextChild, type)) {
779
				children.addAll(nextChild.getChildren());
780
			}
781
		}
782
		return result;
783
	}
784
785
	/**
786
	 * @generated
787
	 */
788
	private boolean stopGettingChildren(View child, String type) {
789
		return false;
790
	}
791
792
	/**
793
	 * @generated
794
	 */
795
	private Collection getConnectedViews(View rootView, String type, boolean isOutTarget, Object parent) {
796
		Collection result = new ArrayList();
797
		List connectedViews = new ArrayList();
798
		connectedViews.add(rootView);
799
		Set visitedViews = new HashSet();
800
		for (int i = 0; i < connectedViews.size(); i++) {
801
			View nextView = (View) connectedViews.get(i);
802
			if (visitedViews.contains(nextView)) {
803
				continue;
804
			}
805
			visitedViews.add(nextView);
806
			if (type.equals(nextView.getType()) && nextView != rootView) {
807
				result.add(new UMLNavigatorItem(nextView, parent));
808
			} else {
809
				if (isOutTarget && !stopGettingOutTarget(nextView, rootView, type)) {
810
					connectedViews.addAll(nextView.getSourceEdges());
811
					if (nextView instanceof Edge) {
812
						connectedViews.add(((Edge) nextView).getTarget());
813
					}
814
				}
815
				if (!isOutTarget && !stopGettingInSource(nextView, rootView, type)) {
816
					connectedViews.addAll(nextView.getTargetEdges());
817
					if (nextView instanceof Edge) {
818
						connectedViews.add(((Edge) nextView).getSource());
819
					}
820
				}
821
			}
822
		}
823
		return result;
824
	}
825
826
	/**
827
	 * @generated
828
	 */
829
	private boolean stopGettingInSource(View nextView, View rootView, String type) {
830
		return !isOneHopConnection(nextView, rootView);
831
	}
832
833
	/**
834
	 * @generated
835
	 */
836
	private boolean stopGettingOutTarget(View nextView, View rootView, String type) {
837
		return !isOneHopConnection(nextView, rootView);
838
	}
839
840
	/**
841
	 * @generated
842
	 */
843
	private boolean isOneHopConnection(View targetView, View sourceView) {
844
		if (sourceView == targetView) {
845
			return true;
846
		}
847
		if (sourceView instanceof Node) {
848
			return targetView instanceof Edge;
849
		}
850
		if (sourceView instanceof Edge) {
851
			return targetView instanceof Node;
852
		}
853
		return false;
854
	}
855
856
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/DataStoreNodeEditPart.java (+246 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
14
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
15
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
16
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
17
import org.eclipse.gmf.runtime.notation.View;
18
import org.eclipse.uml2.diagram.activity.edit.policies.DataStoreNodeItemSemanticEditPolicy;
19
20
/**
21
 * @generated
22
 */
23
public class DataStoreNodeEditPart extends ShapeNodeEditPart {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final int VISUAL_ID = 2008;
29
30
	/**
31
	 * @generated
32
	 */
33
	protected IFigure contentPane;
34
35
	/**
36
	 * @generated
37
	 */
38
	protected IFigure primaryShape;
39
40
	/**
41
	 * @generated
42
	 */
43
	public DataStoreNodeEditPart(View view) {
44
		super(view);
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	protected void createDefaultEditPolicies() {
51
		super.createDefaultEditPolicies();
52
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DataStoreNodeItemSemanticEditPolicy());
53
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
54
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected LayoutEditPolicy createLayoutEditPolicy() {
61
		LayoutEditPolicy lep = new LayoutEditPolicy() {
62
63
			protected EditPolicy createChildEditPolicy(EditPart child) {
64
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
65
				if (result == null) {
66
					result = new NonResizableEditPolicy();
67
				}
68
				return result;
69
			}
70
71
			protected Command getMoveChildrenCommand(Request request) {
72
				return null;
73
			}
74
75
			protected Command getCreateCommand(CreateRequest request) {
76
				return null;
77
			}
78
		};
79
		return lep;
80
	}
81
82
	/**
83
	 * @generated
84
	 */
85
	protected IFigure createNodeShape() {
86
		DataStoreFigure figure = new DataStoreFigure();
87
		return primaryShape = figure;
88
	}
89
90
	/**
91
	 * @generated
92
	 */
93
	public DataStoreFigure getPrimaryShape() {
94
		return (DataStoreFigure) primaryShape;
95
	}
96
97
	/**
98
	 * @generated
99
	 */
100
	protected NodeFigure createNodePlate() {
101
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
102
		return result;
103
	}
104
105
	/**
106
	 * Creates figure for this edit part.
107
	 * 
108
	 * Body of this method does not depend on settings in generation model
109
	 * so you may safely remove <i>generated</i> tag and modify it.
110
	 * 
111
	 * @generated
112
	 */
113
	protected NodeFigure createNodeFigure() {
114
		NodeFigure figure = createNodePlate();
115
		figure.setLayoutManager(new StackLayout());
116
		IFigure shape = createNodeShape();
117
		figure.add(shape);
118
		contentPane = setupContentPane(shape);
119
		return figure;
120
	}
121
122
	/**
123
	 * Default implementation treats passed figure as content pane.
124
	 * Respects layout one may have set for generated figure.
125
	 * @param nodeShape instance of generated figure class
126
	 * @generated
127
	 */
128
	protected IFigure setupContentPane(IFigure nodeShape) {
129
		if (nodeShape.getLayoutManager() == null) {
130
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
131
			layout.setSpacing(getMapMode().DPtoLP(5));
132
			nodeShape.setLayoutManager(layout);
133
		}
134
		return nodeShape; // use nodeShape itself as contentPane
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public IFigure getContentPane() {
141
		if (contentPane != null) {
142
			return contentPane;
143
		}
144
		return super.getContentPane();
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public class DataStoreFigure extends org.eclipse.draw2d.RectangleFigure {
151
152
		/**
153
		 * @generated
154
		 */
155
		public DataStoreFigure() {
156
157
			org.eclipse.draw2d.BorderLayout myGenLayoutManager = new org.eclipse.draw2d.BorderLayout();
158
159
			this.setLayoutManager(myGenLayoutManager);
160
161
			createContents();
162
		}
163
164
		/**
165
		 * @generated
166
		 */
167
		private void createContents() {
168
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
169
			fig_0.setText("\u00ABdatastore\u00BB");
170
171
			setFigureDataStore_fixed_datastore(fig_0);
172
173
			Object layData0 = org.eclipse.draw2d.BorderLayout.TOP;
174
175
			this.add(fig_0, layData0);
176
			org.eclipse.draw2d.RectangleFigure fig_1 = new org.eclipse.draw2d.RectangleFigure();
177
			fig_1.setFill(false);
178
			fig_1.setOutline(false);
179
180
			setFigureDataStoreFigure_ContentPane(fig_1);
181
182
			Object layData1 = org.eclipse.draw2d.BorderLayout.CENTER;
183
184
			this.add(fig_1, layData1);
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fDataStore_fixed_datastore;
191
192
		/**
193
		 * @generated
194
		 */
195
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureDataStore_fixed_datastore() {
196
			return fDataStore_fixed_datastore;
197
		}
198
199
		/**
200
		 * @generated
201
		 */
202
		private void setFigureDataStore_fixed_datastore(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
203
			fDataStore_fixed_datastore = fig;
204
		}
205
206
		/**
207
		 * @generated
208
		 */
209
		private org.eclipse.draw2d.RectangleFigure fDataStoreFigure_ContentPane;
210
211
		/**
212
		 * @generated
213
		 */
214
		public org.eclipse.draw2d.RectangleFigure getFigureDataStoreFigure_ContentPane() {
215
			return fDataStoreFigure_ContentPane;
216
		}
217
218
		/**
219
		 * @generated
220
		 */
221
		private void setFigureDataStoreFigure_ContentPane(org.eclipse.draw2d.RectangleFigure fig) {
222
			fDataStoreFigure_ContentPane = fig;
223
		}
224
225
		/**
226
		 * @generated
227
		 */
228
		private boolean myUseLocalCoordinates = false;
229
230
		/**
231
		 * @generated
232
		 */
233
		protected boolean useLocalCoordinates() {
234
			return myUseLocalCoordinates;
235
		}
236
237
		/**
238
		 * @generated
239
		 */
240
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
241
			myUseLocalCoordinates = useLocalCoordinates;
242
		}
243
244
	}
245
246
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/PinEditPart.java (+270 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.StackLayout;
5
import org.eclipse.gef.EditPart;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.Request;
8
import org.eclipse.gef.commands.Command;
9
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
10
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
11
import org.eclipse.gef.requests.CreateRequest;
12
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
15
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
16
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
17
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
18
import org.eclipse.gmf.runtime.notation.View;
19
import org.eclipse.uml2.diagram.activity.edit.policies.PinItemSemanticEditPolicy;
20
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
21
22
/**
23
 * @generated
24
 */
25
public class PinEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2014;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public PinEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PinItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		StandalonePinFigure figure = new StandalonePinFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public StandalonePinFigure getPrimaryShape() {
96
		return (StandalonePinFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated 
101
	 */
102
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
103
104
		return super.getContentPaneFor(editPart);
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	protected boolean addFixedChild(EditPart childEditPart) {
111
		if (childEditPart instanceof PinNameEditPart) {
112
			((PinNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureStandalonePinFigure_name());
113
			return true;
114
		}
115
		return false;
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	protected boolean removeFixedChild(EditPart childEditPart) {
122
		return false;
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	protected NodeFigure createNodePlate() {
129
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(70), getMapMode().DPtoLP(40));
130
		return result;
131
	}
132
133
	/**
134
	 * Creates figure for this edit part.
135
	 * 
136
	 * Body of this method does not depend on settings in generation model
137
	 * so you may safely remove <i>generated</i> tag and modify it.
138
	 * 
139
	 * @generated
140
	 */
141
	protected NodeFigure createNodeFigure() {
142
		NodeFigure figure = createNodePlate();
143
		figure.setLayoutManager(new StackLayout());
144
		IFigure shape = createNodeShape();
145
		figure.add(shape);
146
		contentPane = setupContentPane(shape);
147
		return figure;
148
	}
149
150
	/**
151
	 * Default implementation treats passed figure as content pane.
152
	 * Respects layout one may have set for generated figure.
153
	 * @param nodeShape instance of generated figure class
154
	 * @generated
155
	 */
156
	protected IFigure setupContentPane(IFigure nodeShape) {
157
		if (nodeShape.getLayoutManager() == null) {
158
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
159
			layout.setSpacing(getMapMode().DPtoLP(5));
160
			nodeShape.setLayoutManager(layout);
161
		}
162
		return nodeShape; // use nodeShape itself as contentPane
163
	}
164
165
	/**
166
	 * @generated
167
	 */
168
	public IFigure getContentPane() {
169
		if (contentPane != null) {
170
			return contentPane;
171
		}
172
		return super.getContentPane();
173
	}
174
175
	/**
176
	 * @generated
177
	 */
178
	public EditPart getPrimaryChildEditPart() {
179
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(PinNameEditPart.VISUAL_ID));
180
	}
181
182
	/**
183
	 * @generated
184
	 */
185
	protected void addChildVisual(EditPart childEditPart, int index) {
186
		if (addFixedChild(childEditPart)) {
187
			return;
188
		}
189
		super.addChildVisual(childEditPart, -1);
190
	}
191
192
	/**
193
	 * @generated
194
	 */
195
	protected void removeChildVisual(EditPart childEditPart) {
196
		if (removeFixedChild(childEditPart)) {
197
			return;
198
		}
199
		super.removeChildVisual(childEditPart);
200
	}
201
202
	/**
203
	 * @generated
204
	 */
205
	public class StandalonePinFigure extends org.eclipse.draw2d.RectangleFigure {
206
207
		/**
208
		 * @generated
209
		 */
210
		public StandalonePinFigure() {
211
212
			createContents();
213
		}
214
215
		/**
216
		 * @generated
217
		 */
218
		private void createContents() {
219
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
220
221
			fig_0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
222
223
			setFigureStandalonePinFigure_name(fig_0);
224
225
			Object layData0 = null;
226
227
			this.add(fig_0, layData0);
228
		}
229
230
		/**
231
		 * @generated
232
		 */
233
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fStandalonePinFigure_name;
234
235
		/**
236
		 * @generated
237
		 */
238
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureStandalonePinFigure_name() {
239
			return fStandalonePinFigure_name;
240
		}
241
242
		/**
243
		 * @generated
244
		 */
245
		private void setFigureStandalonePinFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
246
			fStandalonePinFigure_name = fig;
247
		}
248
249
		/**
250
		 * @generated
251
		 */
252
		private boolean myUseLocalCoordinates = false;
253
254
		/**
255
		 * @generated
256
		 */
257
		protected boolean useLocalCoordinates() {
258
			return myUseLocalCoordinates;
259
		}
260
261
		/**
262
		 * @generated
263
		 */
264
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
265
			myUseLocalCoordinates = useLocalCoordinates;
266
		}
267
268
	}
269
270
}
(-)icons/linkSourceNavigatorGroup.gif (+5 lines)
Added Link Here
1
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
2
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;Content-Type: image/gif
3
4
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
5
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;
(-)src/org/eclipse/uml2/diagram/activity/view/factories/OutputPin2ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class OutputPin2ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(OutputPinName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLAbstractParser.java (+377 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.text.MessageFormat;
4
import java.text.ParsePosition;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EClassifier;
8
import org.eclipse.emf.ecore.EDataType;
9
import org.eclipse.emf.ecore.EEnum;
10
import org.eclipse.emf.ecore.EEnumLiteral;
11
import org.eclipse.emf.ecore.EObject;
12
import org.eclipse.emf.ecore.EStructuralFeature;
13
import org.eclipse.gmf.runtime.common.core.command.ICommand;
14
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
15
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
16
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
17
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
18
import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
19
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
20
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
21
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
22
23
/**
24
 * @generated
25
 */
26
public abstract class UMLAbstractParser implements IParser {
27
28
	/**
29
	 * @generated
30
	 */
31
	private String viewPattern;
32
33
	/**
34
	 * @generated
35
	 */
36
	private MessageFormat viewProcessor;
37
38
	/**
39
	 * @generated
40
	 */
41
	private String editPattern;
42
43
	/**
44
	 * @generated
45
	 */
46
	private MessageFormat editProcessor;
47
48
	/**
49
	 * @generated
50
	 */
51
	public String getViewPattern() {
52
		return viewPattern;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	protected MessageFormat getViewProcessor() {
59
		return viewProcessor;
60
	}
61
62
	/**
63
	 * @generated
64
	 */
65
	public void setViewPattern(String viewPattern) {
66
		this.viewPattern = viewPattern;
67
		viewProcessor = createViewProcessor(viewPattern);
68
	}
69
70
	/**
71
	 * @generated
72
	 */
73
	protected MessageFormat createViewProcessor(String viewPattern) {
74
		return new MessageFormat(viewPattern);
75
	}
76
77
	/**
78
	 * @generated
79
	 */
80
	public String getEditPattern() {
81
		return editPattern;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected MessageFormat getEditProcessor() {
88
		return editProcessor;
89
	}
90
91
	/**
92
	 * @generated
93
	 */
94
	public void setEditPattern(String editPattern) {
95
		this.editPattern = editPattern;
96
		editProcessor = createEditProcessor(editPattern);
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected MessageFormat createEditProcessor(String editPattern) {
103
		return new MessageFormat(editPattern);
104
	}
105
106
	/**
107
	 * @generated
108
	 */
109
	public String getPrintString(IAdaptable adapter, int flags) {
110
		return getStringByPattern(adapter, flags, getViewPattern(), getViewProcessor());
111
	}
112
113
	/**
114
	 * @generated
115
	 */
116
	public String getEditString(IAdaptable adapter, int flags) {
117
		return getStringByPattern(adapter, flags, getEditPattern(), getEditProcessor());
118
	}
119
120
	/**
121
	 * @generated
122
	 */
123
	protected abstract String getStringByPattern(IAdaptable adapter, int flags, String pattern, MessageFormat processor);
124
125
	/**
126
	 * @generated
127
	 */
128
	public IParserEditStatus isValidEditString(IAdaptable element, String editString) {
129
		ParsePosition pos = new ParsePosition(0);
130
		Object[] values = getEditProcessor().parse(editString, pos);
131
		if (values == null) {
132
			return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, "Invalid input at " + pos.getErrorIndex());
133
		}
134
		return validateNewValues(values);
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	protected IParserEditStatus validateNewValues(Object[] values) {
141
		return ParserEditStatus.EDITABLE_STATUS;
142
	}
143
144
	/**
145
	 * @generated
146
	 */
147
	public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
148
		Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
149
		if (values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
150
			return UnexecutableCommand.INSTANCE;
151
		}
152
		return getParseCommand(adapter, values);
153
	}
154
155
	/**
156
	 * @generated
157
	 */
158
	protected abstract ICommand getParseCommand(IAdaptable adapter, Object[] values);
159
160
	/**
161
	 * @generated
162
	 */
163
	public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
164
		return null;
165
	}
166
167
	/**
168
	 * @generated
169
	 */
170
	protected ICommand getModificationCommand(EObject element, EStructuralFeature feature, Object value) {
171
		value = getValidNewValue(feature, value);
172
		if (value instanceof InvalidValue) {
173
			return UnexecutableCommand.INSTANCE;
174
		}
175
		SetRequest request = new SetRequest(element, feature, value);
176
		return new SetValueCommand(request);
177
	}
178
179
	/**
180
	 * @generated
181
	 */
182
	protected Object getValidValue(EStructuralFeature feature, Object value) {
183
		EClassifier type = feature.getEType();
184
		if (type instanceof EDataType) {
185
			Class iClass = type.getInstanceClass();
186
			if (String.class.equals(iClass)) {
187
				if (value == null) {
188
					value = ""; //$NON-NLS-1$
189
				}
190
			}
191
		}
192
		return value;
193
	}
194
195
	/**
196
	 * @generated
197
	 */
198
	protected Object getValidNewValue(EStructuralFeature feature, Object value) {
199
		EClassifier type = feature.getEType();
200
		if (type instanceof EDataType) {
201
			Class iClass = type.getInstanceClass();
202
			if (Boolean.TYPE.equals(iClass)) {
203
				if (value instanceof Boolean) {
204
					// ok
205
				} else if (value instanceof String) {
206
					value = Boolean.valueOf((String) value);
207
				} else {
208
					value = new InvalidValue("Value of type Boolean is expected");
209
				}
210
			} else if (Character.TYPE.equals(iClass)) {
211
				if (value instanceof Character) {
212
					// ok
213
				} else if (value instanceof String) {
214
					String s = (String) value;
215
					if (s.length() == 0) {
216
						value = null;
217
					} else {
218
						value = new Character(s.charAt(0));
219
					}
220
				} else {
221
					value = new InvalidValue("Value of type Character is expected");
222
				}
223
			} else if (Byte.TYPE.equals(iClass)) {
224
				if (value instanceof Byte) {
225
					// ok
226
				} else if (value instanceof Number) {
227
					value = new Byte(((Number) value).byteValue());
228
				} else if (value instanceof String) {
229
					String s = (String) value;
230
					if (s.length() == 0) {
231
						value = null;
232
					} else {
233
						try {
234
							value = Byte.valueOf(s);
235
						} catch (NumberFormatException nfe) {
236
							value = new InvalidValue("String value does not convert to Byte value");
237
						}
238
					}
239
				} else {
240
					value = new InvalidValue("Value of type Byte is expected");
241
				}
242
			} else if (Short.TYPE.equals(iClass)) {
243
				if (value instanceof Short) {
244
					// ok
245
				} else if (value instanceof Number) {
246
					value = new Short(((Number) value).shortValue());
247
				} else if (value instanceof String) {
248
					String s = (String) value;
249
					if (s.length() == 0) {
250
						value = null;
251
					} else {
252
						try {
253
							value = Short.valueOf(s);
254
						} catch (NumberFormatException nfe) {
255
							value = new InvalidValue("String value does not convert to Short value");
256
						}
257
					}
258
				} else {
259
					value = new InvalidValue("Value of type Short is expected");
260
				}
261
			} else if (Integer.TYPE.equals(iClass)) {
262
				if (value instanceof Integer) {
263
					// ok
264
				} else if (value instanceof Number) {
265
					value = new Integer(((Number) value).intValue());
266
				} else if (value instanceof String) {
267
					String s = (String) value;
268
					if (s.length() == 0) {
269
						value = null;
270
					} else {
271
						try {
272
							value = Integer.valueOf(s);
273
						} catch (NumberFormatException nfe) {
274
							value = new InvalidValue("String value does not convert to Integer value");
275
						}
276
					}
277
				} else {
278
					value = new InvalidValue("Value of type Integer is expected");
279
				}
280
			} else if (Long.TYPE.equals(iClass)) {
281
				if (value instanceof Long) {
282
					// ok
283
				} else if (value instanceof Number) {
284
					value = new Long(((Number) value).longValue());
285
				} else if (value instanceof String) {
286
					String s = (String) value;
287
					if (s.length() == 0) {
288
						value = null;
289
					} else {
290
						try {
291
							value = Long.valueOf(s);
292
						} catch (NumberFormatException nfe) {
293
							value = new InvalidValue("String value does not convert to Long value");
294
						}
295
					}
296
				} else {
297
					value = new InvalidValue("Value of type Long is expected");
298
				}
299
			} else if (Float.TYPE.equals(iClass)) {
300
				if (value instanceof Float) {
301
					// ok
302
				} else if (value instanceof Number) {
303
					value = new Float(((Number) value).floatValue());
304
				} else if (value instanceof String) {
305
					String s = (String) value;
306
					if (s.length() == 0) {
307
						value = null;
308
					} else {
309
						try {
310
							value = Float.valueOf(s);
311
						} catch (NumberFormatException nfe) {
312
							value = new InvalidValue("String value does not convert to Float value");
313
						}
314
					}
315
				} else {
316
					value = new InvalidValue("Value of type Float is expected");
317
				}
318
			} else if (Double.TYPE.equals(iClass)) {
319
				if (value instanceof Double) {
320
					// ok
321
				} else if (value instanceof Number) {
322
					value = new Double(((Number) value).doubleValue());
323
				} else if (value instanceof String) {
324
					String s = (String) value;
325
					if (s.length() == 0) {
326
						value = null;
327
					} else {
328
						try {
329
							value = Double.valueOf(s);
330
						} catch (NumberFormatException nfe) {
331
							value = new InvalidValue("String value does not convert to Double value");
332
						}
333
					}
334
				} else {
335
					value = new InvalidValue("Value of type Double is expected");
336
				}
337
			} else if (type instanceof EEnum) {
338
				if (value instanceof String) {
339
					EEnumLiteral literal = ((EEnum) type).getEEnumLiteralByLiteral((String) value);
340
					if (literal == null) {
341
						value = new InvalidValue("Unknown literal: " + value);
342
					} else {
343
						value = literal.getInstance();
344
					}
345
				} else {
346
					value = new InvalidValue("Value of type String is expected");
347
				}
348
			}
349
		}
350
		return value;
351
	}
352
353
	/**
354
	 * @generated
355
	 */
356
	protected class InvalidValue {
357
358
		/**
359
		 * @generated
360
		 */
361
		private String description;
362
363
		/**
364
		 * @generated
365
		 */
366
		public InvalidValue(String description) {
367
			this.description = description;
368
		}
369
370
		/**
371
		 * @generated
372
		 */
373
		public String toString() {
374
			return description;
375
		}
376
	}
377
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InitialNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class InitialNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLPaletteProvider.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.util.Map;
4
5
import org.eclipse.core.runtime.IConfigurationElement;
6
import org.eclipse.gef.palette.PaletteRoot;
7
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
8
import org.eclipse.gmf.runtime.common.core.service.IOperation;
9
import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider;
10
import org.eclipse.ui.IEditorPart;
11
import org.eclipse.uml2.diagram.activity.part.UMLPaletteFactory;
12
13
/**
14
 * @generated
15
 */
16
public class UMLPaletteProvider extends AbstractProvider implements IPaletteProvider {
17
18
	/**
19
	 * @generated
20
	 */
21
	public void contributeToPalette(IEditorPart editor, Object content, PaletteRoot root, Map predefinedEntries) {
22
		UMLPaletteFactory factory = new UMLPaletteFactory();
23
		factory.fillPalette(root);
24
	}
25
26
	/**
27
	 * @generated
28
	 */
29
	public void setContributions(IConfigurationElement configElement) {
30
		// no configuration
31
	}
32
33
	/**
34
	 * @generated
35
	 */
36
	public boolean provides(IOperation operation) {
37
		return false; // all logic is done in the service
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/ActivityFinalNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class ActivityFinalNodeEditHelper extends UMLBaseEditHelper {
7
}
(-).cvsignore (+2 lines)
Added Link Here
1
bin
2
.settings
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/ObjectFlowEditPart.java (+79 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.Connection;
4
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
5
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
6
import org.eclipse.gmf.runtime.notation.View;
7
import org.eclipse.uml2.diagram.activity.edit.policies.ObjectFlowItemSemanticEditPolicy;
8
9
/**
10
 * @generated
11
 */
12
public class ObjectFlowEditPart extends ConnectionNodeEditPart {
13
14
	/**
15
	 * @generated
16
	 */
17
	public static final int VISUAL_ID = 4002;
18
19
	/**
20
	 * @generated
21
	 */
22
	public ObjectFlowEditPart(View view) {
23
		super(view);
24
	}
25
26
	/**
27
	 * @generated
28
	 */
29
	protected void createDefaultEditPolicies() {
30
		super.createDefaultEditPolicies();
31
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ObjectFlowItemSemanticEditPolicy());
32
33
	}
34
35
	/**
36
	 * Creates figure for this edit part.
37
	 * 
38
	 * Body of this method does not depend on settings in generation model
39
	 * so you may safely remove <i>generated</i> tag and modify it.
40
	 * 
41
	 * @generated
42
	 */
43
	protected Connection createConnectionFigure() {
44
		return new ActivityEdgeConnection();
45
	}
46
47
	/**
48
	 * @generated
49
	 */
50
	public class ActivityEdgeConnection extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {
51
52
		/**
53
		 * @generated
54
		 */
55
		public ActivityEdgeConnection() {
56
			this.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
57
			setTargetDecoration(createTargetDecoration());
58
		}
59
60
		/**
61
		 * @generated
62
		 */
63
		private org.eclipse.draw2d.PolylineDecoration createTargetDecoration() {
64
			org.eclipse.draw2d.PolylineDecoration df = new org.eclipse.draw2d.PolylineDecoration();
65
			// dispatchNext?
66
67
			org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();
68
			pl.addPoint(-2, -1);
69
			pl.addPoint(0, 0);
70
			pl.addPoint(-2, 1);
71
			df.setTemplate(pl);
72
			df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
73
74
			return df;
75
		}
76
77
	}
78
79
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/InputPinItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class InputPinItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/expressions/UMLOCLFactory.java (+176 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.expressions;
2
3
import java.util.Collections;
4
import java.util.Iterator;
5
import java.util.Map;
6
7
import org.eclipse.core.runtime.IStatus;
8
import org.eclipse.emf.ecore.EClassifier;
9
import org.eclipse.emf.ecore.EEnum;
10
import org.eclipse.emf.ecore.EEnumLiteral;
11
import org.eclipse.emf.ecore.ETypedElement;
12
import org.eclipse.emf.ocl.expressions.ExpressionsFactory;
13
import org.eclipse.emf.ocl.expressions.OCLExpression;
14
import org.eclipse.emf.ocl.expressions.OperationCallExp;
15
import org.eclipse.emf.ocl.expressions.Variable;
16
import org.eclipse.emf.ocl.expressions.util.AbstractVisitor;
17
import org.eclipse.emf.ocl.helper.HelperUtil;
18
import org.eclipse.emf.ocl.helper.IOCLHelper;
19
import org.eclipse.emf.ocl.helper.OCLParsingException;
20
import org.eclipse.emf.ocl.parser.EcoreEnvironment;
21
import org.eclipse.emf.ocl.parser.EcoreEnvironmentFactory;
22
import org.eclipse.emf.ocl.parser.Environment;
23
import org.eclipse.emf.ocl.parser.EvaluationEnvironment;
24
import org.eclipse.emf.ocl.query.Query;
25
import org.eclipse.emf.ocl.query.QueryFactory;
26
import org.eclipse.emf.ocl.types.util.Types;
27
import org.eclipse.emf.ocl.utilities.PredefinedType;
28
29
/**
30
 * @generated 
31
 */
32
public class UMLOCLFactory {
33
34
	/**
35
	 * @generated 
36
	 */
37
	private UMLOCLFactory() {
38
	}
39
40
	/**
41
	 * @generated 
42
	 */
43
	public static UMLAbstractExpression getExpression(String body, EClassifier context, Map environment) {
44
		return new Expression(body, context, environment);
45
	}
46
47
	/**
48
	 * @generated 
49
	 */
50
	public static UMLAbstractExpression getExpression(String body, EClassifier context) {
51
		return getExpression(body, context, Collections.EMPTY_MAP);
52
	}
53
54
	/**
55
	 * @generated 
56
	 */
57
	private static class Expression extends UMLAbstractExpression {
58
59
		/**
60
		 * @generated 
61
		 */
62
		private Query query;
63
64
		/**
65
		 * @generated 
66
		 */
67
		public Expression(String body, EClassifier context, Map environment) {
68
			super(body, context, environment);
69
70
			IOCLHelper oclHelper = (environment.isEmpty()) ? HelperUtil.createOCLHelper() : HelperUtil.createOCLHelper(createCustomEnv(environment));
71
			oclHelper.setContext(context());
72
			try {
73
				OCLExpression oclExpression = oclHelper.createQuery(body);
74
				this.query = QueryFactory.eINSTANCE.createQuery(oclExpression);
75
			} catch (OCLParsingException e) {
76
				setStatus(IStatus.ERROR, e.getMessage(), e);
77
			}
78
		}
79
80
		/**
81
		 * @generated 
82
		 */
83
		protected Object doEvaluate(Object context, Map env) {
84
			if (query == null) {
85
				return null;
86
			}
87
			EvaluationEnvironment evalEnv = query.getEvaluationEnvironment();
88
			// init environment
89
			for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
90
				Map.Entry nextEntry = (Map.Entry) it.next();
91
				evalEnv.replace((String) nextEntry.getKey(), nextEntry.getValue());
92
			}
93
94
			try {
95
				initExtentMap(context);
96
				Object result = query.evaluate(context);
97
				return (result != Types.OCL_INVALID) ? result : null;
98
			} finally {
99
				evalEnv.clear();
100
				query.setExtentMap(Collections.EMPTY_MAP);
101
			}
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected Object performCast(Object value, ETypedElement targetType) {
108
			if (targetType.getEType() instanceof EEnum) {
109
				if (value instanceof EEnumLiteral) {
110
					EEnumLiteral literal = (EEnumLiteral) value;
111
					return (literal.getInstance() != null) ? literal.getInstance() : literal;
112
				}
113
			}
114
			return super.performCast(value, targetType);
115
		}
116
117
		/**
118
		 * @generated
119
		 */
120
		private void initExtentMap(Object context) {
121
			if (query == null || context == null) {
122
				return;
123
			}
124
			final Query queryToInit = query;
125
			final Object extentContext = context;
126
127
			queryToInit.setExtentMap(Collections.EMPTY_MAP);
128
			if (queryToInit.queryText() != null && queryToInit.queryText().indexOf("allInstances") >= 0) {
129
				AbstractVisitor visitior = new AbstractVisitor() {
130
131
					private boolean usesAllInstances = false;
132
133
					public Object visitOperationCallExp(OperationCallExp oc) {
134
						if (!usesAllInstances) {
135
							usesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();
136
							if (usesAllInstances) {
137
								queryToInit.setExtentMap(EcoreEnvironmentFactory.ECORE_INSTANCE.createExtentMap(extentContext));
138
							}
139
						}
140
						return super.visitOperationCallExp(oc);
141
					}
142
				};
143
				queryToInit.getExpression().accept(visitior);
144
			}
145
		}
146
147
		/**
148
		 * @generated 
149
		 */
150
		private static EcoreEnvironmentFactory createCustomEnv(Map environment) {
151
			final Map env = environment;
152
			return new EcoreEnvironmentFactory() {
153
154
				public Environment createClassifierContext(Object context) {
155
					Environment ecoreEnv = super.createClassifierContext(context);
156
					for (Iterator it = env.keySet().iterator(); it.hasNext();) {
157
						String varName = (String) it.next();
158
						EClassifier varType = (EClassifier) env.get(varName);
159
						ecoreEnv.addElement(varName, createVar(varName, varType), false);
160
					}
161
					return ecoreEnv;
162
				}
163
			};
164
		}
165
166
		/**
167
		 * @generated 
168
		 */
169
		private static Variable createVar(String name, EClassifier type) {
170
			Variable var = ExpressionsFactory.eINSTANCE.createVariable();
171
			var.setName(name);
172
			var.setType(EcoreEnvironment.getOCLType(type));
173
			return var;
174
		}
175
	}
176
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLAbstractNavigatorItem.java (+51 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.gmf.runtime.diagram.ui.properties.views.IReadOnlyDiagramPropertySheetPageContributor;
5
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
6
7
/**
8
 * @generated
9
 */
10
public abstract class UMLAbstractNavigatorItem implements IAdaptable {
11
12
	/**
13
	 * @generated
14
	 */
15
	private Object myParent;
16
17
	/**
18
	 * @generated
19
	 */
20
	protected UMLAbstractNavigatorItem(Object parent) {
21
		myParent = parent;
22
	}
23
24
	/**
25
	 * @generated
26
	 */
27
	abstract public String getModelID();
28
29
	/**
30
	 * @generated
31
	 */
32
	public Object getParent() {
33
		return myParent;
34
	}
35
36
	/**
37
	 * @generated
38
	 */
39
	public Object getAdapter(Class adapter) {
40
		if (ITabbedPropertySheetPageContributor.class.isAssignableFrom(adapter)) {
41
			return new ITabbedPropertySheetPageContributor() {
42
43
				public String getContributorId() {
44
					return "org.eclipse.uml2.diagram.activity";
45
				}
46
			};
47
		}
48
		return null;
49
	}
50
51
}
(-)icons/outgoingLinksNavigatorGroup.gif (+5 lines)
Added Link Here
1
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
2
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;Content-Type: image/gif
3
4
GIF89aÕÿÿ­r/‚GøØˆžf'øÐxøà˜øÐ€f>2èÆ”øè°èЈøðÈÿÿÿË6úöºøà øØ?Œ]Føè˜Ò«€üößãϹ´2àÀx­r+ðØ?¥l$yO@ž_­l$?R¼2ï߯¼…2Å6!ù,s@€pH,?È#âèh:‚¨T0ô4®
5
‹à‘?p©€Ñd¢Y`B‚¡‹p8G AØ%‚%HÁçW¶	_B†‰Š‹?’“’š??–B¥¦¥ B­®­©C³´µI·¸FA;
(-)src/org/eclipse/uml2/diagram/activity/view/factories/MergeNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class MergeNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/FlowFinalNodeEditPart.java (+269 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.editpolicies.ResizableEditPolicy;
13
import org.eclipse.gef.requests.CreateRequest;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
16
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
17
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
18
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
19
import org.eclipse.gmf.runtime.notation.View;
20
import org.eclipse.uml2.diagram.activity.edit.policies.FlowFinalNodeItemSemanticEditPolicy;
21
22
/**
23
 * @generated
24
 */
25
public class FlowFinalNodeEditPart extends ShapeNodeEditPart {
26
27
	/**
28
	 * @generated
29
	 */
30
	public static final int VISUAL_ID = 2011;
31
32
	/**
33
	 * @generated
34
	 */
35
	protected IFigure contentPane;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure primaryShape;
41
42
	/**
43
	 * @generated
44
	 */
45
	public FlowFinalNodeEditPart(View view) {
46
		super(view);
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	protected void createDefaultEditPolicies() {
53
		super.createDefaultEditPolicies();
54
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FlowFinalNodeItemSemanticEditPolicy());
55
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
56
57
	}
58
59
	/**
60
	 * @generated
61
	 */
62
	protected LayoutEditPolicy createLayoutEditPolicy() {
63
		LayoutEditPolicy lep = new LayoutEditPolicy() {
64
65
			protected EditPolicy createChildEditPolicy(EditPart child) {
66
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
67
				if (result == null) {
68
					result = new NonResizableEditPolicy();
69
				}
70
				return result;
71
			}
72
73
			protected Command getMoveChildrenCommand(Request request) {
74
				return null;
75
			}
76
77
			protected Command getCreateCommand(CreateRequest request) {
78
				return null;
79
			}
80
		};
81
		return lep;
82
	}
83
84
	/**
85
	 * @generated
86
	 */
87
	protected IFigure createNodeShape() {
88
		FlowFinalFigure figure = new FlowFinalFigure();
89
		return primaryShape = figure;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	public FlowFinalFigure getPrimaryShape() {
96
		return (FlowFinalFigure) primaryShape;
97
	}
98
99
	/**
100
	 * @generated
101
	 */
102
	protected NodeFigure createNodePlate() {
103
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23));
104
		return result;
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	public EditPolicy getPrimaryDragEditPolicy() {
111
		EditPolicy result = super.getPrimaryDragEditPolicy();
112
		if (result instanceof ResizableEditPolicy) {
113
			ResizableEditPolicy ep = (ResizableEditPolicy) result;
114
115
			ep.setResizeDirections(PositionConstants.NONE);
116
117
		}
118
		return result;
119
	}
120
121
	/**
122
	 * Creates figure for this edit part.
123
	 * 
124
	 * Body of this method does not depend on settings in generation model
125
	 * so you may safely remove <i>generated</i> tag and modify it.
126
	 * 
127
	 * @generated
128
	 */
129
	protected NodeFigure createNodeFigure() {
130
		NodeFigure figure = createNodePlate();
131
		figure.setLayoutManager(new StackLayout());
132
		IFigure shape = createNodeShape();
133
		figure.add(shape);
134
		contentPane = setupContentPane(shape);
135
		return figure;
136
	}
137
138
	/**
139
	 * Default implementation treats passed figure as content pane.
140
	 * Respects layout one may have set for generated figure.
141
	 * @param nodeShape instance of generated figure class
142
	 * @generated
143
	 */
144
	protected IFigure setupContentPane(IFigure nodeShape) {
145
		if (nodeShape.getLayoutManager() == null) {
146
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
147
			layout.setSpacing(getMapMode().DPtoLP(5));
148
			nodeShape.setLayoutManager(layout);
149
		}
150
		return nodeShape; // use nodeShape itself as contentPane
151
	}
152
153
	/**
154
	 * @generated
155
	 */
156
	public IFigure getContentPane() {
157
		if (contentPane != null) {
158
			return contentPane;
159
		}
160
		return super.getContentPane();
161
	}
162
163
	/**
164
	 * @generated
165
	 */
166
	public class FlowFinalFigure extends org.eclipse.draw2d.Ellipse {
167
168
		/**
169
		 * @generated
170
		 */
171
		public FlowFinalFigure() {
172
173
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
174
175
			this.setLayoutManager(myGenLayoutManager);
176
177
			this.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
178
			this.setPreferredSize(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23));
179
			this.setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23)));
180
			this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(23), getMapMode().DPtoLP(23)));
181
			createContents();
182
		}
183
184
		/**
185
		 * @generated
186
		 */
187
		private void createContents() {
188
			org.eclipse.draw2d.Polyline fig_0 = new org.eclipse.draw2d.Polyline();
189
190
			fig_0.addPoint(new org.eclipse.draw2d.geometry.Point(4, 4));
191
			fig_0.addPoint(new org.eclipse.draw2d.geometry.Point(19, 19));
192
193
			setFigureAux_FlowFinalFigure_BackSlash(fig_0);
194
195
			Object layData0 = null;
196
197
			this.add(fig_0, layData0);
198
			org.eclipse.draw2d.Polyline fig_1 = new org.eclipse.draw2d.Polyline();
199
200
			fig_1.addPoint(new org.eclipse.draw2d.geometry.Point(4, 19));
201
			fig_1.addPoint(new org.eclipse.draw2d.geometry.Point(19, 4));
202
203
			setFigureAux_FlowFinalFigure_Slash(fig_1);
204
205
			Object layData1 = null;
206
207
			this.add(fig_1, layData1);
208
		}
209
210
		/**
211
		 * @generated
212
		 */
213
		private org.eclipse.draw2d.Polyline fAux_FlowFinalFigure_BackSlash;
214
215
		/**
216
		 * @generated
217
		 */
218
		public org.eclipse.draw2d.Polyline getFigureAux_FlowFinalFigure_BackSlash() {
219
			return fAux_FlowFinalFigure_BackSlash;
220
		}
221
222
		/**
223
		 * @generated
224
		 */
225
		private void setFigureAux_FlowFinalFigure_BackSlash(org.eclipse.draw2d.Polyline fig) {
226
			fAux_FlowFinalFigure_BackSlash = fig;
227
		}
228
229
		/**
230
		 * @generated
231
		 */
232
		private org.eclipse.draw2d.Polyline fAux_FlowFinalFigure_Slash;
233
234
		/**
235
		 * @generated
236
		 */
237
		public org.eclipse.draw2d.Polyline getFigureAux_FlowFinalFigure_Slash() {
238
			return fAux_FlowFinalFigure_Slash;
239
		}
240
241
		/**
242
		 * @generated
243
		 */
244
		private void setFigureAux_FlowFinalFigure_Slash(org.eclipse.draw2d.Polyline fig) {
245
			fAux_FlowFinalFigure_Slash = fig;
246
		}
247
248
		/**
249
		 * @generated
250
		 */
251
		private boolean myUseLocalCoordinates = true;
252
253
		/**
254
		 * @generated
255
		 */
256
		protected boolean useLocalCoordinates() {
257
			return myUseLocalCoordinates;
258
		}
259
260
		/**
261
		 * @generated
262
		 */
263
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
264
			myUseLocalCoordinates = useLocalCoordinates;
265
		}
266
267
	}
268
269
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/StructuredActivityNodeViewFactory.java (+49 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
10
import org.eclipse.gmf.runtime.notation.NotationFactory;
11
import org.eclipse.gmf.runtime.notation.View;
12
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
13
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
14
15
/**
16
 * @generated
17
 */
18
public class StructuredActivityNodeViewFactory extends AbstractShapeViewFactory {
19
20
	/**
21
	 * @generated 
22
	 */
23
	protected List createStyles(View view) {
24
		List styles = new ArrayList();
25
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
26
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
27
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
28
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
29
		return styles;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
36
		if (semanticHint == null) {
37
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart.VISUAL_ID);
38
			view.setType(semanticHint);
39
		}
40
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
41
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
42
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
43
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
44
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
45
			view.getEAnnotations().add(shortcutAnnotation);
46
		}
47
	}
48
49
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPin2ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class InputPin2ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(InputPinName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/CreateObjectActionEditPart.java (+296 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.PositionConstants;
5
import org.eclipse.draw2d.StackLayout;
6
import org.eclipse.gef.EditPart;
7
import org.eclipse.gef.EditPolicy;
8
import org.eclipse.gef.Request;
9
import org.eclipse.gef.commands.Command;
10
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
11
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
12
import org.eclipse.gef.requests.CreateRequest;
13
import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart;
14
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
15
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
17
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
18
import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator;
19
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
20
import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
21
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
22
import org.eclipse.gmf.runtime.notation.View;
23
import org.eclipse.uml2.diagram.activity.edit.policies.CreateObjectActionCanonicalEditPolicy;
24
import org.eclipse.uml2.diagram.activity.edit.policies.CreateObjectActionItemSemanticEditPolicy;
25
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
26
27
/**
28
 * @generated
29
 */
30
public class CreateObjectActionEditPart extends AbstractBorderedShapeEditPart {
31
32
	/**
33
	 * @generated
34
	 */
35
	public static final int VISUAL_ID = 2015;
36
37
	/**
38
	 * @generated
39
	 */
40
	protected IFigure contentPane;
41
42
	/**
43
	 * @generated
44
	 */
45
	protected IFigure primaryShape;
46
47
	/**
48
	 * @generated
49
	 */
50
	public CreateObjectActionEditPart(View view) {
51
		super(view);
52
	}
53
54
	/**
55
	 * @generated
56
	 */
57
	protected void createDefaultEditPolicies() {
58
		installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
59
		super.createDefaultEditPolicies();
60
		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CreateObjectActionItemSemanticEditPolicy());
61
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
62
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new CreateObjectActionCanonicalEditPolicy());
63
		installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
64
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected LayoutEditPolicy createLayoutEditPolicy() {
71
		LayoutEditPolicy lep = new LayoutEditPolicy() {
72
73
			protected EditPolicy createChildEditPolicy(EditPart child) {
74
				EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
75
				if (result == null) {
76
					result = new NonResizableEditPolicy();
77
				}
78
				return result;
79
			}
80
81
			protected Command getMoveChildrenCommand(Request request) {
82
				return null;
83
			}
84
85
			protected Command getCreateCommand(CreateRequest request) {
86
				return null;
87
			}
88
		};
89
		return lep;
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	protected IFigure createNodeShape() {
96
		ActionBaseFigure figure = new ActionBaseFigure();
97
		return primaryShape = figure;
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	public ActionBaseFigure getPrimaryShape() {
104
		return (ActionBaseFigure) primaryShape;
105
	}
106
107
	/**
108
	 * @generated 
109
	 */
110
	protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
111
		if (editPart instanceof OutputPin2EditPart) {
112
			return getBorderedFigure().getBorderItemContainer();
113
		}
114
115
		return super.getContentPaneFor(editPart);
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	protected boolean addFixedChild(EditPart childEditPart) {
122
		if (childEditPart instanceof CreateObjectActionNameEditPart) {
123
			((CreateObjectActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureActionBaseFigure_name());
124
			return true;
125
		}
126
		if (childEditPart instanceof OutputPin2EditPart) {
127
			BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.EAST);
128
			getBorderedFigure().getBorderItemContainer().add(((OutputPin2EditPart) childEditPart).getFigure(), locator);
129
			return true;
130
		}
131
		return false;
132
	}
133
134
	/**
135
	 * @generated
136
	 */
137
	protected boolean removeFixedChild(EditPart childEditPart) {
138
		if (childEditPart instanceof OutputPin2EditPart) {
139
			getBorderedFigure().getBorderItemContainer().remove(((OutputPin2EditPart) childEditPart).getFigure());
140
			return true;
141
		}
142
		return false;
143
	}
144
145
	/**
146
	 * @generated
147
	 */
148
	protected NodeFigure createNodePlate() {
149
		DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(80), getMapMode().DPtoLP(50));
150
		return result;
151
	}
152
153
	/**
154
	 * Creates figure for this edit part.
155
	 * 
156
	 * Body of this method does not depend on settings in generation model
157
	 * so you may safely remove <i>generated</i> tag and modify it.
158
	 * 
159
	 * @generated
160
	 */
161
	protected NodeFigure createMainFigure() {
162
		NodeFigure figure = createNodePlate();
163
		figure.setLayoutManager(new StackLayout());
164
		IFigure shape = createNodeShape();
165
		figure.add(shape);
166
		contentPane = setupContentPane(shape);
167
		return figure;
168
	}
169
170
	/**
171
	 * Default implementation treats passed figure as content pane.
172
	 * Respects layout one may have set for generated figure.
173
	 * @param nodeShape instance of generated figure class
174
	 * @generated
175
	 */
176
	protected IFigure setupContentPane(IFigure nodeShape) {
177
		if (nodeShape.getLayoutManager() == null) {
178
			ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
179
			layout.setSpacing(getMapMode().DPtoLP(5));
180
			nodeShape.setLayoutManager(layout);
181
		}
182
		return nodeShape; // use nodeShape itself as contentPane
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	public IFigure getContentPane() {
189
		if (contentPane != null) {
190
			return contentPane;
191
		}
192
		return super.getContentPane();
193
	}
194
195
	/**
196
	 * @generated
197
	 */
198
	public EditPart getPrimaryChildEditPart() {
199
		return getChildBySemanticHint(UMLVisualIDRegistry.getType(CreateObjectActionNameEditPart.VISUAL_ID));
200
	}
201
202
	/**
203
	 * @generated
204
	 */
205
	protected void addChildVisual(EditPart childEditPart, int index) {
206
		if (addFixedChild(childEditPart)) {
207
			return;
208
		}
209
		super.addChildVisual(childEditPart, -1);
210
	}
211
212
	/**
213
	 * @generated
214
	 */
215
	protected void removeChildVisual(EditPart childEditPart) {
216
		if (removeFixedChild(childEditPart)) {
217
			return;
218
		}
219
		super.removeChildVisual(childEditPart);
220
	}
221
222
	/**
223
	 * @generated
224
	 */
225
	public class ActionBaseFigure extends org.eclipse.draw2d.RoundedRectangle {
226
227
		/**
228
		 * @generated
229
		 */
230
		public ActionBaseFigure() {
231
232
			org.eclipse.uml2.diagram.common.draw2d.CenterLayout myGenLayoutManager = new org.eclipse.uml2.diagram.common.draw2d.CenterLayout();
233
234
			this.setLayoutManager(myGenLayoutManager);
235
236
			this.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(16), getMapMode().DPtoLP(16)));
237
238
			createContents();
239
		}
240
241
		/**
242
		 * @generated
243
		 */
244
		private void createContents() {
245
			org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig_0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();
246
247
			fig_0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(0), getMapMode().DPtoLP(5), getMapMode().DPtoLP(0), getMapMode().DPtoLP(5)));
248
249
			setFigureActionBaseFigure_name(fig_0);
250
251
			Object layData0 = null;
252
253
			this.add(fig_0, layData0);
254
		}
255
256
		/**
257
		 * @generated
258
		 */
259
		private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fActionBaseFigure_name;
260
261
		/**
262
		 * @generated
263
		 */
264
		public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureActionBaseFigure_name() {
265
			return fActionBaseFigure_name;
266
		}
267
268
		/**
269
		 * @generated
270
		 */
271
		private void setFigureActionBaseFigure_name(org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fig) {
272
			fActionBaseFigure_name = fig;
273
		}
274
275
		/**
276
		 * @generated
277
		 */
278
		private boolean myUseLocalCoordinates = false;
279
280
		/**
281
		 * @generated
282
		 */
283
		protected boolean useLocalCoordinates() {
284
			return myUseLocalCoordinates;
285
		}
286
287
		/**
288
		 * @generated
289
		 */
290
		protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
291
			myUseLocalCoordinates = useLocalCoordinates;
292
		}
293
294
	}
295
296
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/AddStructuralFeatureValueActionEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class AddStructuralFeatureValueActionEditHelper extends UMLBaseEditHelper {
7
}
(-)plugin.xml (+827 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.0"?>
3
4
<plugin>
5
6
<!-- gmf generator persistent region begin -->
7
<!-- gmf generator persistent region end -->
8
9
   <extension point="org.eclipse.core.runtime.preferences">
10
      <initializer class="org.eclipse.uml2.diagram.activity.part.UMLDiagramPreferenceInitializer"/>
11
   </extension>
12
13
   <extension point="org.eclipse.team.core.fileTypes">
14
      <fileTypes
15
         type="text"
16
         extension="umlactivity_diagram">
17
      </fileTypes>
18
   </extension>
19
20
   <extension point="org.eclipse.emf.ecore.extension_parser">
21
      <parser
22
         type="umlactivity_diagram"
23
         class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
24
      </parser>
25
   </extension>
26
27
   <extension point="org.eclipse.ui.editors">
28
     <editor
29
        id="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID"
30
        name="%editorName"
31
        icon="icons/obj16/UMLDiagramFile.gif"
32
        extensions="umlactivity_diagram"
33
        default="true"
34
        class="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditor"
35
        matchingStrategy="org.eclipse.uml2.diagram.activity.part.UMLMatchingStrategy"
36
        contributorClass="org.eclipse.uml2.diagram.activity.part.UMLDiagramActionBarContributor">
37
     </editor>
38
   </extension>
39
40
   <extension point="org.eclipse.ui.newWizards">
41
  	  <wizard
42
  	     name="%newWizardName"
43
  	     icon="icons/obj16/UMLDiagramFile.gif"
44
  	     category="org.eclipse.ui.Examples"
45
  	     class="org.eclipse.uml2.diagram.activity.part.UMLCreationWizard"
46
  	     id="org.eclipse.uml2.diagram.activity.part.UMLCreationWizardID">
47
  	  	 <description>%newWizardDesc</description>  
48
      </wizard>
49
   </extension>
50
51
   <extension point="org.eclipse.ui.popupMenus">
52
      <objectContribution
53
            id="org.eclipse.uml2.diagram.activity.ui.objectContribution.IFile1"
54
            nameFilter="*.uml"
55
            objectClass="org.eclipse.core.resources.IFile">
56
         <action
57
               label="%initDiagramActionLabel"
58
               class="org.eclipse.uml2.diagram.activity.part.UMLInitDiagramFileAction"
59
               menubarPath="additions"
60
               enablesFor="1"
61
               id="org.eclipse.uml2.diagram.activity.part.UMLInitDiagramFileActionID">
62
         </action>
63
      </objectContribution>  
64
      <objectContribution
65
            adaptable="false"
66
            id="org.eclipse.uml2.diagram.activity.ui.objectContribution.ActivityEditPart2"
67
            objectClass="org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart">
68
         <action
69
               class="org.eclipse.uml2.diagram.activity.part.UMLLoadResourceAction"
70
               enablesFor="1"
71
               id="org.eclipse.uml2.diagram.activity.part.UMLLoadResourceActionID"
72
               label="%loadResourceActionLabel"
73
               menubarPath="additions">
74
         </action>
75
      </objectContribution>                      
76
  </extension>
77
78
   <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
79
      <contributionItemProvider
80
            class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider"
81
            checkPluginLoaded="false">
82
         <Priority name="Low"/>
83
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
84
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart"/>
85
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
86
         </popupContribution>
87
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
88
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart"/>
89
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
90
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
91
         </popupContribution>
92
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
93
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart"/>
94
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
95
         </popupContribution>
96
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
97
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart"/>
98
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
99
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
100
         </popupContribution>
101
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
102
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart"/>
103
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
104
         </popupContribution>
105
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
106
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart"/>
107
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
108
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
109
         </popupContribution>
110
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
111
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart"/>
112
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
113
         </popupContribution>
114
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
115
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart"/>
116
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
117
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
118
         </popupContribution>
119
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
120
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart"/>
121
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
122
         </popupContribution>
123
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
124
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart"/>
125
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
126
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
127
         </popupContribution>
128
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
129
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart"/>
130
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
131
         </popupContribution>
132
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
133
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart"/>
134
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
135
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
136
         </popupContribution>
137
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
138
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart"/>
139
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
140
         </popupContribution>
141
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
142
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart"/>
143
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
144
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
145
         </popupContribution>
146
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
147
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart"/>
148
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
149
         </popupContribution>
150
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
151
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart"/>
152
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
153
            <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
154
         </popupContribution>
155
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
156
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart"/>
157
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
158
         </popupContribution>
159
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
160
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart"/>
161
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
162
         </popupContribution>
163
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
164
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart"/>
165
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
166
         </popupContribution>
167
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
168
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart"/>
169
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
170
         </popupContribution>
171
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
172
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart"/>
173
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
174
         </popupContribution>
175
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
176
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart"/>
177
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
178
         </popupContribution>
179
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
180
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart"/>
181
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
182
         </popupContribution>
183
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
184
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart"/>
185
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
186
         </popupContribution>
187
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
188
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart"/>
189
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
190
         </popupContribution>
191
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
192
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart"/>
193
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
194
         </popupContribution>
195
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
196
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart"/>
197
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
198
         </popupContribution>
199
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
200
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart"/>
201
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
202
         </popupContribution>
203
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
204
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart"/>
205
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
206
         </popupContribution>
207
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
208
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart"/>
209
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
210
         </popupContribution>
211
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
212
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart"/>
213
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
214
         </popupContribution>
215
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
216
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart"/>
217
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
218
         </popupContribution>
219
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
220
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart"/>
221
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
222
         </popupContribution>
223
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
224
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart"/>
225
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
226
         </popupContribution>
227
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
228
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart"/>
229
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
230
         </popupContribution>
231
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
232
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart"/>
233
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
234
         </popupContribution>
235
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
236
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart"/>
237
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
238
         </popupContribution>
239
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
240
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart"/>
241
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
242
         </popupContribution>
243
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
244
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart"/>
245
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
246
         </popupContribution>
247
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
248
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart"/>
249
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
250
         </popupContribution>
251
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
252
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart"/>
253
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
254
         </popupContribution>
255
         <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
256
            <popupStructuredContributionCriteria objectClass="org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart"/>
257
            <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
258
         </popupContribution>
259
      </contributionItemProvider>
260
   </extension>
261
262
   <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders">
263
      <GlobalActionHandlerProvider
264
         class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider"
265
         id="UMLActivityPresentation">
266
         <Priority name="Lowest"/>
267
         <ViewId id="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID">
268
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
269
               <GlobalActionId actionId="delete"/>
270
            </ElementType>
271
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
272
               <GlobalActionId actionId="save"/>
273
            </ElementType>
274
         </ViewId>
275
      </GlobalActionHandlerProvider>
276
      <GlobalActionHandlerProvider
277
         class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
278
         id="UMLActivityPresentationIDE">
279
         <Priority name="Lowest"/>
280
         <ViewId id="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID">
281
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
282
               <GlobalActionId actionId="bookmark"/>
283
            </ElementType>
284
         </ViewId>
285
      </GlobalActionHandlerProvider>
286
      <GlobalActionHandlerProvider
287
            class="org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider"
288
            id="UMLActivityRender">
289
         <Priority name="Lowest"/>
290
         <ViewId id="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID">
291
            <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
292
               <GlobalActionId actionId="cut"/>
293
               <GlobalActionId actionId="copy"/>
294
               <GlobalActionId actionId="paste"/>
295
            </ElementType>
296
         </ViewId>
297
      </GlobalActionHandlerProvider>
298
   </extension>
299
300
   <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
301
      <viewProvider class="org.eclipse.uml2.diagram.activity.providers.UMLViewProvider">
302
         <Priority name="Lowest"/>
303
         <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="UMLActivity"/>
304
         <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints=""/>
305
         <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints=""/>
306
      </viewProvider>
307
   </extension>
308
309
   <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
310
      <editpartProvider class="org.eclipse.uml2.diagram.activity.providers.UMLEditPartProvider">
311
         <Priority name="Lowest"/>
312
      </editpartProvider>
313
   </extension>
314
315
   <extension point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
316
      <paletteProvider class="org.eclipse.uml2.diagram.activity.providers.UMLPaletteProvider">
317
         <Priority name="Lowest"/>
318
         <editor id="org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID"/>
319
      </paletteProvider>
320
   </extension>
321
322
   <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders">
323
      <modelingAssistantProvider class="org.eclipse.uml2.diagram.activity.providers.UMLModelingAssistantProvider">
324
         <Priority name="Lowest"/>
325
      </modelingAssistantProvider>
326
   </extension>
327
328
   <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders">
329
      <IconProvider class="org.eclipse.uml2.diagram.activity.providers.UMLIconProvider">
330
         <Priority name="Low"/>
331
      </IconProvider>
332
   </extension>
333
334
   <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
335
      <ParserProvider class="org.eclipse.uml2.diagram.activity.providers.UMLParserProvider">
336
         <Priority name="Lowest"/>
337
      </ParserProvider>
338
   </extension>
339
340
   <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
341
342
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
343
         <metamodelType
344
               id="org.eclipse.uml2.diagram.activity.Activity_1000"
345
               name="Undefined"
346
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
347
               eclass="Activity"
348
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.ActivityEditHelper">
349
            <param name="semanticHint" value="1000"/>
350
         </metamodelType>
351
      </metamodel>
352
353
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
354
         <metamodelType
355
               id="org.eclipse.uml2.diagram.activity.OutputPin_3001"
356
               name="OutputPin"
357
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
358
               eclass="OutputPin"
359
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.OutputPinEditHelper">
360
            <param name="semanticHint" value="3001"/>
361
         </metamodelType>
362
      </metamodel>
363
364
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
365
         <specializationType
366
               id="org.eclipse.uml2.diagram.activity.OutputPin_3002"
367
               name="OutputPin"
368
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
369
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.OutputPinEditHelperAdvice">
370
            <specializes id="org.eclipse.uml2.diagram.activity.OutputPin_3001"/>
371
            <param name="semanticHint" value="3002"/>
372
         </specializationType>
373
      </metamodel>
374
375
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
376
         <metamodelType
377
               id="org.eclipse.uml2.diagram.activity.InputPin_3003"
378
               name="Input Pin insertAt"
379
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
380
               eclass="InputPin"
381
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.InputPinEditHelper">
382
            <param name="semanticHint" value="3003"/>
383
         </metamodelType>
384
      </metamodel>
385
386
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
387
         <specializationType
388
               id="org.eclipse.uml2.diagram.activity.InputPin_3004"
389
               name="Input Pin value"
390
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
391
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.InputPinEditHelperAdvice">
392
            <specializes id="org.eclipse.uml2.diagram.activity.InputPin_3003"/>
393
            <param name="semanticHint" value="3004"/>
394
         </specializationType>
395
      </metamodel>
396
397
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
398
         <specializationType
399
               id="org.eclipse.uml2.diagram.activity.InputPin_3005"
400
               name="Input Pin object"
401
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
402
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.InputPin2EditHelperAdvice">
403
            <specializes id="org.eclipse.uml2.diagram.activity.InputPin_3003"/>
404
            <param name="semanticHint" value="3005"/>
405
         </specializationType>
406
      </metamodel>
407
408
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
409
         <specializationType
410
               id="org.eclipse.uml2.diagram.activity.OutputPin_3006"
411
               name="Output Pin result"
412
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
413
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.OutputPin2EditHelperAdvice">
414
            <specializes id="org.eclipse.uml2.diagram.activity.OutputPin_3001"/>
415
            <param name="semanticHint" value="3006"/>
416
         </specializationType>
417
      </metamodel>
418
419
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
420
         <specializationType
421
               id="org.eclipse.uml2.diagram.activity.InputPin_3007"
422
               name="Input Pin argument"
423
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
424
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.InputPin3EditHelperAdvice">
425
            <specializes id="org.eclipse.uml2.diagram.activity.InputPin_3003"/>
426
            <param name="semanticHint" value="3007"/>
427
         </specializationType>
428
      </metamodel>
429
430
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
431
         <specializationType
432
               id="org.eclipse.uml2.diagram.activity.InputPin_3008"
433
               name="Input Pin target"
434
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
435
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.InputPin4EditHelperAdvice">
436
            <specializes id="org.eclipse.uml2.diagram.activity.InputPin_3003"/>
437
            <param name="semanticHint" value="3008"/>
438
         </specializationType>
439
      </metamodel>
440
441
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
442
         <metamodelType
443
               id="org.eclipse.uml2.diagram.activity.AcceptEventAction_2001"
444
               name="AcceptEventAction"
445
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
446
               eclass="AcceptEventAction"
447
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.AcceptEventActionEditHelper">
448
            <param name="semanticHint" value="2001"/>
449
         </metamodelType>
450
      </metamodel>
451
452
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
453
         <specializationType
454
               id="org.eclipse.uml2.diagram.activity.AcceptEventAction_2002"
455
               name="AcceptEventAction"
456
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
457
               edithelperadvice="org.eclipse.uml2.diagram.activity.edit.helpers.AcceptEventActionEditHelperAdvice">
458
            <specializes id="org.eclipse.uml2.diagram.activity.AcceptEventAction_2001"/>
459
            <param name="semanticHint" value="2002"/>
460
         </specializationType>
461
      </metamodel>
462
463
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
464
         <metamodelType
465
               id="org.eclipse.uml2.diagram.activity.ActivityFinalNode_2003"
466
               name="ActivityFinalNode"
467
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
468
               eclass="ActivityFinalNode"
469
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.ActivityFinalNodeEditHelper">
470
            <param name="semanticHint" value="2003"/>
471
         </metamodelType>
472
      </metamodel>
473
474
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
475
         <metamodelType
476
               id="org.eclipse.uml2.diagram.activity.DecisionNode_2004"
477
               name="DecisionNode"
478
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
479
               eclass="DecisionNode"
480
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.DecisionNodeEditHelper">
481
            <param name="semanticHint" value="2004"/>
482
         </metamodelType>
483
      </metamodel>
484
485
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
486
         <metamodelType
487
               id="org.eclipse.uml2.diagram.activity.MergeNode_2005"
488
               name="MergeNode"
489
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
490
               eclass="MergeNode"
491
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.MergeNodeEditHelper">
492
            <param name="semanticHint" value="2005"/>
493
         </metamodelType>
494
      </metamodel>
495
496
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
497
         <metamodelType
498
               id="org.eclipse.uml2.diagram.activity.InitialNode_2006"
499
               name="InitialNode"
500
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
501
               eclass="InitialNode"
502
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.InitialNodeEditHelper">
503
            <param name="semanticHint" value="2006"/>
504
         </metamodelType>
505
      </metamodel>
506
507
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
508
         <metamodelType
509
               id="org.eclipse.uml2.diagram.activity.StructuredActivityNode_2007"
510
               name="StructuredActivityNode"
511
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
512
               eclass="StructuredActivityNode"
513
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.StructuredActivityNodeEditHelper">
514
            <param name="semanticHint" value="2007"/>
515
         </metamodelType>
516
      </metamodel>
517
518
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
519
         <metamodelType
520
               id="org.eclipse.uml2.diagram.activity.DataStoreNode_2008"
521
               name="DataStoreNode"
522
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
523
               eclass="DataStoreNode"
524
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.DataStoreNodeEditHelper">
525
            <param name="semanticHint" value="2008"/>
526
         </metamodelType>
527
      </metamodel>
528
529
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
530
         <metamodelType
531
               id="org.eclipse.uml2.diagram.activity.CentralBufferNode_2009"
532
               name="CentralBufferNode"
533
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
534
               eclass="CentralBufferNode"
535
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.CentralBufferNodeEditHelper">
536
            <param name="semanticHint" value="2009"/>
537
         </metamodelType>
538
      </metamodel>
539
540
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
541
         <metamodelType
542
               id="org.eclipse.uml2.diagram.activity.OpaqueAction_2010"
543
               name="OpaqueAction"
544
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
545
               eclass="OpaqueAction"
546
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.OpaqueActionEditHelper">
547
            <param name="semanticHint" value="2010"/>
548
         </metamodelType>
549
      </metamodel>
550
551
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
552
         <metamodelType
553
               id="org.eclipse.uml2.diagram.activity.FlowFinalNode_2011"
554
               name="FlowFinalNode"
555
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
556
               eclass="FlowFinalNode"
557
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.FlowFinalNodeEditHelper">
558
            <param name="semanticHint" value="2011"/>
559
         </metamodelType>
560
      </metamodel>
561
562
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
563
         <metamodelType
564
               id="org.eclipse.uml2.diagram.activity.ForkNode_2012"
565
               name="ForkNode"
566
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
567
               eclass="ForkNode"
568
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.ForkNodeEditHelper">
569
            <param name="semanticHint" value="2012"/>
570
         </metamodelType>
571
      </metamodel>
572
573
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
574
         <metamodelType
575
               id="org.eclipse.uml2.diagram.activity.JoinNode_2013"
576
               name="JoinNode"
577
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
578
               eclass="JoinNode"
579
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.JoinNodeEditHelper">
580
            <param name="semanticHint" value="2013"/>
581
         </metamodelType>
582
      </metamodel>
583
584
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
585
         <metamodelType
586
               id="org.eclipse.uml2.diagram.activity.Pin_2014"
587
               name="Pin"
588
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
589
               eclass="Pin"
590
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.PinEditHelper">
591
            <param name="semanticHint" value="2014"/>
592
         </metamodelType>
593
      </metamodel>
594
595
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
596
         <metamodelType
597
               id="org.eclipse.uml2.diagram.activity.CreateObjectAction_2015"
598
               name="CreateObjectAction"
599
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
600
               eclass="CreateObjectAction"
601
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.CreateObjectActionEditHelper">
602
            <param name="semanticHint" value="2015"/>
603
         </metamodelType>
604
      </metamodel>
605
606
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
607
         <metamodelType
608
               id="org.eclipse.uml2.diagram.activity.AddStructuralFeatureValueAction_2016"
609
               name="AddStructuralFeatureValueAction"
610
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
611
               eclass="AddStructuralFeatureValueAction"
612
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.AddStructuralFeatureValueActionEditHelper">
613
            <param name="semanticHint" value="2016"/>
614
         </metamodelType>
615
      </metamodel>
616
617
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
618
         <metamodelType
619
               id="org.eclipse.uml2.diagram.activity.CallBehaviorAction_2017"
620
               name="CallBehaviorAction"
621
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
622
               eclass="CallBehaviorAction"
623
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.CallBehaviorActionEditHelper">
624
            <param name="semanticHint" value="2017"/>
625
         </metamodelType>
626
      </metamodel>
627
628
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
629
         <metamodelType
630
               id="org.eclipse.uml2.diagram.activity.CallOperationAction_2018"
631
               name="CallOperationAction"
632
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
633
               eclass="CallOperationAction"
634
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.CallOperationActionEditHelper">
635
            <param name="semanticHint" value="2018"/>
636
         </metamodelType>
637
      </metamodel>
638
639
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
640
         <metamodelType
641
               id="org.eclipse.uml2.diagram.activity.ControlFlow_4001"
642
               name="ControlFlow"
643
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
644
               eclass="ControlFlow"
645
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.ControlFlowEditHelper">
646
            <param name="semanticHint" value="4001"/>
647
         </metamodelType>
648
      </metamodel>
649
650
      <metamodel nsURI="http://www.eclipse.org/uml2/2.0.0/UML">
651
         <metamodelType
652
               id="org.eclipse.uml2.diagram.activity.ObjectFlow_4002"
653
               name="ObjectFlow"
654
               kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
655
               eclass="ObjectFlow"
656
               edithelper="org.eclipse.uml2.diagram.activity.edit.helpers.ObjectFlowEditHelper">
657
            <param name="semanticHint" value="4002"/>
658
         </metamodelType>
659
      </metamodel>
660
   </extension>
661
662
   <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
663
      <clientContext id="UMLActivityClientContext">
664
         <enablement>
665
            <test
666
               property="org.eclipse.gmf.runtime.emf.core.editingDomain"
667
               value="org.eclipse.uml2.diagram.activity.EditingDomain"/>
668
         </enablement>
669
      </clientContext> 
670
      <binding context="UMLActivityClientContext">
671
         <elementType ref="org.eclipse.uml2.diagram.activity.Activity_1000"/>
672
         <elementType ref="org.eclipse.uml2.diagram.activity.OutputPin_3001"/>
673
         <elementType ref="org.eclipse.uml2.diagram.activity.OutputPin_3002"/>
674
         <elementType ref="org.eclipse.uml2.diagram.activity.InputPin_3003"/>
675
         <elementType ref="org.eclipse.uml2.diagram.activity.InputPin_3004"/>
676
         <elementType ref="org.eclipse.uml2.diagram.activity.InputPin_3005"/>
677
         <elementType ref="org.eclipse.uml2.diagram.activity.OutputPin_3006"/>
678
         <elementType ref="org.eclipse.uml2.diagram.activity.InputPin_3007"/>
679
         <elementType ref="org.eclipse.uml2.diagram.activity.InputPin_3008"/>
680
         <elementType ref="org.eclipse.uml2.diagram.activity.AcceptEventAction_2001"/>
681
         <elementType ref="org.eclipse.uml2.diagram.activity.AcceptEventAction_2002"/>
682
         <elementType ref="org.eclipse.uml2.diagram.activity.ActivityFinalNode_2003"/>
683
         <elementType ref="org.eclipse.uml2.diagram.activity.DecisionNode_2004"/>
684
         <elementType ref="org.eclipse.uml2.diagram.activity.MergeNode_2005"/>
685
         <elementType ref="org.eclipse.uml2.diagram.activity.InitialNode_2006"/>
686
         <elementType ref="org.eclipse.uml2.diagram.activity.StructuredActivityNode_2007"/>
687
         <elementType ref="org.eclipse.uml2.diagram.activity.DataStoreNode_2008"/>
688
         <elementType ref="org.eclipse.uml2.diagram.activity.CentralBufferNode_2009"/>
689
         <elementType ref="org.eclipse.uml2.diagram.activity.OpaqueAction_2010"/>
690
         <elementType ref="org.eclipse.uml2.diagram.activity.FlowFinalNode_2011"/>
691
         <elementType ref="org.eclipse.uml2.diagram.activity.ForkNode_2012"/>
692
         <elementType ref="org.eclipse.uml2.diagram.activity.JoinNode_2013"/>
693
         <elementType ref="org.eclipse.uml2.diagram.activity.Pin_2014"/>
694
         <elementType ref="org.eclipse.uml2.diagram.activity.CreateObjectAction_2015"/>
695
         <elementType ref="org.eclipse.uml2.diagram.activity.AddStructuralFeatureValueAction_2016"/>
696
         <elementType ref="org.eclipse.uml2.diagram.activity.CallBehaviorAction_2017"/>
697
         <elementType ref="org.eclipse.uml2.diagram.activity.CallOperationAction_2018"/>
698
         <elementType ref="org.eclipse.uml2.diagram.activity.ControlFlow_4001"/>
699
         <elementType ref="org.eclipse.uml2.diagram.activity.ObjectFlow_4002"/>
700
         <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
701
      </binding>
702
   </extension>
703
704
   <extension point="org.eclipse.ui.navigator.viewer">
705
      <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
706
         <includes>
707
            <contentExtension pattern="org.eclipse.uml2.diagram.activity.resourceContent"/>
708
            <contentExtension pattern="org.eclipse.uml2.diagram.activity.navigatorLinkHelper"/>
709
         </includes>
710
      </viewerContentBinding>
711
   </extension>
712
713
   <extension point="org.eclipse.ui.navigator.navigatorContent">
714
      <navigatorContent 
715
            id="org.eclipse.uml2.diagram.activity.resourceContent" 
716
            name="%navigatorContentName" 
717
            priority="normal" 
718
            contentProvider="org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorContentProvider" 
719
            labelProvider="org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorLabelProvider"
720
            icon="icons/obj16/UMLDiagramFile.gif"
721
            activeByDefault="true">
722
         <triggerPoints>
723
            <or>
724
	            <and>
725
    	           <instanceof value="org.eclipse.core.resources.IFile"/>
726
        	       <test property="org.eclipse.core.resources.extension" value="umlactivity_diagram"/>
727
            	</and>
728
            	<instanceof value="org.eclipse.uml2.diagram.activity.navigator.UMLAbstractNavigatorItem"/>
729
            </or>
730
         </triggerPoints>
731
         <possibleChildren>
732
         	<instanceof value="org.eclipse.uml2.diagram.activity.navigator.UMLAbstractNavigatorItem"/>
733
         </possibleChildren>
734
         <commonSorter 
735
               id="org.eclipse.uml2.diagram.activity.navigatorSorter" 
736
               class="org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorSorter">
737
            <parentExpression>
738
               <or>
739
	              <and>
740
    	             <instanceof value="org.eclipse.core.resources.IFile"/>
741
        	         <test property="org.eclipse.core.resources.extension" value="umlactivity_diagram"/>
742
                  </and>
743
                  <instanceof value="org.eclipse.uml2.diagram.activity.navigator.UMLAbstractNavigatorItem"/>
744
               </or>
745
            </parentExpression>
746
         </commonSorter>
747
         <actionProvider
748
               id="org.eclipse.uml2.diagram.activity.navigatorActionProvider"
749
               class="org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorActionProvider">
750
         </actionProvider>
751
      </navigatorContent>
752
   </extension>
753
   
754
   <extension point="org.eclipse.ui.navigator.linkHelper">
755
      <linkHelper
756
            id="org.eclipse.uml2.diagram.activity.navigatorLinkHelper"
757
            class="org.eclipse.uml2.diagram.activity.navigator.UMLNavigatorLinkHelper">
758
         <editorInputEnablement>
759
            <instanceof value="org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.FileEditorInputProxy"/>
760
         </editorInputEnablement>
761
         <selectionEnablement>
762
            <instanceof value="org.eclipse.uml2.diagram.activity.navigator.UMLAbstractNavigatorItem"/>
763
         </selectionEnablement>
764
      </linkHelper>
765
   </extension>
766
767
   <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
768
      <propertyContributor contributorId="org.eclipse.uml2.diagram.activity"
769
            labelProvider="org.eclipse.uml2.diagram.activity.sheet.UMLSheetLabelProvider">
770
         <propertyCategory category="domain"/>
771
         <propertyCategory category="visual"/>
772
         <propertyCategory category="extra"/>
773
      </propertyContributor>
774
   </extension>
775
776
   <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
777
      <propertyTabs contributorId="org.eclipse.uml2.diagram.activity">
778
         <propertyTab
779
             category="visual"
780
             id="property.tab.AppearancePropertySection"
781
             label="%tab.appearance"/>
782
          <propertyTab
783
             category="visual"
784
             id="property.tab.DiagramPropertySection"
785
             label="%tab.diagram"/>
786
          <propertyTab
787
             category="domain"
788
             id="property.tab.domain"
789
             label="%tab.domain"/>
790
      </propertyTabs>
791
   </extension>
792
793
   <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
794
      <propertySections contributorId="org.eclipse.uml2.diagram.activity">
795
796
         <propertySection id="property.section.ConnectorAppearancePropertySection" 
797
            filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter" 
798
            class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ConnectionAppearancePropertySection" 
799
            tab="property.tab.AppearancePropertySection">
800
         </propertySection>
801
         <propertySection id="property.section.ShapeColorAndFontPropertySection" 
802
            filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ShapeEditPartPropertySectionFilter" 
803
            class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection" 
804
            tab="property.tab.AppearancePropertySection">
805
         </propertySection> 
806
         <propertySection id="property.section.DiagramColorsAndFontsPropertySection" 
807
            filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter" 
808
            class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.DiagramColorsAndFontsPropertySection" 
809
            tab="property.tab.AppearancePropertySection">
810
         </propertySection>              
811
812
          <propertySection id="property.section.RulerGridPropertySection" 
813
             filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter" 
814
             class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection" 
815
             tab="property.tab.DiagramPropertySection">
816
          </propertySection>              
817
         <propertySection
818
            id="property.section.domain" 
819
            tab="property.tab.domain"
820
            class="org.eclipse.uml2.diagram.activity.sheet.UMLPropertySection">
821
            <input type="org.eclipse.gmf.runtime.notation.View"/>
822
            <input type="org.eclipse.gef.EditPart"/>
823
            <input type="org.eclipse.uml2.diagram.activity.navigator.UMLAbstractNavigatorItem"/>
824
         </propertySection>
825
      </propertySections>
826
   </extension>
827
</plugin>
(-)src/org/eclipse/uml2/diagram/activity/providers/UMLStructuralFeatureParser.java (+132 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.providers;
2
3
import java.text.FieldPosition;
4
import java.text.MessageFormat;
5
import java.util.Collections;
6
7
import org.eclipse.core.runtime.IAdaptable;
8
import org.eclipse.emf.common.notify.Notification;
9
import org.eclipse.emf.ecore.EObject;
10
import org.eclipse.emf.ecore.EStructuralFeature;
11
import org.eclipse.emf.transaction.TransactionalEditingDomain;
12
import org.eclipse.emf.transaction.util.TransactionUtil;
13
import org.eclipse.gmf.runtime.common.core.command.ICommand;
14
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
15
import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
16
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
17
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
18
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
19
20
/**
21
 * @generated
22
 */
23
public class UMLStructuralFeatureParser extends UMLAbstractParser {
24
25
	/**
26
	 * @generated
27
	 */
28
	public static final MessageFormat DEFAULT_PROCESSOR = new MessageFormat("{0}"); //$NON-NLS-1$
29
30
	/**
31
	 * @generated
32
	 */
33
	private EStructuralFeature feature;
34
35
	/**
36
	 * @generated
37
	 */
38
	public UMLStructuralFeatureParser(EStructuralFeature feature) {
39
		this.feature = feature;
40
	}
41
42
	/**
43
	 * @generated
44
	 */
45
	protected MessageFormat getViewProcessor() {
46
		MessageFormat processor = super.getViewProcessor();
47
		return processor == null ? DEFAULT_PROCESSOR : processor;
48
	}
49
50
	/**
51
	 * @generated
52
	 */
53
	protected MessageFormat getEditProcessor() {
54
		MessageFormat processor = super.getEditProcessor();
55
		return processor == null ? DEFAULT_PROCESSOR : processor;
56
	}
57
58
	/**
59
	 * @generated
60
	 */
61
	protected EObject getDomainElement(EObject element) {
62
		return element;
63
	}
64
65
	/**
66
	 * @generated
67
	 */
68
	protected String getStringByPattern(IAdaptable adapter, int flags, String pattern, MessageFormat processor) {
69
		EObject element = (EObject) adapter.getAdapter(EObject.class);
70
		element = getDomainElement(element);
71
		return getStringByPattern(element, feature, processor);
72
	}
73
74
	/**
75
	 * @generated
76
	 */
77
	protected String getStringByPattern(EObject element, EStructuralFeature feature, MessageFormat processor) {
78
		Object value = element == null ? null : element.eGet(feature);
79
		value = getValidValue(feature, value);
80
		return processor.format(new Object[] { value }, new StringBuffer(), new FieldPosition(0)).toString();
81
	}
82
83
	/**
84
	 * @generated
85
	 */
86
	protected IParserEditStatus validateValues(Object[] values) {
87
		if (values.length > 1) {
88
			return ParserEditStatus.UNEDITABLE_STATUS;
89
		}
90
		Object value = values.length == 1 ? values[0] : null;
91
		value = getValidNewValue(feature, value);
92
		if (value instanceof InvalidValue) {
93
			return new ParserEditStatus(UMLDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
94
		}
95
		return ParserEditStatus.EDITABLE_STATUS;
96
	}
97
98
	/**
99
	 * @generated
100
	 */
101
	public ICommand getParseCommand(IAdaptable adapter, Object[] values) {
102
		EObject element = (EObject) adapter.getAdapter(EObject.class);
103
		element = getDomainElement(element);
104
		if (element == null) {
105
			return UnexecutableCommand.INSTANCE;
106
		}
107
		TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
108
		if (editingDomain == null) {
109
			return UnexecutableCommand.INSTANCE;
110
		}
111
		Object value = values.length == 1 ? values[0] : null;
112
		ICommand command = getModificationCommand(element, feature, value);
113
		return new CompositeTransactionalCommand(editingDomain, command.getLabel(), Collections.singletonList(command));
114
	}
115
116
	/**
117
	 * @generated
118
	 */
119
	public boolean isAffectingEvent(Object event, int flags) {
120
		if (event instanceof Notification) {
121
			return isAffectingFeature(((Notification) event).getFeature());
122
		}
123
		return false;
124
	}
125
126
	/**
127
	 * @generated
128
	 */
129
	protected boolean isAffectingFeature(Object eventFeature) {
130
		return feature == eventFeature;
131
	}
132
}
(-)src/org/eclipse/uml2/diagram/activity/navigator/UMLNavigatorLabelProvider.java (+829 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.navigator;
2
3
import org.eclipse.core.runtime.IAdaptable;
4
import org.eclipse.emf.ecore.EObject;
5
import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
6
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
7
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
8
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
9
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
10
import org.eclipse.gmf.runtime.notation.View;
11
import org.eclipse.jface.resource.ImageDescriptor;
12
import org.eclipse.jface.resource.ImageRegistry;
13
import org.eclipse.jface.viewers.LabelProvider;
14
import org.eclipse.swt.graphics.Image;
15
import org.eclipse.ui.IMemento;
16
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
17
import org.eclipse.ui.navigator.ICommonLabelProvider;
18
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventAction2EditPart;
19
import org.eclipse.uml2.diagram.activity.edit.parts.AcceptEventActionEditPart;
20
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
21
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityFinalNodeEditPart;
22
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
23
import org.eclipse.uml2.diagram.activity.edit.parts.AddStructuralFeatureValueActionNameEditPart;
24
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionEditPart;
25
import org.eclipse.uml2.diagram.activity.edit.parts.CallBehaviorActionNameEditPart;
26
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionEditPart;
27
import org.eclipse.uml2.diagram.activity.edit.parts.CallOperationActionNameEditPart;
28
import org.eclipse.uml2.diagram.activity.edit.parts.CentralBufferNodeEditPart;
29
import org.eclipse.uml2.diagram.activity.edit.parts.ControlFlowEditPart;
30
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionEditPart;
31
import org.eclipse.uml2.diagram.activity.edit.parts.CreateObjectActionNameEditPart;
32
import org.eclipse.uml2.diagram.activity.edit.parts.DataStoreNodeEditPart;
33
import org.eclipse.uml2.diagram.activity.edit.parts.DecisionNodeEditPart;
34
import org.eclipse.uml2.diagram.activity.edit.parts.FlowFinalNodeEditPart;
35
import org.eclipse.uml2.diagram.activity.edit.parts.ForkNodeEditPart;
36
import org.eclipse.uml2.diagram.activity.edit.parts.InitialNodeEditPart;
37
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin2EditPart;
38
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin3EditPart;
39
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart;
40
import org.eclipse.uml2.diagram.activity.edit.parts.InputPin5EditPart;
41
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinEditPart;
42
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName2EditPart;
43
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName3EditPart;
44
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart;
45
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName5EditPart;
46
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinNameEditPart;
47
import org.eclipse.uml2.diagram.activity.edit.parts.JoinNodeEditPart;
48
import org.eclipse.uml2.diagram.activity.edit.parts.MergeNodeEditPart;
49
import org.eclipse.uml2.diagram.activity.edit.parts.ObjectFlowEditPart;
50
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionEditPart;
51
import org.eclipse.uml2.diagram.activity.edit.parts.OpaqueActionNameEditPart;
52
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin2EditPart;
53
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPin3EditPart;
54
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinEditPart;
55
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName2EditPart;
56
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinName3EditPart;
57
import org.eclipse.uml2.diagram.activity.edit.parts.OutputPinNameEditPart;
58
import org.eclipse.uml2.diagram.activity.edit.parts.PinEditPart;
59
import org.eclipse.uml2.diagram.activity.edit.parts.PinNameEditPart;
60
import org.eclipse.uml2.diagram.activity.edit.parts.StructuredActivityNodeEditPart;
61
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
62
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
63
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
64
import org.eclipse.uml2.uml.NamedElement;
65
66
/**
67
 * @generated
68
 */
69
public class UMLNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider {
70
71
	/**
72
	 * @generated
73
	 */
74
	static {
75
		UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?InvalidElement", ImageDescriptor.getMissingImageDescriptor());
76
		UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor());
77
		UMLDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor());
78
	}
79
80
	/**
81
	 * @generated
82
	 */
83
	public Image getImage(Object element) {
84
		if (false == element instanceof UMLAbstractNavigatorItem) {
85
			return super.getImage(element);
86
		}
87
88
		UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
89
		if (!ActivityEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
90
			return super.getImage(element);
91
		}
92
93
		if (abstractNavigatorItem instanceof UMLNavigatorItem) {
94
			UMLNavigatorItem navigatorItem = (UMLNavigatorItem) abstractNavigatorItem;
95
			switch (navigatorItem.getVisualID()) {
96
			case AcceptEventActionEditPart.VISUAL_ID:
97
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?AcceptEventAction", UMLElementTypes.AcceptEventAction_2001);
98
			case AcceptEventAction2EditPart.VISUAL_ID:
99
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?AcceptEventAction", UMLElementTypes.AcceptEventAction_2002);
100
			case ActivityFinalNodeEditPart.VISUAL_ID:
101
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?ActivityFinalNode", UMLElementTypes.ActivityFinalNode_2003);
102
			case DecisionNodeEditPart.VISUAL_ID:
103
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?DecisionNode", UMLElementTypes.DecisionNode_2004);
104
			case MergeNodeEditPart.VISUAL_ID:
105
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?MergeNode", UMLElementTypes.MergeNode_2005);
106
			case InitialNodeEditPart.VISUAL_ID:
107
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?InitialNode", UMLElementTypes.InitialNode_2006);
108
			case StructuredActivityNodeEditPart.VISUAL_ID:
109
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?StructuredActivityNode", UMLElementTypes.StructuredActivityNode_2007);
110
			case DataStoreNodeEditPart.VISUAL_ID:
111
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?DataStoreNode", UMLElementTypes.DataStoreNode_2008);
112
			case CentralBufferNodeEditPart.VISUAL_ID:
113
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?CentralBufferNode", UMLElementTypes.CentralBufferNode_2009);
114
			case OpaqueActionEditPart.VISUAL_ID:
115
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?OpaqueAction", UMLElementTypes.OpaqueAction_2010);
116
			case FlowFinalNodeEditPart.VISUAL_ID:
117
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?FlowFinalNode", UMLElementTypes.FlowFinalNode_2011);
118
			case ForkNodeEditPart.VISUAL_ID:
119
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?ForkNode", UMLElementTypes.ForkNode_2012);
120
			case JoinNodeEditPart.VISUAL_ID:
121
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?JoinNode", UMLElementTypes.JoinNode_2013);
122
			case PinEditPart.VISUAL_ID:
123
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?Pin", UMLElementTypes.Pin_2014);
124
			case CreateObjectActionEditPart.VISUAL_ID:
125
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?CreateObjectAction", UMLElementTypes.CreateObjectAction_2015);
126
			case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
127
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?AddStructuralFeatureValueAction", UMLElementTypes.AddStructuralFeatureValueAction_2016);
128
			case CallBehaviorActionEditPart.VISUAL_ID:
129
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?CallBehaviorAction", UMLElementTypes.CallBehaviorAction_2017);
130
			case CallOperationActionEditPart.VISUAL_ID:
131
				return getImage("Navigator?TopLevelNode?http://www.eclipse.org/uml2/2.0.0/UML?CallOperationAction", UMLElementTypes.CallOperationAction_2018);
132
			case OutputPinEditPart.VISUAL_ID:
133
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?OutputPin", UMLElementTypes.OutputPin_3001);
134
			case OutputPin2EditPart.VISUAL_ID:
135
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?OutputPin", UMLElementTypes.OutputPin_3002);
136
			case InputPinEditPart.VISUAL_ID:
137
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?InputPin", UMLElementTypes.InputPin_3003);
138
			case InputPin2EditPart.VISUAL_ID:
139
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?InputPin", UMLElementTypes.InputPin_3004);
140
			case InputPin3EditPart.VISUAL_ID:
141
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?InputPin", UMLElementTypes.InputPin_3005);
142
			case OutputPin3EditPart.VISUAL_ID:
143
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?OutputPin", UMLElementTypes.OutputPin_3006);
144
			case InputPin4EditPart.VISUAL_ID:
145
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?InputPin", UMLElementTypes.InputPin_3007);
146
			case InputPin5EditPart.VISUAL_ID:
147
				return getImage("Navigator?Node?http://www.eclipse.org/uml2/2.0.0/UML?InputPin", UMLElementTypes.InputPin_3008);
148
			case ActivityEditPart.VISUAL_ID:
149
				return getImage("Navigator?Diagram?http://www.eclipse.org/uml2/2.0.0/UML?Activity", UMLElementTypes.Activity_1000);
150
			case ControlFlowEditPart.VISUAL_ID:
151
				return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.0.0/UML?ControlFlow", UMLElementTypes.ControlFlow_4001);
152
			case ObjectFlowEditPart.VISUAL_ID:
153
				return getImage("Navigator?Link?http://www.eclipse.org/uml2/2.0.0/UML?ObjectFlow", UMLElementTypes.ObjectFlow_4002);
154
			default:
155
				return getImage("Navigator?UnknownElement", null);
156
			}
157
		} else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
158
			UMLNavigatorGroup group = (UMLNavigatorGroup) element;
159
			return UMLDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
160
		}
161
		return super.getImage(element);
162
	}
163
164
	/**
165
	 * @generated
166
	 */
167
	private Image getImage(String key, IElementType elementType) {
168
		ImageRegistry imageRegistry = UMLDiagramEditorPlugin.getInstance().getImageRegistry();
169
		Image image = imageRegistry.get(key);
170
		if (image == null && elementType != null && UMLElementTypes.isKnownElementType(elementType)) {
171
			image = UMLElementTypes.getImage(elementType);
172
			imageRegistry.put(key, image);
173
		}
174
175
		if (image == null) {
176
			image = imageRegistry.get("Navigator?ImageNotFound");
177
			imageRegistry.put(key, image);
178
		}
179
		return image;
180
	}
181
182
	/**
183
	 * @generated
184
	 */
185
	public String getText(Object element) {
186
		if (false == element instanceof UMLAbstractNavigatorItem) {
187
			return super.getText(element);
188
		}
189
190
		UMLAbstractNavigatorItem abstractNavigatorItem = (UMLAbstractNavigatorItem) element;
191
		if (!ActivityEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
192
			return super.getText(element);
193
		}
194
195
		if (abstractNavigatorItem instanceof UMLNavigatorItem) {
196
			UMLNavigatorItem navigatorItem = (UMLNavigatorItem) abstractNavigatorItem;
197
			switch (navigatorItem.getVisualID()) {
198
			case AcceptEventActionEditPart.VISUAL_ID:
199
				return getAcceptEventAction_2001Text(navigatorItem.getView());
200
			case AcceptEventAction2EditPart.VISUAL_ID:
201
				return getAcceptEventAction_2002Text(navigatorItem.getView());
202
			case ActivityFinalNodeEditPart.VISUAL_ID:
203
				return getActivityFinalNode_2003Text(navigatorItem.getView());
204
			case DecisionNodeEditPart.VISUAL_ID:
205
				return getDecisionNode_2004Text(navigatorItem.getView());
206
			case MergeNodeEditPart.VISUAL_ID:
207
				return getMergeNode_2005Text(navigatorItem.getView());
208
			case InitialNodeEditPart.VISUAL_ID:
209
				return getInitialNode_2006Text(navigatorItem.getView());
210
			case StructuredActivityNodeEditPart.VISUAL_ID:
211
				return getStructuredActivityNode_2007Text(navigatorItem.getView());
212
			case DataStoreNodeEditPart.VISUAL_ID:
213
				return getDataStoreNode_2008Text(navigatorItem.getView());
214
			case CentralBufferNodeEditPart.VISUAL_ID:
215
				return getCentralBufferNode_2009Text(navigatorItem.getView());
216
			case OpaqueActionEditPart.VISUAL_ID:
217
				return getOpaqueAction_2010Text(navigatorItem.getView());
218
			case FlowFinalNodeEditPart.VISUAL_ID:
219
				return getFlowFinalNode_2011Text(navigatorItem.getView());
220
			case ForkNodeEditPart.VISUAL_ID:
221
				return getForkNode_2012Text(navigatorItem.getView());
222
			case JoinNodeEditPart.VISUAL_ID:
223
				return getJoinNode_2013Text(navigatorItem.getView());
224
			case PinEditPart.VISUAL_ID:
225
				return getPin_2014Text(navigatorItem.getView());
226
			case CreateObjectActionEditPart.VISUAL_ID:
227
				return getCreateObjectAction_2015Text(navigatorItem.getView());
228
			case AddStructuralFeatureValueActionEditPart.VISUAL_ID:
229
				return getAddStructuralFeatureValueAction_2016Text(navigatorItem.getView());
230
			case CallBehaviorActionEditPart.VISUAL_ID:
231
				return getCallBehaviorAction_2017Text(navigatorItem.getView());
232
			case CallOperationActionEditPart.VISUAL_ID:
233
				return getCallOperationAction_2018Text(navigatorItem.getView());
234
			case OutputPinEditPart.VISUAL_ID:
235
				return getOutputPin_3001Text(navigatorItem.getView());
236
			case OutputPin2EditPart.VISUAL_ID:
237
				return getOutputPin_3002Text(navigatorItem.getView());
238
			case InputPinEditPart.VISUAL_ID:
239
				return getInputPin_3003Text(navigatorItem.getView());
240
			case InputPin2EditPart.VISUAL_ID:
241
				return getInputPin_3004Text(navigatorItem.getView());
242
			case InputPin3EditPart.VISUAL_ID:
243
				return getInputPin_3005Text(navigatorItem.getView());
244
			case OutputPin3EditPart.VISUAL_ID:
245
				return getOutputPin_3006Text(navigatorItem.getView());
246
			case InputPin4EditPart.VISUAL_ID:
247
				return getInputPin_3007Text(navigatorItem.getView());
248
			case InputPin5EditPart.VISUAL_ID:
249
				return getInputPin_3008Text(navigatorItem.getView());
250
			case ActivityEditPart.VISUAL_ID:
251
				return getActivity_1000Text(navigatorItem.getView());
252
			case ControlFlowEditPart.VISUAL_ID:
253
				return getControlFlow_4001Text(navigatorItem.getView());
254
			case ObjectFlowEditPart.VISUAL_ID:
255
				return getObjectFlow_4002Text(navigatorItem.getView());
256
			default:
257
				return getUnknownElementText(navigatorItem.getView());
258
			}
259
		} else if (abstractNavigatorItem instanceof UMLNavigatorGroup) {
260
			UMLNavigatorGroup group = (UMLNavigatorGroup) element;
261
			return group.getGroupName();
262
		}
263
		return super.getText(element);
264
	}
265
266
	/**
267
	 * @generated
268
	 */
269
	private String getAcceptEventAction_2001Text(View view) {
270
		EObject domainModelElement = view.getElement();
271
		if (domainModelElement != null) {
272
			return String.valueOf(((NamedElement) domainModelElement).getName());
273
		} else {
274
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2001);
275
			return "";
276
		}
277
	}
278
279
	/**
280
	 * @generated
281
	 */
282
	private String getAcceptEventAction_2002Text(View view) {
283
		EObject domainModelElement = view.getElement();
284
		if (domainModelElement != null) {
285
			return String.valueOf(((NamedElement) domainModelElement).getName());
286
		} else {
287
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2002);
288
			return "";
289
		}
290
	}
291
292
	/**
293
	 * @generated
294
	 */
295
	private String getActivityFinalNode_2003Text(View view) {
296
		EObject domainModelElement = view.getElement();
297
		if (domainModelElement != null) {
298
			return String.valueOf(((NamedElement) domainModelElement).getName());
299
		} else {
300
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2003);
301
			return "";
302
		}
303
	}
304
305
	/**
306
	 * @generated
307
	 */
308
	private String getDecisionNode_2004Text(View view) {
309
		EObject domainModelElement = view.getElement();
310
		if (domainModelElement != null) {
311
			return String.valueOf(((NamedElement) domainModelElement).getName());
312
		} else {
313
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2004);
314
			return "";
315
		}
316
	}
317
318
	/**
319
	 * @generated
320
	 */
321
	private String getMergeNode_2005Text(View view) {
322
		EObject domainModelElement = view.getElement();
323
		if (domainModelElement != null) {
324
			return String.valueOf(((NamedElement) domainModelElement).getName());
325
		} else {
326
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2005);
327
			return "";
328
		}
329
	}
330
331
	/**
332
	 * @generated
333
	 */
334
	private String getInitialNode_2006Text(View view) {
335
		EObject domainModelElement = view.getElement();
336
		if (domainModelElement != null) {
337
			return String.valueOf(((NamedElement) domainModelElement).getName());
338
		} else {
339
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2006);
340
			return "";
341
		}
342
	}
343
344
	/**
345
	 * @generated
346
	 */
347
	private String getStructuredActivityNode_2007Text(View view) {
348
		EObject domainModelElement = view.getElement();
349
		if (domainModelElement != null) {
350
			return String.valueOf(((NamedElement) domainModelElement).getName());
351
		} else {
352
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2007);
353
			return "";
354
		}
355
	}
356
357
	/**
358
	 * @generated
359
	 */
360
	private String getDataStoreNode_2008Text(View view) {
361
		EObject domainModelElement = view.getElement();
362
		if (domainModelElement != null) {
363
			return String.valueOf(((NamedElement) domainModelElement).getName());
364
		} else {
365
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2008);
366
			return "";
367
		}
368
	}
369
370
	/**
371
	 * @generated
372
	 */
373
	private String getCentralBufferNode_2009Text(View view) {
374
		EObject domainModelElement = view.getElement();
375
		if (domainModelElement != null) {
376
			return String.valueOf(((NamedElement) domainModelElement).getName());
377
		} else {
378
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2009);
379
			return "";
380
		}
381
	}
382
383
	/**
384
	 * @generated
385
	 */
386
	private String getOpaqueAction_2010Text(View view) {
387
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
388
389
			public Object getAdapter(Class adapter) {
390
				if (String.class.equals(adapter)) {
391
					return UMLVisualIDRegistry.getType(OpaqueActionNameEditPart.VISUAL_ID);
392
				}
393
				if (IElementType.class.equals(adapter)) {
394
					return UMLElementTypes.OpaqueAction_2010;
395
				}
396
				return null;
397
			}
398
		});
399
		if (parser != null) {
400
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
401
		} else {
402
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5001);
403
			return "";
404
		}
405
	}
406
407
	/**
408
	 * @generated
409
	 */
410
	private String getFlowFinalNode_2011Text(View view) {
411
		EObject domainModelElement = view.getElement();
412
		if (domainModelElement != null) {
413
			return String.valueOf(((NamedElement) domainModelElement).getName());
414
		} else {
415
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2011);
416
			return "";
417
		}
418
	}
419
420
	/**
421
	 * @generated
422
	 */
423
	private String getForkNode_2012Text(View view) {
424
		EObject domainModelElement = view.getElement();
425
		if (domainModelElement != null) {
426
			return String.valueOf(((NamedElement) domainModelElement).getName());
427
		} else {
428
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2012);
429
			return "";
430
		}
431
	}
432
433
	/**
434
	 * @generated
435
	 */
436
	private String getJoinNode_2013Text(View view) {
437
		EObject domainModelElement = view.getElement();
438
		if (domainModelElement != null) {
439
			return String.valueOf(((NamedElement) domainModelElement).getName());
440
		} else {
441
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 2013);
442
			return "";
443
		}
444
	}
445
446
	/**
447
	 * @generated
448
	 */
449
	private String getPin_2014Text(View view) {
450
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
451
452
			public Object getAdapter(Class adapter) {
453
				if (String.class.equals(adapter)) {
454
					return UMLVisualIDRegistry.getType(PinNameEditPart.VISUAL_ID);
455
				}
456
				if (IElementType.class.equals(adapter)) {
457
					return UMLElementTypes.Pin_2014;
458
				}
459
				return null;
460
			}
461
		});
462
		if (parser != null) {
463
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
464
		} else {
465
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5002);
466
			return "";
467
		}
468
	}
469
470
	/**
471
	 * @generated
472
	 */
473
	private String getCreateObjectAction_2015Text(View view) {
474
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
475
476
			public Object getAdapter(Class adapter) {
477
				if (String.class.equals(adapter)) {
478
					return UMLVisualIDRegistry.getType(CreateObjectActionNameEditPart.VISUAL_ID);
479
				}
480
				if (IElementType.class.equals(adapter)) {
481
					return UMLElementTypes.CreateObjectAction_2015;
482
				}
483
				return null;
484
			}
485
		});
486
		if (parser != null) {
487
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
488
		} else {
489
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5005);
490
			return "";
491
		}
492
	}
493
494
	/**
495
	 * @generated
496
	 */
497
	private String getAddStructuralFeatureValueAction_2016Text(View view) {
498
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
499
500
			public Object getAdapter(Class adapter) {
501
				if (String.class.equals(adapter)) {
502
					return UMLVisualIDRegistry.getType(AddStructuralFeatureValueActionNameEditPart.VISUAL_ID);
503
				}
504
				if (IElementType.class.equals(adapter)) {
505
					return UMLElementTypes.AddStructuralFeatureValueAction_2016;
506
				}
507
				return null;
508
			}
509
		});
510
		if (parser != null) {
511
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
512
		} else {
513
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5009);
514
			return "";
515
		}
516
	}
517
518
	/**
519
	 * @generated
520
	 */
521
	private String getCallBehaviorAction_2017Text(View view) {
522
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
523
524
			public Object getAdapter(Class adapter) {
525
				if (String.class.equals(adapter)) {
526
					return UMLVisualIDRegistry.getType(CallBehaviorActionNameEditPart.VISUAL_ID);
527
				}
528
				if (IElementType.class.equals(adapter)) {
529
					return UMLElementTypes.CallBehaviorAction_2017;
530
				}
531
				return null;
532
			}
533
		});
534
		if (parser != null) {
535
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
536
		} else {
537
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5012);
538
			return "";
539
		}
540
	}
541
542
	/**
543
	 * @generated
544
	 */
545
	private String getCallOperationAction_2018Text(View view) {
546
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
547
548
			public Object getAdapter(Class adapter) {
549
				if (String.class.equals(adapter)) {
550
					return UMLVisualIDRegistry.getType(CallOperationActionNameEditPart.VISUAL_ID);
551
				}
552
				if (IElementType.class.equals(adapter)) {
553
					return UMLElementTypes.CallOperationAction_2018;
554
				}
555
				return null;
556
			}
557
		});
558
		if (parser != null) {
559
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
560
		} else {
561
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5014);
562
			return "";
563
		}
564
	}
565
566
	/**
567
	 * @generated
568
	 */
569
	private String getOutputPin_3001Text(View view) {
570
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
571
572
			public Object getAdapter(Class adapter) {
573
				if (String.class.equals(adapter)) {
574
					return UMLVisualIDRegistry.getType(OutputPinNameEditPart.VISUAL_ID);
575
				}
576
				if (IElementType.class.equals(adapter)) {
577
					return UMLElementTypes.OutputPin_3001;
578
				}
579
				return null;
580
			}
581
		});
582
		if (parser != null) {
583
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
584
		} else {
585
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5003);
586
			return "";
587
		}
588
	}
589
590
	/**
591
	 * @generated
592
	 */
593
	private String getOutputPin_3002Text(View view) {
594
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
595
596
			public Object getAdapter(Class adapter) {
597
				if (String.class.equals(adapter)) {
598
					return UMLVisualIDRegistry.getType(OutputPinName2EditPart.VISUAL_ID);
599
				}
600
				if (IElementType.class.equals(adapter)) {
601
					return UMLElementTypes.OutputPin_3002;
602
				}
603
				return null;
604
			}
605
		});
606
		if (parser != null) {
607
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
608
		} else {
609
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5004);
610
			return "";
611
		}
612
	}
613
614
	/**
615
	 * @generated
616
	 */
617
	private String getInputPin_3003Text(View view) {
618
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
619
620
			public Object getAdapter(Class adapter) {
621
				if (String.class.equals(adapter)) {
622
					return UMLVisualIDRegistry.getType(InputPinNameEditPart.VISUAL_ID);
623
				}
624
				if (IElementType.class.equals(adapter)) {
625
					return UMLElementTypes.InputPin_3003;
626
				}
627
				return null;
628
			}
629
		});
630
		if (parser != null) {
631
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
632
		} else {
633
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5006);
634
			return "";
635
		}
636
	}
637
638
	/**
639
	 * @generated
640
	 */
641
	private String getInputPin_3004Text(View view) {
642
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
643
644
			public Object getAdapter(Class adapter) {
645
				if (String.class.equals(adapter)) {
646
					return UMLVisualIDRegistry.getType(InputPinName2EditPart.VISUAL_ID);
647
				}
648
				if (IElementType.class.equals(adapter)) {
649
					return UMLElementTypes.InputPin_3004;
650
				}
651
				return null;
652
			}
653
		});
654
		if (parser != null) {
655
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
656
		} else {
657
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5007);
658
			return "";
659
		}
660
	}
661
662
	/**
663
	 * @generated
664
	 */
665
	private String getInputPin_3005Text(View view) {
666
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
667
668
			public Object getAdapter(Class adapter) {
669
				if (String.class.equals(adapter)) {
670
					return UMLVisualIDRegistry.getType(InputPinName3EditPart.VISUAL_ID);
671
				}
672
				if (IElementType.class.equals(adapter)) {
673
					return UMLElementTypes.InputPin_3005;
674
				}
675
				return null;
676
			}
677
		});
678
		if (parser != null) {
679
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
680
		} else {
681
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5008);
682
			return "";
683
		}
684
	}
685
686
	/**
687
	 * @generated
688
	 */
689
	private String getOutputPin_3006Text(View view) {
690
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
691
692
			public Object getAdapter(Class adapter) {
693
				if (String.class.equals(adapter)) {
694
					return UMLVisualIDRegistry.getType(OutputPinName3EditPart.VISUAL_ID);
695
				}
696
				if (IElementType.class.equals(adapter)) {
697
					return UMLElementTypes.OutputPin_3006;
698
				}
699
				return null;
700
			}
701
		});
702
		if (parser != null) {
703
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
704
		} else {
705
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5010);
706
			return "";
707
		}
708
	}
709
710
	/**
711
	 * @generated
712
	 */
713
	private String getInputPin_3007Text(View view) {
714
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
715
716
			public Object getAdapter(Class adapter) {
717
				if (String.class.equals(adapter)) {
718
					return UMLVisualIDRegistry.getType(InputPinName4EditPart.VISUAL_ID);
719
				}
720
				if (IElementType.class.equals(adapter)) {
721
					return UMLElementTypes.InputPin_3007;
722
				}
723
				return null;
724
			}
725
		});
726
		if (parser != null) {
727
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
728
		} else {
729
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5011);
730
			return "";
731
		}
732
	}
733
734
	/**
735
	 * @generated
736
	 */
737
	private String getInputPin_3008Text(View view) {
738
		IParser parser = ParserService.getInstance().getParser(new IAdaptable() {
739
740
			public Object getAdapter(Class adapter) {
741
				if (String.class.equals(adapter)) {
742
					return UMLVisualIDRegistry.getType(InputPinName5EditPart.VISUAL_ID);
743
				}
744
				if (IElementType.class.equals(adapter)) {
745
					return UMLElementTypes.InputPin_3008;
746
				}
747
				return null;
748
			}
749
		});
750
		if (parser != null) {
751
			return parser.getPrintString(new EObjectAdapter(view.getElement() != null ? view.getElement() : view), ParserOptions.NONE.intValue());
752
		} else {
753
			UMLDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 5013);
754
			return "";
755
		}
756
	}
757
758
	/**
759
	 * @generated
760
	 */
761
	private String getActivity_1000Text(View view) {
762
		EObject domainModelElement = view.getElement();
763
		if (domainModelElement != null) {
764
			return String.valueOf(((NamedElement) domainModelElement).getName());
765
		} else {
766
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 1000);
767
			return "";
768
		}
769
	}
770
771
	/**
772
	 * @generated
773
	 */
774
	private String getControlFlow_4001Text(View view) {
775
		EObject domainModelElement = view.getElement();
776
		if (domainModelElement != null) {
777
			return String.valueOf(((NamedElement) domainModelElement).getName());
778
		} else {
779
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 4001);
780
			return "";
781
		}
782
	}
783
784
	/**
785
	 * @generated
786
	 */
787
	private String getObjectFlow_4002Text(View view) {
788
		EObject domainModelElement = view.getElement();
789
		if (domainModelElement != null) {
790
			return String.valueOf(((NamedElement) domainModelElement).getName());
791
		} else {
792
			UMLDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 4002);
793
			return "";
794
		}
795
	}
796
797
	/**
798
	 * @generated
799
	 */
800
	private String getUnknownElementText(View view) {
801
		return "<UnknownElement Visual_ID = " + view.getType() + ">";
802
	}
803
804
	/**
805
	 * @generated
806
	 */
807
	public void init(ICommonContentExtensionSite aConfig) {
808
	}
809
810
	/**
811
	 * @generated
812
	 */
813
	public void restoreState(IMemento aMemento) {
814
	}
815
816
	/**
817
	 * @generated
818
	 */
819
	public void saveState(IMemento aMemento) {
820
	}
821
822
	/**
823
	 * @generated
824
	 */
825
	public String getDescription(Object anElement) {
826
		return null;
827
	}
828
829
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/PinEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class PinEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/AcceptEventActionEditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class AcceptEventActionEditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/UMLBaseItemSemanticEditPolicy.java (+315 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.Collections;
4
import java.util.HashMap;
5
import java.util.Map;
6
7
import org.eclipse.emf.ecore.EClass;
8
import org.eclipse.emf.ecore.EObject;
9
import org.eclipse.emf.transaction.TransactionalEditingDomain;
10
import org.eclipse.gef.commands.Command;
11
import org.eclipse.gef.commands.UnexecutableCommand;
12
import org.eclipse.gmf.runtime.common.core.command.ICommand;
13
import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
14
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
15
import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
16
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
17
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
18
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
19
import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
20
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
21
import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext;
22
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
23
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
24
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
25
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
26
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
27
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
28
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
29
import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
30
import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
31
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
32
import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
33
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
34
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
35
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
36
import org.eclipse.gmf.runtime.notation.View;
37
import org.eclipse.uml2.diagram.activity.edit.helpers.UMLBaseEditHelper;
38
import org.eclipse.uml2.diagram.activity.expressions.UMLAbstractExpression;
39
import org.eclipse.uml2.diagram.activity.expressions.UMLOCLFactory;
40
import org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorPlugin;
41
import org.eclipse.uml2.uml.UMLPackage;
42
43
/**
44
 * @generated
45
 */
46
public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
47
48
	/**
49
	 * @generated
50
	 */
51
	protected Command getSemanticCommand(IEditCommandRequest request) {
52
		IEditCommandRequest completedRequest = completeRequest(request);
53
		Object editHelperContext = completedRequest.getEditHelperContext();
54
		if (editHelperContext instanceof View || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext).getEObject() instanceof View)) {
55
			// no semantic commands are provided for pure design elements
56
			return null;
57
		}
58
		if (editHelperContext == null) {
59
			editHelperContext = ViewUtil.resolveSemanticElement((View) getHost().getModel());
60
		}
61
		IElementType elementType = ElementTypeRegistry.getInstance().getElementType(editHelperContext);
62
		if (elementType == ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$ 
63
			elementType = null;
64
		}
65
		Command epCommand = getSemanticCommandSwitch(completedRequest);
66
		if (epCommand != null) {
67
			ICommand command = epCommand instanceof ICommandProxy ? ((ICommandProxy) epCommand).getICommand() : new CommandProxy(epCommand);
68
			completedRequest.setParameter(UMLBaseEditHelper.EDIT_POLICY_COMMAND, command);
69
		}
70
		Command ehCommand = null;
71
		if (elementType != null) {
72
			ICommand command = elementType.getEditCommand(completedRequest);
73
			if (command != null) {
74
				if (!(command instanceof CompositeTransactionalCommand)) {
75
					TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
76
					command = new CompositeTransactionalCommand(editingDomain, null).compose(command);
77
				}
78
				ehCommand = new ICommandProxy(command);
79
			}
80
		}
81
		boolean shouldProceed = true;
82
		if (completedRequest instanceof DestroyRequest) {
83
			shouldProceed = shouldProceed((DestroyRequest) completedRequest);
84
		}
85
		if (shouldProceed) {
86
			if (completedRequest instanceof DestroyRequest) {
87
				TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
88
				Command deleteViewCommand = new ICommandProxy(new DeleteCommand(editingDomain, (View) getHost().getModel()));
89
				ehCommand = ehCommand == null ? deleteViewCommand : ehCommand.chain(deleteViewCommand);
90
			}
91
			return ehCommand;
92
		}
93
		return null;
94
	}
95
96
	/**
97
	 * @generated
98
	 */
99
	protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
100
		if (req instanceof CreateRelationshipRequest) {
101
			return getCreateRelationshipCommand((CreateRelationshipRequest) req);
102
		} else if (req instanceof CreateElementRequest) {
103
			return getCreateCommand((CreateElementRequest) req);
104
		} else if (req instanceof ConfigureRequest) {
105
			return getConfigureCommand((ConfigureRequest) req);
106
		} else if (req instanceof DestroyElementRequest) {
107
			return getDestroyElementCommand((DestroyElementRequest) req);
108
		} else if (req instanceof DestroyReferenceRequest) {
109
			return getDestroyReferenceCommand((DestroyReferenceRequest) req);
110
		} else if (req instanceof DuplicateElementsRequest) {
111
			return getDuplicateCommand((DuplicateElementsRequest) req);
112
		} else if (req instanceof GetEditContextRequest) {
113
			return getEditContextCommand((GetEditContextRequest) req);
114
		} else if (req instanceof MoveRequest) {
115
			return getMoveCommand((MoveRequest) req);
116
		} else if (req instanceof ReorientReferenceRelationshipRequest) {
117
			return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
118
		} else if (req instanceof ReorientRelationshipRequest) {
119
			return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
120
		} else if (req instanceof SetRequest) {
121
			return getSetCommand((SetRequest) req);
122
		}
123
		return null;
124
	}
125
126
	/**
127
	 * @generated
128
	 */
129
	protected Command getConfigureCommand(ConfigureRequest req) {
130
		return null;
131
	}
132
133
	/**
134
	 * @generated
135
	 */
136
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
137
		return null;
138
	}
139
140
	/**
141
	 * @generated
142
	 */
143
	protected Command getCreateCommand(CreateElementRequest req) {
144
		return null;
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	protected Command getSetCommand(SetRequest req) {
151
		return null;
152
	}
153
154
	/**
155
	 * @generated
156
	 */
157
	protected Command getEditContextCommand(GetEditContextRequest req) {
158
		return null;
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
165
		return null;
166
	}
167
168
	/**
169
	 * @generated
170
	 */
171
	protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
172
		return null;
173
	}
174
175
	/**
176
	 * @generated
177
	 */
178
	protected Command getDuplicateCommand(DuplicateElementsRequest req) {
179
		return null;
180
	}
181
182
	/**
183
	 * @generated
184
	 */
185
	protected Command getMoveCommand(MoveRequest req) {
186
		return null;
187
	}
188
189
	/**
190
	 * @generated
191
	 */
192
	protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
193
		return UnexecutableCommand.INSTANCE;
194
	}
195
196
	/**
197
	 * @generated
198
	 */
199
	protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
200
		return UnexecutableCommand.INSTANCE;
201
	}
202
203
	/**
204
	 * @generated
205
	 */
206
	protected Command getMSLWrapper(ICommand cmd) {
207
		return new ICommandProxy(cmd);
208
	}
209
210
	/**
211
	 * @generated
212
	 */
213
	protected EObject getSemanticElement() {
214
		return ViewUtil.resolveSemanticElement((View) getHost().getModel());
215
	}
216
217
	/**
218
	 * Finds container element for the new relationship of the specified type.
219
	 * Default implementation goes up by containment hierarchy starting from
220
	 * the specified element and returns the first element that is instance of
221
	 * the specified container class.
222
	 * 
223
	 * @generated
224
	 */
225
	protected EObject getRelationshipContainer(EObject element, EClass containerClass, IElementType relationshipType) {
226
		for (; element != null; element = element.eContainer()) {
227
			if (containerClass.isSuperTypeOf(element.eClass())) {
228
				return element;
229
			}
230
		}
231
		return null;
232
	}
233
234
	/**
235
	 * @generated 
236
	 */
237
	protected static class LinkConstraints {
238
239
		/**
240
		 * @generated 
241
		 */
242
		public static final LinkConstraints ControlFlow_4001 = createControlFlow_4001();
243
244
		/**
245
		 * @generated 
246
		 */
247
		private static LinkConstraints createControlFlow_4001() {
248
			Map sourceEnv = new HashMap(3);
249
			sourceEnv.put("oppositeEnd", org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getActivityNode()); //$NON-NLS-1$				
250
			UMLAbstractExpression sourceExpression = UMLOCLFactory.getExpression("self.oclIsKindOf(uml::ObjectNode) implies self.oclAsType(uml::ObjectNode).isControlType", //$NON-NLS-1$
251
					UMLPackage.eINSTANCE.getActivityNode(), sourceEnv);
252
			Map targetEnv = new HashMap(3);
253
			targetEnv.put("oppositeEnd", org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getActivityNode()); //$NON-NLS-1$
254
			UMLAbstractExpression targetExpression = UMLOCLFactory.getExpression("self.oclIsKindOf(uml::ObjectNode) implies self.oclAsType(uml::ObjectNode).isControlType", //$NON-NLS-1$
255
					UMLPackage.eINSTANCE.getActivityNode(), targetEnv);
256
			return new LinkConstraints(sourceExpression, targetExpression);
257
		}
258
259
		/**
260
		 * @generated 
261
		 */
262
		private static final String OPPOSITE_END_VAR = "oppositeEnd"; //$NON-NLS-1$
263
264
		/**
265
		 * @generated 
266
		 */
267
		private UMLAbstractExpression srcEndInv;
268
269
		/**
270
		 * @generated 
271
		 */
272
		private UMLAbstractExpression targetEndInv;
273
274
		/**
275
		 * @generated 
276
		 */
277
		public LinkConstraints(UMLAbstractExpression sourceEnd, UMLAbstractExpression targetEnd) {
278
			this.srcEndInv = sourceEnd;
279
			this.targetEndInv = targetEnd;
280
		}
281
282
		/**
283
		 * @generated 
284
		 */
285
		public boolean canCreateLink(CreateRelationshipRequest req, boolean isBackDirected) {
286
			Object source = req.getSource();
287
			Object target = req.getTarget();
288
289
			UMLAbstractExpression sourceConstraint = isBackDirected ? targetEndInv : srcEndInv;
290
			UMLAbstractExpression targetConstraint = null;
291
			if (req.getTarget() != null) {
292
				targetConstraint = isBackDirected ? srcEndInv : targetEndInv;
293
			}
294
			boolean isSourceAccepted = sourceConstraint != null ? evaluate(sourceConstraint, source, target, false) : true;
295
			if (isSourceAccepted && targetConstraint != null) {
296
				return evaluate(targetConstraint, target, source, true);
297
			}
298
			return isSourceAccepted;
299
		}
300
301
		/**
302
		 * @generated 
303
		 */
304
		private static boolean evaluate(UMLAbstractExpression constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {
305
			Map evalEnv = Collections.singletonMap(OPPOSITE_END_VAR, oppositeEnd);
306
			try {
307
				Object val = constraint.evaluate(sourceEnd, evalEnv);
308
				return (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;
309
			} catch (Exception e) {
310
				UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
311
				return false;
312
			}
313
		}
314
	}
315
}
(-)src/org/eclipse/uml2/diagram/activity/edit/parts/UMLExtNodeLabelEditPart.java (+85 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.parts;
2
3
import org.eclipse.draw2d.IFigure;
4
import org.eclipse.draw2d.geometry.Dimension;
5
import org.eclipse.draw2d.geometry.Point;
6
import org.eclipse.gef.EditPolicy;
7
import org.eclipse.gef.GraphicalEditPart;
8
import org.eclipse.gef.Handle;
9
import org.eclipse.gef.handles.AbstractHandle;
10
import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
11
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
12
import org.eclipse.gmf.runtime.diagram.ui.figures.LabelLocator;
13
import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
14
import org.eclipse.gmf.runtime.notation.NotationPackage;
15
import org.eclipse.gmf.runtime.notation.View;
16
17
/**
18
 * @generated
19
 */
20
public class UMLExtNodeLabelEditPart extends LabelEditPart {
21
22
	/**
23
	 * @generated
24
	 */
25
	public UMLExtNodeLabelEditPart(View view) {
26
		super(view);
27
	}
28
29
	/**
30
	 * @generated
31
	 */
32
	protected void createDefaultEditPolicies() {
33
		super.createDefaultEditPolicies();
34
		installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableLabelEditPolicy() {
35
36
			protected void replaceHandleDragEditPartsTracker(Handle handle) {
37
				if (handle instanceof AbstractHandle) {
38
					((AbstractHandle) handle).setDragTracker(new DragEditPartsTrackerEx(getHost()) {
39
40
						protected boolean isMove() {
41
							return true;
42
						}
43
					});
44
				}
45
			}
46
		});
47
	}
48
49
	/**
50
	 * @generated
51
	 */
52
	public void refreshBounds() {
53
		IFigure refFigure = ((GraphicalEditPart) getParent()).getFigure();
54
		int dx = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
55
		int dy = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
56
		Point offset = new Point(dx, dy);
57
		getFigure().getParent().setConstraint(getFigure(), new LabelLocator(refFigure, offset, getKeyPoint()) {
58
59
			public void relocate(IFigure target) {
60
				Point location = getReferencePoint().getTranslated(getOffset());
61
				location.translate(-target.getBounds().width / 2, 0);
62
				target.setLocation(location);
63
				target.setSize(new Dimension(target.getPreferredSize().width, target.getPreferredSize().height));
64
			}
65
66
			protected Point getReferencePoint() {
67
				return getLabelLocation(parent);
68
			}
69
		});
70
	}
71
72
	/**
73
	 * @generated
74
	 */
75
	public Point getReferencePoint() {
76
		return getLabelLocation(((GraphicalEditPart) getParent()).getFigure());
77
	}
78
79
	/**
80
	 * @generated
81
	 */
82
	protected Point getLabelLocation(IFigure parent) {
83
		return parent.getBounds().getBottom();
84
	}
85
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/OpaqueActionItemSemanticEditPolicy.java (+245 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
12
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
13
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
14
import org.eclipse.gmf.runtime.notation.View;
15
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
16
import org.eclipse.uml2.uml.Activity;
17
import org.eclipse.uml2.uml.ActivityNode;
18
import org.eclipse.uml2.uml.ControlFlow;
19
import org.eclipse.uml2.uml.ObjectFlow;
20
import org.eclipse.uml2.uml.UMLPackage;
21
22
/**
23
 * @generated
24
 */
25
public class OpaqueActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
26
27
	/**
28
	 * @generated
29
	 */
30
	protected Command getCreateCommand(CreateElementRequest req) {
31
		if (UMLElementTypes.OutputPin_3001 == req.getElementType()) {
32
			if (req.getContainmentFeature() == null) {
33
				req.setContainmentFeature(UMLPackage.eINSTANCE.getOpaqueAction_OutputValue());
34
			}
35
			return getMSLWrapper(new CreateOutputPin_3001Command(req));
36
		}
37
		return super.getCreateCommand(req);
38
	}
39
40
	/**
41
	 * @generated
42
	 */
43
	private static class CreateOutputPin_3001Command extends CreateElementCommand {
44
45
		/**
46
		 * @generated
47
		 */
48
		public CreateOutputPin_3001Command(CreateElementRequest req) {
49
			super(req);
50
		}
51
52
		/**
53
		 * @generated
54
		 */
55
		protected EClass getEClassToEdit() {
56
			return UMLPackage.eINSTANCE.getOpaqueAction();
57
		};
58
59
		/**
60
		 * @generated
61
		 */
62
		protected EObject getElementToEdit() {
63
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
64
			if (container instanceof View) {
65
				container = ((View) container).getElement();
66
			}
67
			return container;
68
		}
69
	}
70
71
	/**
72
	 * @generated
73
	 */
74
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
75
		return getMSLWrapper(new DestroyElementCommand(req) {
76
77
			protected EObject getElementToDestroy() {
78
				View view = (View) getHost().getModel();
79
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
80
				if (annotation != null) {
81
					return view;
82
				}
83
				return super.getElementToDestroy();
84
			}
85
86
		});
87
	}
88
89
	/**
90
	 * @generated
91
	 */
92
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
93
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
94
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
95
		}
96
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
97
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
98
		}
99
		return super.getCreateRelationshipCommand(req);
100
	}
101
102
	/**
103
	 * @generated
104
	 */
105
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
106
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
107
			return UnexecutableCommand.INSTANCE;
108
		}
109
		return new Command() {
110
		};
111
	}
112
113
	/**
114
	 * @generated
115
	 */
116
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
117
		if (!(req.getSource() instanceof ActivityNode)) {
118
			return UnexecutableCommand.INSTANCE;
119
		}
120
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
121
		if (element == null) {
122
			return UnexecutableCommand.INSTANCE;
123
		}
124
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
125
			return UnexecutableCommand.INSTANCE;
126
		}
127
		if (req.getContainmentFeature() == null) {
128
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
129
		}
130
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
131
132
			protected EObject getElementToEdit() {
133
				return element;
134
			}
135
		});
136
	}
137
138
	/**
139
	 * @generated
140
	 */
141
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
142
143
		/**
144
		 * @generated
145
		 */
146
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
147
			super(req);
148
		}
149
150
		/**
151
		 * @generated
152
		 */
153
		protected EClass getEClassToEdit() {
154
			return UMLPackage.eINSTANCE.getActivity();
155
		};
156
157
		/**
158
		 * @generated
159
		 */
160
		protected void setElementToEdit(EObject element) {
161
			throw new UnsupportedOperationException();
162
		}
163
164
		/**
165
		 * @generated
166
		 */
167
		protected EObject doDefaultElementCreation() {
168
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
169
			if (newElement != null) {
170
				newElement.setTarget((ActivityNode) getTarget());
171
				newElement.setSource((ActivityNode) getSource());
172
			}
173
			return newElement;
174
		}
175
	}
176
177
	/**
178
	 * @generated
179
	 */
180
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
181
		return new Command() {
182
		};
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
189
		if (!(req.getSource() instanceof ActivityNode)) {
190
			return UnexecutableCommand.INSTANCE;
191
		}
192
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
193
		if (element == null) {
194
			return UnexecutableCommand.INSTANCE;
195
		}
196
		if (req.getContainmentFeature() == null) {
197
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
198
		}
199
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
200
201
			protected EObject getElementToEdit() {
202
				return element;
203
			}
204
		});
205
	}
206
207
	/**
208
	 * @generated
209
	 */
210
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
211
212
		/**
213
		 * @generated
214
		 */
215
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
216
			super(req);
217
		}
218
219
		/**
220
		 * @generated
221
		 */
222
		protected EClass getEClassToEdit() {
223
			return UMLPackage.eINSTANCE.getActivity();
224
		};
225
226
		/**
227
		 * @generated
228
		 */
229
		protected void setElementToEdit(EObject element) {
230
			throw new UnsupportedOperationException();
231
		}
232
233
		/**
234
		 * @generated
235
		 */
236
		protected EObject doDefaultElementCreation() {
237
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
238
			if (newElement != null) {
239
				newElement.setTarget((ActivityNode) getTarget());
240
				newElement.setSource((ActivityNode) getSource());
241
			}
242
			return newElement;
243
		}
244
	}
245
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPin4ViewFactory.java (+52 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.emf.ecore.EAnnotation;
8
import org.eclipse.emf.ecore.EcoreFactory;
9
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
10
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
11
import org.eclipse.gmf.runtime.notation.NotationFactory;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.edit.parts.ActivityEditPart;
14
import org.eclipse.uml2.diagram.activity.edit.parts.InputPinName4EditPart;
15
import org.eclipse.uml2.diagram.activity.part.UMLVisualIDRegistry;
16
17
/**
18
 * @generated
19
 */
20
public class InputPin4ViewFactory extends AbstractShapeViewFactory {
21
22
	/**
23
	 * @generated 
24
	 */
25
	protected List createStyles(View view) {
26
		List styles = new ArrayList();
27
		styles.add(NotationFactory.eINSTANCE.createFontStyle());
28
		styles.add(NotationFactory.eINSTANCE.createDescriptionStyle());
29
		styles.add(NotationFactory.eINSTANCE.createFillStyle());
30
		styles.add(NotationFactory.eINSTANCE.createLineStyle());
31
		return styles;
32
	}
33
34
	/**
35
	 * @generated
36
	 */
37
	protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
38
		if (semanticHint == null) {
39
			semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.activity.edit.parts.InputPin4EditPart.VISUAL_ID);
40
			view.setType(semanticHint);
41
		}
42
		super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
43
		if (!ActivityEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) {
44
			EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
45
			shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
46
			shortcutAnnotation.getDetails().put("modelID", ActivityEditPart.MODEL_ID); //$NON-NLS-1$
47
			view.getEAnnotations().add(shortcutAnnotation);
48
		}
49
		getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(InputPinName4EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
50
	}
51
52
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/ActivityItemSemanticEditPolicy.java (+726 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EClass;
4
import org.eclipse.emf.ecore.EObject;
5
import org.eclipse.emf.transaction.TransactionalEditingDomain;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
8
import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.AcceptEventAction;
15
import org.eclipse.uml2.uml.UMLPackage;
16
17
/**
18
 * @generated
19
 */
20
public class ActivityItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
21
22
	/**
23
	 * @generated
24
	 */
25
	protected Command getCreateCommand(CreateElementRequest req) {
26
		if (UMLElementTypes.AcceptEventAction_2001 == req.getElementType()) {
27
			if (req.getContainmentFeature() == null) {
28
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
29
			}
30
			return getMSLWrapper(new CreateAcceptEventAction_2001Command(req));
31
		}
32
		if (UMLElementTypes.AcceptEventAction_2002 == req.getElementType()) {
33
			if (req.getContainmentFeature() == null) {
34
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
35
			}
36
			return getMSLWrapper(new CreateAcceptEventAction_2002Command(req));
37
		}
38
		if (UMLElementTypes.ActivityFinalNode_2003 == req.getElementType()) {
39
			if (req.getContainmentFeature() == null) {
40
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
41
			}
42
			return getMSLWrapper(new CreateActivityFinalNode_2003Command(req));
43
		}
44
		if (UMLElementTypes.DecisionNode_2004 == req.getElementType()) {
45
			if (req.getContainmentFeature() == null) {
46
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
47
			}
48
			return getMSLWrapper(new CreateDecisionNode_2004Command(req));
49
		}
50
		if (UMLElementTypes.MergeNode_2005 == req.getElementType()) {
51
			if (req.getContainmentFeature() == null) {
52
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
53
			}
54
			return getMSLWrapper(new CreateMergeNode_2005Command(req));
55
		}
56
		if (UMLElementTypes.InitialNode_2006 == req.getElementType()) {
57
			if (req.getContainmentFeature() == null) {
58
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
59
			}
60
			return getMSLWrapper(new CreateInitialNode_2006Command(req));
61
		}
62
		if (UMLElementTypes.StructuredActivityNode_2007 == req.getElementType()) {
63
			if (req.getContainmentFeature() == null) {
64
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Group());
65
			}
66
			return getMSLWrapper(new CreateStructuredActivityNode_2007Command(req));
67
		}
68
		if (UMLElementTypes.DataStoreNode_2008 == req.getElementType()) {
69
			if (req.getContainmentFeature() == null) {
70
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
71
			}
72
			return getMSLWrapper(new CreateDataStoreNode_2008Command(req));
73
		}
74
		if (UMLElementTypes.CentralBufferNode_2009 == req.getElementType()) {
75
			if (req.getContainmentFeature() == null) {
76
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
77
			}
78
			return getMSLWrapper(new CreateCentralBufferNode_2009Command(req));
79
		}
80
		if (UMLElementTypes.OpaqueAction_2010 == req.getElementType()) {
81
			if (req.getContainmentFeature() == null) {
82
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
83
			}
84
			return getMSLWrapper(new CreateOpaqueAction_2010Command(req));
85
		}
86
		if (UMLElementTypes.FlowFinalNode_2011 == req.getElementType()) {
87
			if (req.getContainmentFeature() == null) {
88
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
89
			}
90
			return getMSLWrapper(new CreateFlowFinalNode_2011Command(req));
91
		}
92
		if (UMLElementTypes.ForkNode_2012 == req.getElementType()) {
93
			if (req.getContainmentFeature() == null) {
94
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
95
			}
96
			return getMSLWrapper(new CreateForkNode_2012Command(req));
97
		}
98
		if (UMLElementTypes.JoinNode_2013 == req.getElementType()) {
99
			if (req.getContainmentFeature() == null) {
100
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
101
			}
102
			return getMSLWrapper(new CreateJoinNode_2013Command(req));
103
		}
104
		if (UMLElementTypes.Pin_2014 == req.getElementType()) {
105
			if (req.getContainmentFeature() == null) {
106
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
107
			}
108
			return getMSLWrapper(new CreatePin_2014Command(req));
109
		}
110
		if (UMLElementTypes.CreateObjectAction_2015 == req.getElementType()) {
111
			if (req.getContainmentFeature() == null) {
112
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
113
			}
114
			return getMSLWrapper(new CreateCreateObjectAction_2015Command(req));
115
		}
116
		if (UMLElementTypes.AddStructuralFeatureValueAction_2016 == req.getElementType()) {
117
			if (req.getContainmentFeature() == null) {
118
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
119
			}
120
			return getMSLWrapper(new CreateAddStructuralFeatureValueAction_2016Command(req));
121
		}
122
		if (UMLElementTypes.CallBehaviorAction_2017 == req.getElementType()) {
123
			if (req.getContainmentFeature() == null) {
124
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
125
			}
126
			return getMSLWrapper(new CreateCallBehaviorAction_2017Command(req));
127
		}
128
		if (UMLElementTypes.CallOperationAction_2018 == req.getElementType()) {
129
			if (req.getContainmentFeature() == null) {
130
				req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Node());
131
			}
132
			return getMSLWrapper(new CreateCallOperationAction_2018Command(req));
133
		}
134
		return super.getCreateCommand(req);
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	private static class CreateAcceptEventAction_2001Command extends CreateElementCommand {
141
142
		/**
143
		 * @generated
144
		 */
145
		public CreateAcceptEventAction_2001Command(CreateElementRequest req) {
146
			super(req);
147
		}
148
149
		/**
150
		 * @generated
151
		 */
152
		protected EClass getEClassToEdit() {
153
			return UMLPackage.eINSTANCE.getActivity();
154
		};
155
156
		/**
157
		 * @generated
158
		 */
159
		protected EObject getElementToEdit() {
160
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
161
			if (container instanceof View) {
162
				container = ((View) container).getElement();
163
			}
164
			return container;
165
		}
166
	}
167
168
	/**
169
	 * @generated
170
	 */
171
	private static class CreateAcceptEventAction_2002Command extends CreateElementCommand {
172
173
		/**
174
		 * @generated
175
		 */
176
		public CreateAcceptEventAction_2002Command(CreateElementRequest req) {
177
			super(req);
178
		}
179
180
		/**
181
		 * @generated
182
		 */
183
		protected EClass getEClassToEdit() {
184
			return UMLPackage.eINSTANCE.getActivity();
185
		};
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject getElementToEdit() {
191
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
192
			if (container instanceof View) {
193
				container = ((View) container).getElement();
194
			}
195
			return container;
196
		}
197
198
		/**
199
		 * @generated
200
		 */
201
		protected EObject doDefaultElementCreation() {
202
			AcceptEventAction newElement = (AcceptEventAction) super.doDefaultElementCreation();
203
			if (newElement != null) {
204
				UMLElementTypes.Initializers.AcceptEventAction_2002.init(newElement);
205
			}
206
			return newElement;
207
		}
208
	}
209
210
	/**
211
	 * @generated
212
	 */
213
	private static class CreateActivityFinalNode_2003Command extends CreateElementCommand {
214
215
		/**
216
		 * @generated
217
		 */
218
		public CreateActivityFinalNode_2003Command(CreateElementRequest req) {
219
			super(req);
220
		}
221
222
		/**
223
		 * @generated
224
		 */
225
		protected EClass getEClassToEdit() {
226
			return UMLPackage.eINSTANCE.getActivity();
227
		};
228
229
		/**
230
		 * @generated
231
		 */
232
		protected EObject getElementToEdit() {
233
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
234
			if (container instanceof View) {
235
				container = ((View) container).getElement();
236
			}
237
			return container;
238
		}
239
	}
240
241
	/**
242
	 * @generated
243
	 */
244
	private static class CreateDecisionNode_2004Command extends CreateElementCommand {
245
246
		/**
247
		 * @generated
248
		 */
249
		public CreateDecisionNode_2004Command(CreateElementRequest req) {
250
			super(req);
251
		}
252
253
		/**
254
		 * @generated
255
		 */
256
		protected EClass getEClassToEdit() {
257
			return UMLPackage.eINSTANCE.getActivity();
258
		};
259
260
		/**
261
		 * @generated
262
		 */
263
		protected EObject getElementToEdit() {
264
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
265
			if (container instanceof View) {
266
				container = ((View) container).getElement();
267
			}
268
			return container;
269
		}
270
	}
271
272
	/**
273
	 * @generated
274
	 */
275
	private static class CreateMergeNode_2005Command extends CreateElementCommand {
276
277
		/**
278
		 * @generated
279
		 */
280
		public CreateMergeNode_2005Command(CreateElementRequest req) {
281
			super(req);
282
		}
283
284
		/**
285
		 * @generated
286
		 */
287
		protected EClass getEClassToEdit() {
288
			return UMLPackage.eINSTANCE.getActivity();
289
		};
290
291
		/**
292
		 * @generated
293
		 */
294
		protected EObject getElementToEdit() {
295
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
296
			if (container instanceof View) {
297
				container = ((View) container).getElement();
298
			}
299
			return container;
300
		}
301
	}
302
303
	/**
304
	 * @generated
305
	 */
306
	private static class CreateInitialNode_2006Command extends CreateElementCommand {
307
308
		/**
309
		 * @generated
310
		 */
311
		public CreateInitialNode_2006Command(CreateElementRequest req) {
312
			super(req);
313
		}
314
315
		/**
316
		 * @generated
317
		 */
318
		protected EClass getEClassToEdit() {
319
			return UMLPackage.eINSTANCE.getActivity();
320
		};
321
322
		/**
323
		 * @generated
324
		 */
325
		protected EObject getElementToEdit() {
326
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
327
			if (container instanceof View) {
328
				container = ((View) container).getElement();
329
			}
330
			return container;
331
		}
332
	}
333
334
	/**
335
	 * @generated
336
	 */
337
	private static class CreateStructuredActivityNode_2007Command extends CreateElementCommand {
338
339
		/**
340
		 * @generated
341
		 */
342
		public CreateStructuredActivityNode_2007Command(CreateElementRequest req) {
343
			super(req);
344
		}
345
346
		/**
347
		 * @generated
348
		 */
349
		protected EClass getEClassToEdit() {
350
			return UMLPackage.eINSTANCE.getActivity();
351
		};
352
353
		/**
354
		 * @generated
355
		 */
356
		protected EObject getElementToEdit() {
357
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
358
			if (container instanceof View) {
359
				container = ((View) container).getElement();
360
			}
361
			return container;
362
		}
363
	}
364
365
	/**
366
	 * @generated
367
	 */
368
	private static class CreateDataStoreNode_2008Command extends CreateElementCommand {
369
370
		/**
371
		 * @generated
372
		 */
373
		public CreateDataStoreNode_2008Command(CreateElementRequest req) {
374
			super(req);
375
		}
376
377
		/**
378
		 * @generated
379
		 */
380
		protected EClass getEClassToEdit() {
381
			return UMLPackage.eINSTANCE.getActivity();
382
		};
383
384
		/**
385
		 * @generated
386
		 */
387
		protected EObject getElementToEdit() {
388
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
389
			if (container instanceof View) {
390
				container = ((View) container).getElement();
391
			}
392
			return container;
393
		}
394
	}
395
396
	/**
397
	 * @generated
398
	 */
399
	private static class CreateCentralBufferNode_2009Command extends CreateElementCommand {
400
401
		/**
402
		 * @generated
403
		 */
404
		public CreateCentralBufferNode_2009Command(CreateElementRequest req) {
405
			super(req);
406
		}
407
408
		/**
409
		 * @generated
410
		 */
411
		protected EClass getEClassToEdit() {
412
			return UMLPackage.eINSTANCE.getActivity();
413
		};
414
415
		/**
416
		 * @generated
417
		 */
418
		protected EObject getElementToEdit() {
419
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
420
			if (container instanceof View) {
421
				container = ((View) container).getElement();
422
			}
423
			return container;
424
		}
425
	}
426
427
	/**
428
	 * @generated
429
	 */
430
	private static class CreateOpaqueAction_2010Command extends CreateElementCommand {
431
432
		/**
433
		 * @generated
434
		 */
435
		public CreateOpaqueAction_2010Command(CreateElementRequest req) {
436
			super(req);
437
		}
438
439
		/**
440
		 * @generated
441
		 */
442
		protected EClass getEClassToEdit() {
443
			return UMLPackage.eINSTANCE.getActivity();
444
		};
445
446
		/**
447
		 * @generated
448
		 */
449
		protected EObject getElementToEdit() {
450
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
451
			if (container instanceof View) {
452
				container = ((View) container).getElement();
453
			}
454
			return container;
455
		}
456
	}
457
458
	/**
459
	 * @generated
460
	 */
461
	private static class CreateFlowFinalNode_2011Command extends CreateElementCommand {
462
463
		/**
464
		 * @generated
465
		 */
466
		public CreateFlowFinalNode_2011Command(CreateElementRequest req) {
467
			super(req);
468
		}
469
470
		/**
471
		 * @generated
472
		 */
473
		protected EClass getEClassToEdit() {
474
			return UMLPackage.eINSTANCE.getActivity();
475
		};
476
477
		/**
478
		 * @generated
479
		 */
480
		protected EObject getElementToEdit() {
481
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
482
			if (container instanceof View) {
483
				container = ((View) container).getElement();
484
			}
485
			return container;
486
		}
487
	}
488
489
	/**
490
	 * @generated
491
	 */
492
	private static class CreateForkNode_2012Command extends CreateElementCommand {
493
494
		/**
495
		 * @generated
496
		 */
497
		public CreateForkNode_2012Command(CreateElementRequest req) {
498
			super(req);
499
		}
500
501
		/**
502
		 * @generated
503
		 */
504
		protected EClass getEClassToEdit() {
505
			return UMLPackage.eINSTANCE.getActivity();
506
		};
507
508
		/**
509
		 * @generated
510
		 */
511
		protected EObject getElementToEdit() {
512
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
513
			if (container instanceof View) {
514
				container = ((View) container).getElement();
515
			}
516
			return container;
517
		}
518
	}
519
520
	/**
521
	 * @generated
522
	 */
523
	private static class CreateJoinNode_2013Command extends CreateElementCommand {
524
525
		/**
526
		 * @generated
527
		 */
528
		public CreateJoinNode_2013Command(CreateElementRequest req) {
529
			super(req);
530
		}
531
532
		/**
533
		 * @generated
534
		 */
535
		protected EClass getEClassToEdit() {
536
			return UMLPackage.eINSTANCE.getActivity();
537
		};
538
539
		/**
540
		 * @generated
541
		 */
542
		protected EObject getElementToEdit() {
543
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
544
			if (container instanceof View) {
545
				container = ((View) container).getElement();
546
			}
547
			return container;
548
		}
549
	}
550
551
	/**
552
	 * @generated
553
	 */
554
	private static class CreatePin_2014Command extends CreateElementCommand {
555
556
		/**
557
		 * @generated
558
		 */
559
		public CreatePin_2014Command(CreateElementRequest req) {
560
			super(req);
561
		}
562
563
		/**
564
		 * @generated
565
		 */
566
		protected EClass getEClassToEdit() {
567
			return UMLPackage.eINSTANCE.getActivity();
568
		};
569
570
		/**
571
		 * @generated
572
		 */
573
		protected EObject getElementToEdit() {
574
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
575
			if (container instanceof View) {
576
				container = ((View) container).getElement();
577
			}
578
			return container;
579
		}
580
	}
581
582
	/**
583
	 * @generated
584
	 */
585
	private static class CreateCreateObjectAction_2015Command extends CreateElementCommand {
586
587
		/**
588
		 * @generated
589
		 */
590
		public CreateCreateObjectAction_2015Command(CreateElementRequest req) {
591
			super(req);
592
		}
593
594
		/**
595
		 * @generated
596
		 */
597
		protected EClass getEClassToEdit() {
598
			return UMLPackage.eINSTANCE.getActivity();
599
		};
600
601
		/**
602
		 * @generated
603
		 */
604
		protected EObject getElementToEdit() {
605
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
606
			if (container instanceof View) {
607
				container = ((View) container).getElement();
608
			}
609
			return container;
610
		}
611
	}
612
613
	/**
614
	 * @generated
615
	 */
616
	private static class CreateAddStructuralFeatureValueAction_2016Command extends CreateElementCommand {
617
618
		/**
619
		 * @generated
620
		 */
621
		public CreateAddStructuralFeatureValueAction_2016Command(CreateElementRequest req) {
622
			super(req);
623
		}
624
625
		/**
626
		 * @generated
627
		 */
628
		protected EClass getEClassToEdit() {
629
			return UMLPackage.eINSTANCE.getActivity();
630
		};
631
632
		/**
633
		 * @generated
634
		 */
635
		protected EObject getElementToEdit() {
636
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
637
			if (container instanceof View) {
638
				container = ((View) container).getElement();
639
			}
640
			return container;
641
		}
642
	}
643
644
	/**
645
	 * @generated
646
	 */
647
	private static class CreateCallBehaviorAction_2017Command extends CreateElementCommand {
648
649
		/**
650
		 * @generated
651
		 */
652
		public CreateCallBehaviorAction_2017Command(CreateElementRequest req) {
653
			super(req);
654
		}
655
656
		/**
657
		 * @generated
658
		 */
659
		protected EClass getEClassToEdit() {
660
			return UMLPackage.eINSTANCE.getActivity();
661
		};
662
663
		/**
664
		 * @generated
665
		 */
666
		protected EObject getElementToEdit() {
667
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
668
			if (container instanceof View) {
669
				container = ((View) container).getElement();
670
			}
671
			return container;
672
		}
673
	}
674
675
	/**
676
	 * @generated
677
	 */
678
	private static class CreateCallOperationAction_2018Command extends CreateElementCommand {
679
680
		/**
681
		 * @generated
682
		 */
683
		public CreateCallOperationAction_2018Command(CreateElementRequest req) {
684
			super(req);
685
		}
686
687
		/**
688
		 * @generated
689
		 */
690
		protected EClass getEClassToEdit() {
691
			return UMLPackage.eINSTANCE.getActivity();
692
		};
693
694
		/**
695
		 * @generated
696
		 */
697
		protected EObject getElementToEdit() {
698
			EObject container = ((CreateElementRequest) getRequest()).getContainer();
699
			if (container instanceof View) {
700
				container = ((View) container).getElement();
701
			}
702
			return container;
703
		}
704
	}
705
706
	/**
707
	 * @generated
708
	 */
709
	protected Command getDuplicateCommand(DuplicateElementsRequest req) {
710
		TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
711
		return getMSLWrapper(new DuplicateAnythingCommand(editingDomain, req));
712
	}
713
714
	/**
715
	 * @generated
716
	 */
717
	private static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {
718
719
		/**
720
		 * @generated
721
		 */
722
		public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {
723
			super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
724
		}
725
	}
726
}
(-)src/org/eclipse/uml2/diagram/activity/view/factories/InputPinName3ViewFactory.java (+39 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.view.factories;
2
3
import java.util.ArrayList;
4
import java.util.List;
5
6
import org.eclipse.core.runtime.IAdaptable;
7
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
8
import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
9
import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
10
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
11
import org.eclipse.gmf.runtime.notation.Location;
12
import org.eclipse.gmf.runtime.notation.Node;
13
import org.eclipse.gmf.runtime.notation.View;
14
15
/**
16
 * @generated
17
 */
18
public class InputPinName3ViewFactory extends AbstractLabelViewFactory {
19
20
	/**
21
	 * @generated
22
	 */
23
	public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
24
		Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
25
		Location location = (Location) view.getLayoutConstraint();
26
		IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
27
		location.setX(mapMode.DPtoLP(0));
28
		location.setY(mapMode.DPtoLP(5));
29
		return view;
30
	}
31
32
	/**
33
	 * @generated
34
	 */
35
	protected List createStyles(View view) {
36
		List styles = new ArrayList();
37
		return styles;
38
	}
39
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InputPinEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class InputPinEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/DecisionNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class DecisionNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/InputPin4EditHelperAdvice.java (+9 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
4
5
/**
6
 * @generated
7
 */
8
public class InputPin4EditHelperAdvice extends AbstractEditHelperAdvice {
9
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/StructuredActivityNodeEditHelper.java (+7 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
/**
4
 * @generated
5
 */
6
public class StructuredActivityNodeEditHelper extends UMLBaseEditHelper {
7
}
(-)src/org/eclipse/uml2/diagram/activity/part/UMLDiagramEditor.java (+207 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.part;
2
3
import org.eclipse.core.resources.IFile;
4
import org.eclipse.core.resources.IMarker;
5
import org.eclipse.core.resources.IWorkspaceRoot;
6
import org.eclipse.core.resources.ResourcesPlugin;
7
import org.eclipse.core.runtime.CoreException;
8
import org.eclipse.core.runtime.IPath;
9
import org.eclipse.core.runtime.IProgressMonitor;
10
import org.eclipse.core.runtime.IStatus;
11
import org.eclipse.core.runtime.NullProgressMonitor;
12
import org.eclipse.draw2d.DelegatingLayout;
13
import org.eclipse.draw2d.FreeformLayer;
14
import org.eclipse.draw2d.LayeredPane;
15
import org.eclipse.emf.transaction.TransactionalEditingDomain;
16
import org.eclipse.gef.LayerConstants;
17
import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
18
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
19
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart;
20
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
21
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDiagramDocumentProvider;
22
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
23
import org.eclipse.jface.dialogs.ErrorDialog;
24
import org.eclipse.jface.dialogs.IMessageProvider;
25
import org.eclipse.jface.dialogs.MessageDialog;
26
import org.eclipse.jface.window.Window;
27
import org.eclipse.osgi.util.NLS;
28
import org.eclipse.swt.widgets.Shell;
29
import org.eclipse.ui.IEditorInput;
30
import org.eclipse.ui.IEditorMatchingStrategy;
31
import org.eclipse.ui.IEditorReference;
32
import org.eclipse.ui.IFileEditorInput;
33
import org.eclipse.ui.PlatformUI;
34
import org.eclipse.ui.dialogs.SaveAsDialog;
35
import org.eclipse.ui.ide.IGotoMarker;
36
import org.eclipse.ui.part.FileEditorInput;
37
import org.eclipse.uml2.diagram.activity.edit.parts.UMLEditPartFactory;
38
39
/**
40
 * @generated
41
 */
42
public class UMLDiagramEditor extends DiagramDocumentEditor implements IGotoMarker {
43
44
	/**
45
	 * @generated
46
	 */
47
	public static final String ID = "org.eclipse.uml2.diagram.activity.part.UMLDiagramEditorID"; //$NON-NLS-1$
48
49
	/**
50
	 * @generated
51
	 */
52
	public UMLDiagramEditor() {
53
		super(true);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected String getEditingDomainID() {
60
		return "org.eclipse.uml2.diagram.activity.EditingDomain"; //$NON-NLS-1$
61
	}
62
63
	/**
64
	 * @generated
65
	 */
66
	protected TransactionalEditingDomain createEditingDomain() {
67
		TransactionalEditingDomain domain = super.createEditingDomain();
68
		domain.setID(getEditingDomainID());
69
		return domain;
70
	}
71
72
	/**
73
	 * @generated
74
	 */
75
	protected void configureGraphicalViewer() {
76
		super.configureGraphicalViewer();
77
		DiagramRootEditPart root = (DiagramRootEditPart) getDiagramGraphicalViewer().getRootEditPart();
78
		LayeredPane printableLayers = (LayeredPane) root.getLayer(LayerConstants.PRINTABLE_LAYERS);
79
		FreeformLayer extLabelsLayer = new FreeformLayer();
80
		extLabelsLayer.setLayoutManager(new DelegatingLayout());
81
		printableLayers.addLayerAfter(extLabelsLayer, UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER, LayerConstants.PRIMARY_LAYER);
82
		LayeredPane scalableLayers = (LayeredPane) root.getLayer(LayerConstants.SCALABLE_LAYERS);
83
		FreeformLayer scaledFeedbackLayer = new FreeformLayer();
84
		scaledFeedbackLayer.setEnabled(false);
85
		scalableLayers.addLayerAfter(scaledFeedbackLayer, LayerConstants.SCALED_FEEDBACK_LAYER, DiagramRootEditPart.DECORATION_UNPRINTABLE_LAYER);
86
	}
87
88
	/**
89
	 * @generated
90
	 */
91
	protected PreferencesHint getPreferencesHint() {
92
		return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
93
	}
94
95
	/**
96
	 * @generated
97
	 */
98
	public String getContributorId() {
99
		return UMLDiagramEditorPlugin.ID;
100
	}
101
102
	/**
103
	 * @generated
104
	 */
105
	private String contentObjectURI;
106
107
	/**
108
	 * @generated
109
	 */
110
	protected void setDocumentProvider(IEditorInput input) {
111
		if (input instanceof IFileEditorInput) {
112
			setDocumentProvider(new UMLDocumentProvider(contentObjectURI));
113
		} else {
114
			setDocumentProvider(new StorageDiagramDocumentProvider());
115
		}
116
	}
117
118
	/**
119
	 * @generated
120
	 */
121
	public void gotoMarker(IMarker marker) {
122
		MarkerNavigationService.getInstance().gotoMarker(this, marker);
123
	}
124
125
	/**
126
	 * @generated
127
	 */
128
	public boolean isSaveAsAllowed() {
129
		return true;
130
	}
131
132
	/**
133
	 * @generated
134
	 */
135
	public void doSaveAs() {
136
		performSaveAs(new NullProgressMonitor());
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected void performSaveAs(IProgressMonitor progressMonitor) {
143
		Shell shell = getSite().getShell();
144
		IEditorInput input = getEditorInput();
145
		SaveAsDialog dialog = new SaveAsDialog(shell);
146
		IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null;
147
		if (original != null) {
148
			dialog.setOriginalFile(original);
149
		}
150
		dialog.create();
151
		IDocumentProvider provider = getDocumentProvider();
152
		if (provider == null) {
153
			// editor has been programmatically closed while the dialog was open
154
			return;
155
		}
156
		if (provider.isDeleted(input) && original != null) {
157
			String message = NLS.bind("The original file ''{0}'' has been deleted.", original.getName());
158
			dialog.setErrorMessage(null);
159
			dialog.setMessage(message, IMessageProvider.WARNING);
160
		}
161
		if (dialog.open() == Window.CANCEL) {
162
			if (progressMonitor != null) {
163
				progressMonitor.setCanceled(true);
164
			}
165
			return;
166
		}
167
		IPath filePath = dialog.getResult();
168
		if (filePath == null) {
169
			if (progressMonitor != null) {
170
				progressMonitor.setCanceled(true);
171
			}
172
			return;
173
		}
174
		IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
175
		IFile file = workspaceRoot.getFile(filePath);
176
		final IEditorInput newInput = new FileEditorInput(file);
177
		// Check if the editor is already open
178
		IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
179
		IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
180
		for (int i = 0; i < editorRefs.length; i++) {
181
			if (matchingStrategy.matches(editorRefs[i], newInput)) {
182
				MessageDialog.openWarning(shell, "Problem During Save As...", "Save could not be completed. Target file is already open in another editor.");
183
				return;
184
			}
185
		}
186
		boolean success = false;
187
		try {
188
			provider.aboutToChange(newInput);
189
			getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
190
			success = true;
191
		} catch (CoreException x) {
192
			IStatus status = x.getStatus();
193
			if (status == null || status.getSeverity() != IStatus.CANCEL) {
194
				ErrorDialog.openError(shell, "Save Problems", "Could not save file.", x.getStatus());
195
			}
196
		} finally {
197
			provider.changed(newInput);
198
			if (success) {
199
				setInput(newInput);
200
			}
201
		}
202
		if (progressMonitor != null) {
203
			progressMonitor.setCanceled(!success);
204
		}
205
	}
206
207
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/OutputPin2ItemSemanticEditPolicy.java (+199 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.emf.ecore.EAnnotation;
4
import org.eclipse.emf.ecore.EClass;
5
import org.eclipse.emf.ecore.EObject;
6
import org.eclipse.gef.commands.Command;
7
import org.eclipse.gef.commands.UnexecutableCommand;
8
import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand;
9
import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
11
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
12
import org.eclipse.gmf.runtime.notation.View;
13
import org.eclipse.uml2.diagram.activity.providers.UMLElementTypes;
14
import org.eclipse.uml2.uml.Activity;
15
import org.eclipse.uml2.uml.ActivityNode;
16
import org.eclipse.uml2.uml.ControlFlow;
17
import org.eclipse.uml2.uml.ObjectFlow;
18
import org.eclipse.uml2.uml.UMLPackage;
19
20
/**
21
 * @generated
22
 */
23
public class OutputPin2ItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	protected Command getDestroyElementCommand(DestroyElementRequest req) {
29
		return getMSLWrapper(new DestroyElementCommand(req) {
30
31
			protected EObject getElementToDestroy() {
32
				View view = (View) getHost().getModel();
33
				EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
34
				if (annotation != null) {
35
					return view;
36
				}
37
				return super.getElementToDestroy();
38
			}
39
40
		});
41
	}
42
43
	/**
44
	 * @generated
45
	 */
46
	protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
47
		if (UMLElementTypes.ControlFlow_4001 == req.getElementType()) {
48
			return req.getTarget() == null ? getCreateStartOutgoingControlFlow4001Command(req) : getCreateCompleteIncomingControlFlow4001Command(req);
49
		}
50
		if (UMLElementTypes.ObjectFlow_4002 == req.getElementType()) {
51
			return req.getTarget() == null ? getCreateStartOutgoingObjectFlow4002Command(req) : getCreateCompleteIncomingObjectFlow4002Command(req);
52
		}
53
		return super.getCreateRelationshipCommand(req);
54
	}
55
56
	/**
57
	 * @generated
58
	 */
59
	protected Command getCreateStartOutgoingControlFlow4001Command(CreateRelationshipRequest req) {
60
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
61
			return UnexecutableCommand.INSTANCE;
62
		}
63
		return new Command() {
64
		};
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	protected Command getCreateCompleteIncomingControlFlow4001Command(CreateRelationshipRequest req) {
71
		if (!(req.getSource() instanceof ActivityNode)) {
72
			return UnexecutableCommand.INSTANCE;
73
		}
74
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
75
		if (element == null) {
76
			return UnexecutableCommand.INSTANCE;
77
		}
78
		if (!UMLBaseItemSemanticEditPolicy.LinkConstraints.ControlFlow_4001.canCreateLink(req, false)) {
79
			return UnexecutableCommand.INSTANCE;
80
		}
81
		if (req.getContainmentFeature() == null) {
82
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
83
		}
84
		return getMSLWrapper(new CreateIncomingControlFlow4001Command(req) {
85
86
			protected EObject getElementToEdit() {
87
				return element;
88
			}
89
		});
90
	}
91
92
	/**
93
	 * @generated
94
	 */
95
	private static class CreateIncomingControlFlow4001Command extends CreateRelationshipCommand {
96
97
		/**
98
		 * @generated
99
		 */
100
		public CreateIncomingControlFlow4001Command(CreateRelationshipRequest req) {
101
			super(req);
102
		}
103
104
		/**
105
		 * @generated
106
		 */
107
		protected EClass getEClassToEdit() {
108
			return UMLPackage.eINSTANCE.getActivity();
109
		};
110
111
		/**
112
		 * @generated
113
		 */
114
		protected void setElementToEdit(EObject element) {
115
			throw new UnsupportedOperationException();
116
		}
117
118
		/**
119
		 * @generated
120
		 */
121
		protected EObject doDefaultElementCreation() {
122
			ControlFlow newElement = (ControlFlow) super.doDefaultElementCreation();
123
			if (newElement != null) {
124
				newElement.setTarget((ActivityNode) getTarget());
125
				newElement.setSource((ActivityNode) getSource());
126
			}
127
			return newElement;
128
		}
129
	}
130
131
	/**
132
	 * @generated
133
	 */
134
	protected Command getCreateStartOutgoingObjectFlow4002Command(CreateRelationshipRequest req) {
135
		return new Command() {
136
		};
137
	}
138
139
	/**
140
	 * @generated
141
	 */
142
	protected Command getCreateCompleteIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
143
		if (!(req.getSource() instanceof ActivityNode)) {
144
			return UnexecutableCommand.INSTANCE;
145
		}
146
		final Activity element = (Activity) getRelationshipContainer(req.getSource(), UMLPackage.eINSTANCE.getActivity(), req.getElementType());
147
		if (element == null) {
148
			return UnexecutableCommand.INSTANCE;
149
		}
150
		if (req.getContainmentFeature() == null) {
151
			req.setContainmentFeature(UMLPackage.eINSTANCE.getActivity_Edge());
152
		}
153
		return getMSLWrapper(new CreateIncomingObjectFlow4002Command(req) {
154
155
			protected EObject getElementToEdit() {
156
				return element;
157
			}
158
		});
159
	}
160
161
	/**
162
	 * @generated
163
	 */
164
	private static class CreateIncomingObjectFlow4002Command extends CreateRelationshipCommand {
165
166
		/**
167
		 * @generated
168
		 */
169
		public CreateIncomingObjectFlow4002Command(CreateRelationshipRequest req) {
170
			super(req);
171
		}
172
173
		/**
174
		 * @generated
175
		 */
176
		protected EClass getEClassToEdit() {
177
			return UMLPackage.eINSTANCE.getActivity();
178
		};
179
180
		/**
181
		 * @generated
182
		 */
183
		protected void setElementToEdit(EObject element) {
184
			throw new UnsupportedOperationException();
185
		}
186
187
		/**
188
		 * @generated
189
		 */
190
		protected EObject doDefaultElementCreation() {
191
			ObjectFlow newElement = (ObjectFlow) super.doDefaultElementCreation();
192
			if (newElement != null) {
193
				newElement.setTarget((ActivityNode) getTarget());
194
				newElement.setSource((ActivityNode) getSource());
195
			}
196
			return newElement;
197
		}
198
	}
199
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/UMLTextSelectionEditPolicy.java (+192 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import org.eclipse.draw2d.ColorConstants;
4
import org.eclipse.draw2d.Figure;
5
import org.eclipse.draw2d.Graphics;
6
import org.eclipse.draw2d.IFigure;
7
import org.eclipse.draw2d.Label;
8
import org.eclipse.draw2d.RectangleFigure;
9
import org.eclipse.draw2d.geometry.Rectangle;
10
import org.eclipse.gef.LayerConstants;
11
import org.eclipse.gef.editpolicies.SelectionEditPolicy;
12
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel;
13
14
/**
15
 * @generated
16
 */
17
public class UMLTextSelectionEditPolicy extends SelectionEditPolicy {
18
19
	/**
20
	 * @generated
21
	 */
22
	private IFigure selectionFeedbackFigure;
23
24
	/**
25
	 * @generated
26
	 */
27
	private IFigure focusFeedbackFigure;
28
29
	/**
30
	 * @generated
31
	 */
32
	protected void showPrimarySelection() {
33
		if (getHostFigure() instanceof WrapLabel) {
34
			((WrapLabel) getHostFigure()).setSelected(true);
35
			((WrapLabel) getHostFigure()).setFocus(true);
36
		} else {
37
			showSelection();
38
			showFocus();
39
		}
40
	}
41
42
	/**
43
	 * @generated
44
	 */
45
	protected void showSelection() {
46
		if (getHostFigure() instanceof WrapLabel) {
47
			((WrapLabel) getHostFigure()).setSelected(true);
48
			((WrapLabel) getHostFigure()).setFocus(false);
49
		} else {
50
			hideSelection();
51
			addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
52
			refreshSelectionFeedback();
53
			hideFocus();
54
		}
55
	}
56
57
	/**
58
	 * @generated
59
	 */
60
	protected void hideSelection() {
61
		if (getHostFigure() instanceof WrapLabel) {
62
			((WrapLabel) getHostFigure()).setSelected(false);
63
			((WrapLabel) getHostFigure()).setFocus(false);
64
		} else {
65
			if (selectionFeedbackFigure != null) {
66
				removeFeedback(selectionFeedbackFigure);
67
				selectionFeedbackFigure = null;
68
			}
69
			hideFocus();
70
		}
71
	}
72
73
	/**
74
	 * @generated
75
	 */
76
	protected void showFocus() {
77
		if (getHostFigure() instanceof WrapLabel) {
78
			((WrapLabel) getHostFigure()).setFocus(true);
79
		} else {
80
			hideFocus();
81
			addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
82
			refreshFocusFeedback();
83
		}
84
	}
85
86
	/**
87
	 * @generated
88
	 */
89
	protected void hideFocus() {
90
		if (getHostFigure() instanceof WrapLabel) {
91
			((WrapLabel) getHostFigure()).setFocus(false);
92
		} else {
93
			if (focusFeedbackFigure != null) {
94
				removeFeedback(focusFeedbackFigure);
95
				focusFeedbackFigure = null;
96
			}
97
		}
98
	}
99
100
	/**
101
	 * @generated
102
	 */
103
	protected IFigure getFeedbackLayer() {
104
		return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
105
	}
106
107
	/**
108
	 * @generated
109
	 */
110
	protected Rectangle getFeedbackBounds() {
111
		Rectangle bounds;
112
		if (getHostFigure() instanceof Label) {
113
			bounds = ((Label) getHostFigure()).getTextBounds();
114
			bounds.intersect(getHostFigure().getBounds());
115
		} else {
116
			bounds = getHostFigure().getBounds().getCopy();
117
		}
118
		getHostFigure().getParent().translateToAbsolute(bounds);
119
		getFeedbackLayer().translateToRelative(bounds);
120
		return bounds;
121
	}
122
123
	/**
124
	 * @generated
125
	 */
126
	protected IFigure createSelectionFeedbackFigure() {
127
		if (getHostFigure() instanceof Label) {
128
			Label feedbackFigure = new Label();
129
			feedbackFigure.setOpaque(true);
130
			feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
131
			feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
132
			return feedbackFigure;
133
		} else {
134
			RectangleFigure feedbackFigure = new RectangleFigure();
135
			feedbackFigure.setFill(false);
136
			return feedbackFigure;
137
		}
138
	}
139
140
	/**
141
	 * @generated
142
	 */
143
	protected IFigure createFocusFeedbackFigure() {
144
		return new Figure() {
145
146
			protected void paintFigure(Graphics graphics) {
147
				graphics.drawFocus(getBounds().getResized(-1, -1));
148
			}
149
		};
150
	}
151
152
	/**
153
	 * @generated
154
	 */
155
	protected void updateLabel(Label target) {
156
		Label source = (Label) getHostFigure();
157
		target.setText(source.getText());
158
		target.setTextAlignment(source.getTextAlignment());
159
		target.setFont(source.getFont());
160
	}
161
162
	/**
163
	 * @generated
164
	 */
165
	protected void refreshSelectionFeedback() {
166
		if (selectionFeedbackFigure != null) {
167
			if (selectionFeedbackFigure instanceof Label) {
168
				updateLabel((Label) selectionFeedbackFigure);
169
				selectionFeedbackFigure.setBounds(getFeedbackBounds());
170
			} else {
171
				selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
172
			}
173
		}
174
	}
175
176
	/**
177
	 * @generated
178
	 */
179
	protected void refreshFocusFeedback() {
180
		if (focusFeedbackFigure != null) {
181
			focusFeedbackFigure.setBounds(getFeedbackBounds());
182
		}
183
	}
184
185
	/**
186
	 * @generated
187
	 */
188
	public void refreshFeedback() {
189
		refreshSelectionFeedback();
190
		refreshFocusFeedback();
191
	}
192
}
(-)src/org/eclipse/uml2/diagram/activity/edit/commands/UMLReorientConnectionViewCommand.java (+69 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.commands;
2
3
import java.util.List;
4
5
import org.eclipse.core.runtime.IAdaptable;
6
import org.eclipse.core.runtime.IProgressMonitor;
7
import org.eclipse.emf.transaction.TransactionalEditingDomain;
8
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
9
import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
10
import org.eclipse.gmf.runtime.notation.Edge;
11
import org.eclipse.gmf.runtime.notation.View;
12
13
/**
14
 * @generated
15
 */
16
public class UMLReorientConnectionViewCommand extends AbstractTransactionalCommand {
17
18
	/**
19
	 * @generated
20
	 */
21
	private IAdaptable edgeAdaptor;
22
23
	/**
24
	 * @generated
25
	 */
26
	public UMLReorientConnectionViewCommand(TransactionalEditingDomain editingDomain, String label) {
27
		super(editingDomain, label, null);
28
	}
29
30
	/**
31
	 * @generated
32
	 */
33
	public List getAffectedFiles() {
34
		View view = (View) edgeAdaptor.getAdapter(View.class);
35
		if (view != null) {
36
			return getWorkspaceFiles(view);
37
		}
38
		return super.getAffectedFiles();
39
	}
40
41
	/**
42
	 * @generated
43
	 */
44
	public IAdaptable getEdgeAdaptor() {
45
		return edgeAdaptor;
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	public void setEdgeAdaptor(IAdaptable edgeAdaptor) {
52
		this.edgeAdaptor = edgeAdaptor;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {
59
		assert null != edgeAdaptor : "Null child in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
60
		Edge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class);
61
		assert null != edge : "Null edge in UMLReorientConnectionViewCommand"; //$NON-NLS-1$
62
63
		View tempView = edge.getSource();
64
		edge.setSource(edge.getTarget());
65
		edge.setTarget(tempView);
66
67
		return CommandResult.newOKCommandResult();
68
	}
69
}
(-)src/org/eclipse/uml2/diagram/activity/edit/policies/UMLExtNodeLabelHostLayoutEditPolicy.java (+211 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.policies;
2
3
import java.util.ArrayList;
4
import java.util.Iterator;
5
import java.util.List;
6
7
import org.eclipse.draw2d.geometry.Rectangle;
8
import org.eclipse.gef.EditPart;
9
import org.eclipse.gef.GraphicalEditPart;
10
import org.eclipse.gef.Request;
11
import org.eclipse.gef.commands.Command;
12
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
13
import org.eclipse.gef.requests.ChangeBoundsRequest;
14
import org.eclipse.gef.requests.GroupRequest;
15
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
16
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
17
import org.eclipse.gmf.runtime.notation.NotationPackage;
18
import org.eclipse.gmf.runtime.notation.View;
19
20
/**
21
 * @generated
22
 */
23
public class UMLExtNodeLabelHostLayoutEditPolicy extends XYLayoutEditPolicy {
24
25
	/**
26
	 * @generated
27
	 */
28
	private LayoutEditPolicy realLayoutEditPolicy;
29
30
	/**
31
	 * @generated
32
	 */
33
	public LayoutEditPolicy getRealLayoutEditPolicy() {
34
		return realLayoutEditPolicy;
35
	}
36
37
	/**
38
	 * @generated
39
	 */
40
	public void setRealLayoutEditPolicy(LayoutEditPolicy realLayoutEditPolicy) {
41
		this.realLayoutEditPolicy = realLayoutEditPolicy;
42
	}
43
44
	/**
45
	 * @generated
46
	 */
47
	protected boolean isExternalLabel(EditPart editPart) {
48
		return false;
49
	}
50
51
	/**
52
	 * @generated
53
	 */
54
	protected final List getExternalLabels(GroupRequest request) {
55
		List editParts = new ArrayList();
56
		if (request.getEditParts() != null) {
57
			for (Iterator it = request.getEditParts().iterator(); it.hasNext();) {
58
				EditPart editPart = (EditPart) it.next();
59
				if (isExternalLabel(editPart)) {
60
					editParts.add(editPart);
61
				}
62
			}
63
		}
64
		return editParts;
65
	}
66
67
	/**
68
	 * @generated
69
	 */
70
	public Command getCommand(Request request) {
71
		if (REQ_MOVE_CHILDREN.equals(request.getType())) {
72
			ChangeBoundsRequest cbRequest = (ChangeBoundsRequest) request;
73
			List extLabels = getExternalLabels(cbRequest);
74
			if (!extLabels.isEmpty()) {
75
				List editParts = cbRequest.getEditParts();
76
				Command cmd = null;
77
				if (realLayoutEditPolicy != null && editParts.size() > extLabels.size()) {
78
					List other = new ArrayList(editParts);
79
					other.removeAll(extLabels);
80
					cbRequest.setEditParts(other);
81
					cmd = realLayoutEditPolicy.getCommand(request);
82
				}
83
				cbRequest.setEditParts(extLabels);
84
				Command extLabelsCmd = getMoveChildrenCommand(request);
85
				cbRequest.setEditParts(editParts);
86
				return cmd == null ? extLabelsCmd : cmd.chain(extLabelsCmd);
87
			}
88
		}
89
		if (request instanceof GroupRequest) {
90
			List extLabels = getExternalLabels((GroupRequest) request);
91
			if (!extLabels.isEmpty()) {
92
				return null;
93
			}
94
		}
95
		return realLayoutEditPolicy == null ? null : realLayoutEditPolicy.getCommand(request);
96
	}
97
98
	/**
99
	 * @generated
100
	 */
101
	protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
102
		int dx = ((Integer) ViewUtil.getStructuralFeatureValue((View) child.getModel(), NotationPackage.eINSTANCE.getLocation_X())).intValue();
103
		int dy = ((Integer) ViewUtil.getStructuralFeatureValue((View) child.getModel(), NotationPackage.eINSTANCE.getLocation_Y())).intValue();
104
		Rectangle r = new Rectangle(dx, dy, 0, 0);
105
		child.getFigure().translateToAbsolute(r);
106
		r.translate(request.getMoveDelta());
107
		child.getFigure().translateToRelative(r);
108
		return r;
109
	}
110
111
	/**
112
	 * @generated
113
	 */
114
	public boolean understandsRequest(Request req) {
115
		if (realLayoutEditPolicy != null && realLayoutEditPolicy.understandsRequest(req)) {
116
			return true;
117
		}
118
		return super.understandsRequest(req);
119
	}
120
121
	/**
122
	 * @generated
123
	 */
124
	protected void decorateChild(EditPart child) {
125
	}
126
127
	/**
128
	 * @generated
129
	 */
130
	public void setHost(EditPart host) {
131
		super.setHost(host);
132
		if (realLayoutEditPolicy != null) {
133
			realLayoutEditPolicy.setHost(host);
134
		}
135
	}
136
137
	/**
138
	 * @generated
139
	 */
140
	public void activate() {
141
		super.activate();
142
		if (realLayoutEditPolicy != null) {
143
			realLayoutEditPolicy.activate();
144
		}
145
	}
146
147
	/**
148
	 * @generated
149
	 */
150
	public void deactivate() {
151
		super.deactivate();
152
		if (realLayoutEditPolicy != null) {
153
			realLayoutEditPolicy.deactivate();
154
		}
155
	}
156
157
	/**
158
	 * @generated
159
	 */
160
	public EditPart getTargetEditPart(Request request) {
161
		if (realLayoutEditPolicy != null) {
162
			return realLayoutEditPolicy.getTargetEditPart(request);
163
		} else {
164
			return super.getTargetEditPart(request);
165
		}
166
	}
167
168
	/**
169
	 * @generated
170
	 */
171
	public void showSourceFeedback(Request request) {
172
		if (realLayoutEditPolicy != null) {
173
			realLayoutEditPolicy.showSourceFeedback(request);
174
		} else {
175
			super.showSourceFeedback(request);
176
		}
177
	}
178
179
	/**
180
	 * @generated
181
	 */
182
	public void eraseSourceFeedback(Request request) {
183
		if (realLayoutEditPolicy != null) {
184
			realLayoutEditPolicy.eraseSourceFeedback(request);
185
		} else {
186
			super.eraseSourceFeedback(request);
187
		}
188
	}
189
190
	/**
191
	 * @generated
192
	 */
193
	public void showTargetFeedback(Request request) {
194
		if (realLayoutEditPolicy != null) {
195
			realLayoutEditPolicy.showTargetFeedback(request);
196
		} else {
197
			super.showTargetFeedback(request);
198
		}
199
	}
200
201
	/**
202
	 * @generated
203
	 */
204
	public void eraseTargetFeedback(Request request) {
205
		if (realLayoutEditPolicy != null) {
206
			realLayoutEditPolicy.eraseTargetFeedback(request);
207
		} else {
208
			super.eraseTargetFeedback(request);
209
		}
210
	}
211
}
(-)src/org/eclipse/uml2/diagram/activity/edit/helpers/UMLBaseEditHelper.java (+68 lines)
Added Link Here
1
package org.eclipse.uml2.diagram.activity.edit.helpers;
2
3
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
4
import org.eclipse.gmf.runtime.common.core.command.ICommand;
5
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
6
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
7
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
8
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
9
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
10
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
11
12
/**
13
 * @generated
14
 */
15
public class UMLBaseEditHelper extends AbstractEditHelper {
16
17
	/**
18
	 * @generated
19
	 */
20
	public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
21
22
	/**
23
	 * @generated
24
	 */
25
	protected ICommand getInsteadCommand(IEditCommandRequest req) {
26
		ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
27
		req.setParameter(EDIT_POLICY_COMMAND, null);
28
		ICommand ehCommand = super.getInsteadCommand(req);
29
		if (epCommand == null) {
30
			return ehCommand;
31
		}
32
		if (ehCommand == null) {
33
			return epCommand;
34
		}
35
		CompositeCommand command = new CompositeCommand(null);
36
		command.add(epCommand);
37
		command.add(ehCommand);
38
		return command;
39
	}
40
41
	/**
42
	 * @generated
43
	 */
44
	protected ICommand getCreateCommand(CreateElementRequest req) {
45
		return null;
46
	}
47
48
	/**
49
	 * @generated
50
	 */
51
	protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
52
		return null;
53
	}
54
55
	/**
56
	 * @generated
57
	 */
58
	protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
59
		return null;
60
	}
61
62
	/**
63
	 * @generated
64
	 */
65
	protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
66
		return null;
67
	}
68
}

Return to bug 161574