1 | /* |
2 | *Copyright 2007, SDQ, IPD, University of Karlsruhe |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.usage.providers; |
5 | |
6 | import java.util.ArrayList; |
7 | |
8 | import org.eclipse.core.runtime.IAdaptable; |
9 | import org.eclipse.emf.ecore.EAnnotation; |
10 | import org.eclipse.emf.ecore.EObject; |
11 | import org.eclipse.emf.ecore.EcoreFactory; |
12 | import org.eclipse.emf.transaction.util.TransactionUtil; |
13 | import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; |
14 | import org.eclipse.gmf.runtime.common.core.service.IOperation; |
15 | import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; |
16 | import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider; |
17 | import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation; |
18 | import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation; |
19 | import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation; |
20 | import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation; |
21 | import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation; |
22 | import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; |
23 | import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants; |
24 | import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; |
25 | import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; |
26 | import org.eclipse.gmf.runtime.emf.type.core.IElementType; |
27 | import org.eclipse.gmf.runtime.emf.type.core.IHintedType; |
28 | import org.eclipse.gmf.runtime.notation.Connector; |
29 | import org.eclipse.gmf.runtime.notation.DecorationNode; |
30 | import org.eclipse.gmf.runtime.notation.Diagram; |
31 | import org.eclipse.gmf.runtime.notation.Edge; |
32 | import org.eclipse.gmf.runtime.notation.FontStyle; |
33 | import org.eclipse.gmf.runtime.notation.MeasurementUnit; |
34 | import org.eclipse.gmf.runtime.notation.Node; |
35 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
36 | import org.eclipse.gmf.runtime.notation.NotationPackage; |
37 | import org.eclipse.gmf.runtime.notation.RelativeBendpoints; |
38 | import org.eclipse.gmf.runtime.notation.Routing; |
39 | import org.eclipse.gmf.runtime.notation.Shape; |
40 | import org.eclipse.gmf.runtime.notation.TitleStyle; |
41 | import org.eclipse.gmf.runtime.notation.View; |
42 | import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; |
43 | import org.eclipse.jface.preference.IPreferenceStore; |
44 | import org.eclipse.jface.preference.PreferenceConverter; |
45 | import org.eclipse.swt.SWT; |
46 | import org.eclipse.swt.graphics.FontData; |
47 | |
48 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.AbstractUserActionSuccessorEditPart; |
49 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchEditPart; |
50 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchTransitionBranchProbabilityEditPart; |
51 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchTransitionEditPart; |
52 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.BranchUsageBranchTransitionsCompartmentEditPart; |
53 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadEditPart; |
54 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadPopulationEditPart; |
55 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadThinkTimeLabelEditPart; |
56 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ClosedWorkloadTitleLabelEditPart; |
57 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ComponentExternalCallNameLabelEditPart; |
58 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayEditPart; |
59 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayEntityNameEditPart; |
60 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.DelayLabelSpecEditPart; |
61 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallEditPart; |
62 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.EntryLevelSystemCallParameterUsageEditPart; |
63 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.LoopEditPart; |
64 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.OpenWorkloadEditPart; |
65 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.OpenWorkloadSpecLabelEditPart; |
66 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviour2EditPart; |
67 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviour3EditPart; |
68 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourEditPart; |
69 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart; |
70 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart; |
71 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart; |
72 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StartEditPart; |
73 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.StopEditPart; |
74 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageLoopIterationsLabelEditPart; |
75 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenario2EditPart; |
76 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioEditPart; |
77 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioLabelEditPart; |
78 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.UsageScenarioUsageScenarioCompartmentEditPart; |
79 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableCharacterisationEditPart; |
80 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableUsageEditPart; |
81 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.VariableUsageVariableCharacterisationEditPart; |
82 | import de.uka.ipd.sdq.pcm.gmf.usage.edit.parts.WrappingLabelEditPart; |
83 | import de.uka.ipd.sdq.pcm.gmf.usage.part.PalladioComponentModelVisualIDRegistry; |
84 | |
85 | /** |
86 | * @generated |
87 | */ |
88 | public class PalladioComponentModelViewProvider extends AbstractProvider |
89 | implements IViewProvider { |
90 | |
91 | /** |
92 | * @generated |
93 | */ |
94 | public final boolean provides(IOperation operation) { |
95 | if (operation instanceof CreateViewForKindOperation) { |
96 | return provides((CreateViewForKindOperation) operation); |
97 | } |
98 | assert operation instanceof CreateViewOperation; |
99 | if (operation instanceof CreateDiagramViewOperation) { |
100 | return provides((CreateDiagramViewOperation) operation); |
101 | } else if (operation instanceof CreateEdgeViewOperation) { |
102 | return provides((CreateEdgeViewOperation) operation); |
103 | } else if (operation instanceof CreateNodeViewOperation) { |
104 | return provides((CreateNodeViewOperation) operation); |
105 | } |
106 | return false; |
107 | } |
108 | |
109 | /** |
110 | * @generated |
111 | */ |
112 | protected boolean provides(CreateViewForKindOperation op) { |
113 | /* |
114 | if (op.getViewKind() == Node.class) |
115 | return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null; |
116 | if (op.getViewKind() == Edge.class) |
117 | return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null; |
118 | */ |
119 | return true; |
120 | } |
121 | |
122 | /** |
123 | * @generated |
124 | */ |
125 | protected boolean provides(CreateDiagramViewOperation op) { |
126 | return UsageScenarioEditPart.MODEL_ID.equals(op.getSemanticHint()) |
127 | && PalladioComponentModelVisualIDRegistry |
128 | .getDiagramVisualID(getSemanticElement(op |
129 | .getSemanticAdapter())) != -1; |
130 | } |
131 | |
132 | /** |
133 | * @generated |
134 | */ |
135 | protected boolean provides(CreateNodeViewOperation op) { |
136 | if (op.getContainerView() == null) { |
137 | return false; |
138 | } |
139 | IElementType elementType = getSemanticElementType(op |
140 | .getSemanticAdapter()); |
141 | EObject domainElement = getSemanticElement(op.getSemanticAdapter()); |
142 | int visualID; |
143 | if (op.getSemanticHint() == null) { |
144 | // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy. |
145 | // In this situation there should be NO elementType, visualID will be determined |
146 | // by VisualIDRegistry.getNodeVisualID() for domainElement. |
147 | if (elementType != null || domainElement == null) { |
148 | return false; |
149 | } |
150 | visualID = PalladioComponentModelVisualIDRegistry.getNodeVisualID( |
151 | op.getContainerView(), domainElement); |
152 | } else { |
153 | visualID = PalladioComponentModelVisualIDRegistry.getVisualID(op |
154 | .getSemanticHint()); |
155 | if (elementType != null) { |
156 | if (!PalladioComponentModelElementTypes |
157 | .isKnownElementType(elementType) |
158 | || (!(elementType instanceof IHintedType))) { |
159 | return false; // foreign element type |
160 | } |
161 | String elementTypeHint = ((IHintedType) elementType) |
162 | .getSemanticHint(); |
163 | if (!op.getSemanticHint().equals(elementTypeHint)) { |
164 | return false; // if semantic hint is specified it should be the same as in element type |
165 | } |
166 | if (domainElement != null |
167 | && visualID != PalladioComponentModelVisualIDRegistry |
168 | .getNodeVisualID(op.getContainerView(), |
169 | domainElement)) { |
170 | return false; // visual id for node EClass should match visual id from element type |
171 | } |
172 | } else { |
173 | if (!UsageScenarioEditPart.MODEL_ID |
174 | .equals(PalladioComponentModelVisualIDRegistry |
175 | .getModelID(op.getContainerView()))) { |
176 | return false; // foreign diagram |
177 | } |
178 | switch (visualID) { |
179 | case UsageScenario2EditPart.VISUAL_ID: |
180 | case ScenarioBehaviourEditPart.VISUAL_ID: |
181 | case StartEditPart.VISUAL_ID: |
182 | case StopEditPart.VISUAL_ID: |
183 | case EntryLevelSystemCallEditPart.VISUAL_ID: |
184 | case VariableUsageEditPart.VISUAL_ID: |
185 | case VariableCharacterisationEditPart.VISUAL_ID: |
186 | case LoopEditPart.VISUAL_ID: |
187 | case BranchEditPart.VISUAL_ID: |
188 | case BranchTransitionEditPart.VISUAL_ID: |
189 | case DelayEditPart.VISUAL_ID: |
190 | case ClosedWorkloadEditPart.VISUAL_ID: |
191 | case OpenWorkloadEditPart.VISUAL_ID: |
192 | case ScenarioBehaviour2EditPart.VISUAL_ID: |
193 | case ScenarioBehaviour3EditPart.VISUAL_ID: |
194 | if (domainElement == null |
195 | || visualID != PalladioComponentModelVisualIDRegistry |
196 | .getNodeVisualID(op.getContainerView(), |
197 | domainElement)) { |
198 | return false; // visual id in semantic hint should match visual id for domain element |
199 | } |
200 | break; |
201 | default: |
202 | return false; |
203 | } |
204 | } |
205 | } |
206 | return UsageScenario2EditPart.VISUAL_ID == visualID |
207 | || ScenarioBehaviourEditPart.VISUAL_ID == visualID |
208 | || StartEditPart.VISUAL_ID == visualID |
209 | || StopEditPart.VISUAL_ID == visualID |
210 | || EntryLevelSystemCallEditPart.VISUAL_ID == visualID |
211 | || VariableUsageEditPart.VISUAL_ID == visualID |
212 | || VariableCharacterisationEditPart.VISUAL_ID == visualID |
213 | || LoopEditPart.VISUAL_ID == visualID |
214 | || ScenarioBehaviour2EditPart.VISUAL_ID == visualID |
215 | || BranchEditPart.VISUAL_ID == visualID |
216 | || BranchTransitionEditPart.VISUAL_ID == visualID |
217 | || ScenarioBehaviour3EditPart.VISUAL_ID == visualID |
218 | || DelayEditPart.VISUAL_ID == visualID |
219 | || ClosedWorkloadEditPart.VISUAL_ID == visualID |
220 | || OpenWorkloadEditPart.VISUAL_ID == visualID; |
221 | } |
222 | |
223 | /** |
224 | * @generated |
225 | */ |
226 | protected boolean provides(CreateEdgeViewOperation op) { |
227 | IElementType elementType = getSemanticElementType(op |
228 | .getSemanticAdapter()); |
229 | if (!PalladioComponentModelElementTypes.isKnownElementType(elementType) |
230 | || (!(elementType instanceof IHintedType))) { |
231 | return false; // foreign element type |
232 | } |
233 | String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); |
234 | if (elementTypeHint == null |
235 | || (op.getSemanticHint() != null && !elementTypeHint.equals(op |
236 | .getSemanticHint()))) { |
237 | return false; // our hint is visual id and must be specified, and it should be the same as in element type |
238 | } |
239 | int visualID = PalladioComponentModelVisualIDRegistry |
240 | .getVisualID(elementTypeHint); |
241 | EObject domainElement = getSemanticElement(op.getSemanticAdapter()); |
242 | if (domainElement != null |
243 | && visualID != PalladioComponentModelVisualIDRegistry |
244 | .getLinkWithClassVisualID(domainElement)) { |
245 | return false; // visual id for link EClass should match visual id from element type |
246 | } |
247 | return true; |
248 | } |
249 | |
250 | /** |
251 | * @generated |
252 | */ |
253 | public Diagram createDiagram(IAdaptable semanticAdapter, |
254 | String diagramKind, PreferencesHint preferencesHint) { |
255 | Diagram diagram = NotationFactory.eINSTANCE.createDiagram(); |
256 | diagram.getStyles().add(NotationFactory.eINSTANCE.createDiagramStyle()); |
257 | diagram.setType(UsageScenarioEditPart.MODEL_ID); |
258 | diagram.setElement(getSemanticElement(semanticAdapter)); |
259 | diagram.setMeasurementUnit(MeasurementUnit.PIXEL_LITERAL); |
260 | return diagram; |
261 | } |
262 | |
263 | /** |
264 | * @generated |
265 | */ |
266 | public Node createNode(IAdaptable semanticAdapter, View containerView, |
267 | String semanticHint, int index, boolean persisted, |
268 | PreferencesHint preferencesHint) { |
269 | final EObject domainElement = getSemanticElement(semanticAdapter); |
270 | final int visualID; |
271 | if (semanticHint == null) { |
272 | visualID = PalladioComponentModelVisualIDRegistry.getNodeVisualID( |
273 | containerView, domainElement); |
274 | } else { |
275 | visualID = PalladioComponentModelVisualIDRegistry |
276 | .getVisualID(semanticHint); |
277 | } |
278 | switch (visualID) { |
279 | case UsageScenario2EditPart.VISUAL_ID: |
280 | return createUsageScenario_2004(domainElement, containerView, |
281 | index, persisted, preferencesHint); |
282 | case ScenarioBehaviourEditPart.VISUAL_ID: |
283 | return createScenarioBehaviour_3014(domainElement, containerView, |
284 | index, persisted, preferencesHint); |
285 | case StartEditPart.VISUAL_ID: |
286 | return createStart_3001(domainElement, containerView, index, |
287 | persisted, preferencesHint); |
288 | case StopEditPart.VISUAL_ID: |
289 | return createStop_3002(domainElement, containerView, index, |
290 | persisted, preferencesHint); |
291 | case EntryLevelSystemCallEditPart.VISUAL_ID: |
292 | return createEntryLevelSystemCall_3003(domainElement, |
293 | containerView, index, persisted, preferencesHint); |
294 | case VariableUsageEditPart.VISUAL_ID: |
295 | return createVariableUsage_3012(domainElement, containerView, |
296 | index, persisted, preferencesHint); |
297 | case VariableCharacterisationEditPart.VISUAL_ID: |
298 | return createVariableCharacterisation_3013(domainElement, |
299 | containerView, index, persisted, preferencesHint); |
300 | case LoopEditPart.VISUAL_ID: |
301 | return createLoop_3005(domainElement, containerView, index, |
302 | persisted, preferencesHint); |
303 | case ScenarioBehaviour2EditPart.VISUAL_ID: |
304 | return createScenarioBehaviour_3007(domainElement, containerView, |
305 | index, persisted, preferencesHint); |
306 | case BranchEditPart.VISUAL_ID: |
307 | return createBranch_3008(domainElement, containerView, index, |
308 | persisted, preferencesHint); |
309 | case BranchTransitionEditPart.VISUAL_ID: |
310 | return createBranchTransition_3009(domainElement, containerView, |
311 | index, persisted, preferencesHint); |
312 | case ScenarioBehaviour3EditPart.VISUAL_ID: |
313 | return createScenarioBehaviour_3010(domainElement, containerView, |
314 | index, persisted, preferencesHint); |
315 | case DelayEditPart.VISUAL_ID: |
316 | return createDelay_3017(domainElement, containerView, index, |
317 | persisted, preferencesHint); |
318 | case ClosedWorkloadEditPart.VISUAL_ID: |
319 | return createClosedWorkload_3015(domainElement, containerView, |
320 | index, persisted, preferencesHint); |
321 | case OpenWorkloadEditPart.VISUAL_ID: |
322 | return createOpenWorkload_3016(domainElement, containerView, index, |
323 | persisted, preferencesHint); |
324 | } |
325 | // can't happen, provided #provides(CreateNodeViewOperation) is correct |
326 | return null; |
327 | } |
328 | |
329 | /** |
330 | * @generated |
331 | */ |
332 | public Edge createEdge(IAdaptable semanticAdapter, View containerView, |
333 | String semanticHint, int index, boolean persisted, |
334 | PreferencesHint preferencesHint) { |
335 | IElementType elementType = getSemanticElementType(semanticAdapter); |
336 | String elementTypeHint = ((IHintedType) elementType).getSemanticHint(); |
337 | switch (PalladioComponentModelVisualIDRegistry |
338 | .getVisualID(elementTypeHint)) { |
339 | case AbstractUserActionSuccessorEditPart.VISUAL_ID: |
340 | return createAbstractUserActionSuccessor_4002(containerView, index, |
341 | persisted, preferencesHint); |
342 | } |
343 | // can never happen, provided #provides(CreateEdgeViewOperation) is correct |
344 | return null; |
345 | } |
346 | |
347 | /** |
348 | * @generated |
349 | */ |
350 | public Node createUsageScenario_2004(EObject domainElement, |
351 | View containerView, int index, boolean persisted, |
352 | PreferencesHint preferencesHint) { |
353 | Node node = NotationFactory.eINSTANCE.createNode(); |
354 | node.getStyles() |
355 | .add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
356 | node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
357 | node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle()); |
358 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
359 | node.setType(PalladioComponentModelVisualIDRegistry |
360 | .getType(UsageScenario2EditPart.VISUAL_ID)); |
361 | ViewUtil.insertChildView(containerView, node, index, persisted); |
362 | node.setElement(domainElement); |
363 | stampShortcut(containerView, node); |
364 | // initializeFromPreferences |
365 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
366 | .getPreferenceStore(); |
367 | FontStyle nodeFontStyle = (FontStyle) node |
368 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
369 | if (nodeFontStyle != null) { |
370 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
371 | IPreferenceConstants.PREF_DEFAULT_FONT); |
372 | nodeFontStyle.setFontName(fontData.getName()); |
373 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
374 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
375 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
376 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
377 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
378 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
379 | .intValue()); |
380 | } |
381 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
382 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
383 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
384 | .getFillStyle_FillColor(), FigureUtilities |
385 | .RGBToInteger(fillRGB)); |
386 | Node label5017 = createLabel(node, |
387 | PalladioComponentModelVisualIDRegistry |
388 | .getType(UsageScenarioLabelEditPart.VISUAL_ID)); |
389 | createCompartment( |
390 | node, |
391 | PalladioComponentModelVisualIDRegistry |
392 | .getType(UsageScenarioUsageScenarioCompartmentEditPart.VISUAL_ID), |
393 | false, false, false, false); |
394 | return node; |
395 | } |
396 | |
397 | /** |
398 | * @generated |
399 | */ |
400 | public Node createScenarioBehaviour_3014(EObject domainElement, |
401 | View containerView, int index, boolean persisted, |
402 | PreferencesHint preferencesHint) { |
403 | Shape node = NotationFactory.eINSTANCE.createShape(); |
404 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
405 | node.setType(PalladioComponentModelVisualIDRegistry |
406 | .getType(ScenarioBehaviourEditPart.VISUAL_ID)); |
407 | ViewUtil.insertChildView(containerView, node, index, persisted); |
408 | node.setElement(domainElement); |
409 | // initializeFromPreferences |
410 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
411 | .getPreferenceStore(); |
412 | |
413 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
414 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
415 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
416 | .getLineStyle_LineColor(), FigureUtilities |
417 | .RGBToInteger(lineRGB)); |
418 | FontStyle nodeFontStyle = (FontStyle) node |
419 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
420 | if (nodeFontStyle != null) { |
421 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
422 | IPreferenceConstants.PREF_DEFAULT_FONT); |
423 | nodeFontStyle.setFontName(fontData.getName()); |
424 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
425 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
426 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
427 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
428 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
429 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
430 | .intValue()); |
431 | } |
432 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
433 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
434 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
435 | .getFillStyle_FillColor(), FigureUtilities |
436 | .RGBToInteger(fillRGB)); |
437 | createCompartment( |
438 | node, |
439 | PalladioComponentModelVisualIDRegistry |
440 | .getType(ScenarioBehaviourScenarioBehaviourStepsCompartmentEditPart.VISUAL_ID), |
441 | false, false, false, false); |
442 | return node; |
443 | } |
444 | |
445 | /** |
446 | * @generated |
447 | */ |
448 | public Node createStart_3001(EObject domainElement, View containerView, |
449 | int index, boolean persisted, PreferencesHint preferencesHint) { |
450 | Node node = NotationFactory.eINSTANCE.createNode(); |
451 | node.getStyles() |
452 | .add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
453 | node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
454 | node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle()); |
455 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
456 | node.setType(PalladioComponentModelVisualIDRegistry |
457 | .getType(StartEditPart.VISUAL_ID)); |
458 | ViewUtil.insertChildView(containerView, node, index, persisted); |
459 | node.setElement(domainElement); |
460 | // initializeFromPreferences |
461 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
462 | .getPreferenceStore(); |
463 | |
464 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
465 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
466 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
467 | .getLineStyle_LineColor(), FigureUtilities |
468 | .RGBToInteger(lineRGB)); |
469 | FontStyle nodeFontStyle = (FontStyle) node |
470 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
471 | if (nodeFontStyle != null) { |
472 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
473 | IPreferenceConstants.PREF_DEFAULT_FONT); |
474 | nodeFontStyle.setFontName(fontData.getName()); |
475 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
476 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
477 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
478 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
479 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
480 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
481 | .intValue()); |
482 | } |
483 | return node; |
484 | } |
485 | |
486 | /** |
487 | * @generated |
488 | */ |
489 | public Node createStop_3002(EObject domainElement, View containerView, |
490 | int index, boolean persisted, PreferencesHint preferencesHint) { |
491 | Shape node = NotationFactory.eINSTANCE.createShape(); |
492 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
493 | node.setType(PalladioComponentModelVisualIDRegistry |
494 | .getType(StopEditPart.VISUAL_ID)); |
495 | ViewUtil.insertChildView(containerView, node, index, persisted); |
496 | node.setElement(domainElement); |
497 | // initializeFromPreferences |
498 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
499 | .getPreferenceStore(); |
500 | |
501 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
502 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
503 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
504 | .getLineStyle_LineColor(), FigureUtilities |
505 | .RGBToInteger(lineRGB)); |
506 | FontStyle nodeFontStyle = (FontStyle) node |
507 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
508 | if (nodeFontStyle != null) { |
509 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
510 | IPreferenceConstants.PREF_DEFAULT_FONT); |
511 | nodeFontStyle.setFontName(fontData.getName()); |
512 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
513 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
514 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
515 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
516 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
517 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
518 | .intValue()); |
519 | } |
520 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
521 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
522 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
523 | .getFillStyle_FillColor(), FigureUtilities |
524 | .RGBToInteger(fillRGB)); |
525 | return node; |
526 | } |
527 | |
528 | /** |
529 | * @generated |
530 | */ |
531 | public Node createEntryLevelSystemCall_3003(EObject domainElement, |
532 | View containerView, int index, boolean persisted, |
533 | PreferencesHint preferencesHint) { |
534 | Shape node = NotationFactory.eINSTANCE.createShape(); |
535 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
536 | node.setType(PalladioComponentModelVisualIDRegistry |
537 | .getType(EntryLevelSystemCallEditPart.VISUAL_ID)); |
538 | ViewUtil.insertChildView(containerView, node, index, persisted); |
539 | node.setElement(domainElement); |
540 | // initializeFromPreferences |
541 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
542 | .getPreferenceStore(); |
543 | |
544 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
545 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
546 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
547 | .getLineStyle_LineColor(), FigureUtilities |
548 | .RGBToInteger(lineRGB)); |
549 | FontStyle nodeFontStyle = (FontStyle) node |
550 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
551 | if (nodeFontStyle != null) { |
552 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
553 | IPreferenceConstants.PREF_DEFAULT_FONT); |
554 | nodeFontStyle.setFontName(fontData.getName()); |
555 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
556 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
557 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
558 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
559 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
560 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
561 | .intValue()); |
562 | } |
563 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
564 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
565 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
566 | .getFillStyle_FillColor(), FigureUtilities |
567 | .RGBToInteger(fillRGB)); |
568 | Node label5004 = createLabel( |
569 | node, |
570 | PalladioComponentModelVisualIDRegistry |
571 | .getType(ComponentExternalCallNameLabelEditPart.VISUAL_ID)); |
572 | createCompartment(node, PalladioComponentModelVisualIDRegistry |
573 | .getType(EntryLevelSystemCallParameterUsageEditPart.VISUAL_ID), |
574 | false, false, true, true); |
575 | return node; |
576 | } |
577 | |
578 | /** |
579 | * @generated |
580 | */ |
581 | public Node createVariableUsage_3012(EObject domainElement, |
582 | View containerView, int index, boolean persisted, |
583 | PreferencesHint preferencesHint) { |
584 | Node node = NotationFactory.eINSTANCE.createNode(); |
585 | node.getStyles() |
586 | .add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
587 | node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
588 | node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle()); |
589 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
590 | node.setType(PalladioComponentModelVisualIDRegistry |
591 | .getType(VariableUsageEditPart.VISUAL_ID)); |
592 | ViewUtil.insertChildView(containerView, node, index, persisted); |
593 | node.setElement(domainElement); |
594 | // initializeFromPreferences |
595 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
596 | .getPreferenceStore(); |
597 | |
598 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
599 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
600 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
601 | .getLineStyle_LineColor(), FigureUtilities |
602 | .RGBToInteger(lineRGB)); |
603 | FontStyle nodeFontStyle = (FontStyle) node |
604 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
605 | if (nodeFontStyle != null) { |
606 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
607 | IPreferenceConstants.PREF_DEFAULT_FONT); |
608 | nodeFontStyle.setFontName(fontData.getName()); |
609 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
610 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
611 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
612 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
613 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
614 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
615 | .intValue()); |
616 | } |
617 | Node label5012 = createLabel(node, |
618 | PalladioComponentModelVisualIDRegistry |
619 | .getType(WrappingLabelEditPart.VISUAL_ID)); |
620 | createCompartment( |
621 | node, |
622 | PalladioComponentModelVisualIDRegistry |
623 | .getType(VariableUsageVariableCharacterisationEditPart.VISUAL_ID), |
624 | true, true, true, true); |
625 | return node; |
626 | } |
627 | |
628 | /** |
629 | * @generated |
630 | */ |
631 | public Node createVariableCharacterisation_3013(EObject domainElement, |
632 | View containerView, int index, boolean persisted, |
633 | PreferencesHint preferencesHint) { |
634 | Node node = NotationFactory.eINSTANCE.createNode(); |
635 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); |
636 | node.setType(PalladioComponentModelVisualIDRegistry |
637 | .getType(VariableCharacterisationEditPart.VISUAL_ID)); |
638 | ViewUtil.insertChildView(containerView, node, index, persisted); |
639 | node.setElement(domainElement); |
640 | return node; |
641 | } |
642 | |
643 | /** |
644 | * @generated |
645 | */ |
646 | public Node createLoop_3005(EObject domainElement, View containerView, |
647 | int index, boolean persisted, PreferencesHint preferencesHint) { |
648 | Shape node = NotationFactory.eINSTANCE.createShape(); |
649 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
650 | node.setType(PalladioComponentModelVisualIDRegistry |
651 | .getType(LoopEditPart.VISUAL_ID)); |
652 | ViewUtil.insertChildView(containerView, node, index, persisted); |
653 | node.setElement(domainElement); |
654 | // initializeFromPreferences |
655 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
656 | .getPreferenceStore(); |
657 | |
658 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
659 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
660 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
661 | .getLineStyle_LineColor(), FigureUtilities |
662 | .RGBToInteger(lineRGB)); |
663 | FontStyle nodeFontStyle = (FontStyle) node |
664 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
665 | if (nodeFontStyle != null) { |
666 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
667 | IPreferenceConstants.PREF_DEFAULT_FONT); |
668 | nodeFontStyle.setFontName(fontData.getName()); |
669 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
670 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
671 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
672 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
673 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
674 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
675 | .intValue()); |
676 | } |
677 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
678 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
679 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
680 | .getFillStyle_FillColor(), FigureUtilities |
681 | .RGBToInteger(fillRGB)); |
682 | Node label5005 = createLabel(node, |
683 | PalladioComponentModelVisualIDRegistry |
684 | .getType(UsageLoopIterationsLabelEditPart.VISUAL_ID)); |
685 | return node; |
686 | } |
687 | |
688 | /** |
689 | * @generated |
690 | */ |
691 | public Node createScenarioBehaviour_3007(EObject domainElement, |
692 | View containerView, int index, boolean persisted, |
693 | PreferencesHint preferencesHint) { |
694 | Shape node = NotationFactory.eINSTANCE.createShape(); |
695 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
696 | node.setType(PalladioComponentModelVisualIDRegistry |
697 | .getType(ScenarioBehaviour2EditPart.VISUAL_ID)); |
698 | ViewUtil.insertChildView(containerView, node, index, persisted); |
699 | node.setElement(domainElement); |
700 | // initializeFromPreferences |
701 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
702 | .getPreferenceStore(); |
703 | |
704 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
705 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
706 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
707 | .getLineStyle_LineColor(), FigureUtilities |
708 | .RGBToInteger(lineRGB)); |
709 | FontStyle nodeFontStyle = (FontStyle) node |
710 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
711 | if (nodeFontStyle != null) { |
712 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
713 | IPreferenceConstants.PREF_DEFAULT_FONT); |
714 | nodeFontStyle.setFontName(fontData.getName()); |
715 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
716 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
717 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
718 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
719 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
720 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
721 | .intValue()); |
722 | } |
723 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
724 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
725 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
726 | .getFillStyle_FillColor(), FigureUtilities |
727 | .RGBToInteger(fillRGB)); |
728 | createCompartment( |
729 | node, |
730 | PalladioComponentModelVisualIDRegistry |
731 | .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment2EditPart.VISUAL_ID), |
732 | false, false, false, false); |
733 | return node; |
734 | } |
735 | |
736 | /** |
737 | * @generated |
738 | */ |
739 | public Node createBranch_3008(EObject domainElement, View containerView, |
740 | int index, boolean persisted, PreferencesHint preferencesHint) { |
741 | Shape node = NotationFactory.eINSTANCE.createShape(); |
742 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
743 | node.setType(PalladioComponentModelVisualIDRegistry |
744 | .getType(BranchEditPart.VISUAL_ID)); |
745 | ViewUtil.insertChildView(containerView, node, index, persisted); |
746 | node.setElement(domainElement); |
747 | // initializeFromPreferences |
748 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
749 | .getPreferenceStore(); |
750 | |
751 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
752 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
753 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
754 | .getLineStyle_LineColor(), FigureUtilities |
755 | .RGBToInteger(lineRGB)); |
756 | FontStyle nodeFontStyle = (FontStyle) node |
757 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
758 | if (nodeFontStyle != null) { |
759 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
760 | IPreferenceConstants.PREF_DEFAULT_FONT); |
761 | nodeFontStyle.setFontName(fontData.getName()); |
762 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
763 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
764 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
765 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
766 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
767 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
768 | .intValue()); |
769 | } |
770 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
771 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
772 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
773 | .getFillStyle_FillColor(), FigureUtilities |
774 | .RGBToInteger(fillRGB)); |
775 | createCompartment( |
776 | node, |
777 | PalladioComponentModelVisualIDRegistry |
778 | .getType(BranchUsageBranchTransitionsCompartmentEditPart.VISUAL_ID), |
779 | false, false, false, false); |
780 | return node; |
781 | } |
782 | |
783 | /** |
784 | * @generated |
785 | */ |
786 | public Node createBranchTransition_3009(EObject domainElement, |
787 | View containerView, int index, boolean persisted, |
788 | PreferencesHint preferencesHint) { |
789 | Shape node = NotationFactory.eINSTANCE.createShape(); |
790 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
791 | node.setType(PalladioComponentModelVisualIDRegistry |
792 | .getType(BranchTransitionEditPart.VISUAL_ID)); |
793 | ViewUtil.insertChildView(containerView, node, index, persisted); |
794 | node.setElement(domainElement); |
795 | // initializeFromPreferences |
796 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
797 | .getPreferenceStore(); |
798 | |
799 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
800 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
801 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
802 | .getLineStyle_LineColor(), FigureUtilities |
803 | .RGBToInteger(lineRGB)); |
804 | FontStyle nodeFontStyle = (FontStyle) node |
805 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
806 | if (nodeFontStyle != null) { |
807 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
808 | IPreferenceConstants.PREF_DEFAULT_FONT); |
809 | nodeFontStyle.setFontName(fontData.getName()); |
810 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
811 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
812 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
813 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
814 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
815 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
816 | .intValue()); |
817 | } |
818 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
819 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
820 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
821 | .getFillStyle_FillColor(), FigureUtilities |
822 | .RGBToInteger(fillRGB)); |
823 | Node label5007 = createLabel( |
824 | node, |
825 | PalladioComponentModelVisualIDRegistry |
826 | .getType(BranchTransitionBranchProbabilityEditPart.VISUAL_ID)); |
827 | return node; |
828 | } |
829 | |
830 | /** |
831 | * @generated |
832 | */ |
833 | public Node createScenarioBehaviour_3010(EObject domainElement, |
834 | View containerView, int index, boolean persisted, |
835 | PreferencesHint preferencesHint) { |
836 | Shape node = NotationFactory.eINSTANCE.createShape(); |
837 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
838 | node.setType(PalladioComponentModelVisualIDRegistry |
839 | .getType(ScenarioBehaviour3EditPart.VISUAL_ID)); |
840 | ViewUtil.insertChildView(containerView, node, index, persisted); |
841 | node.setElement(domainElement); |
842 | // initializeFromPreferences |
843 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
844 | .getPreferenceStore(); |
845 | |
846 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
847 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
848 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
849 | .getLineStyle_LineColor(), FigureUtilities |
850 | .RGBToInteger(lineRGB)); |
851 | FontStyle nodeFontStyle = (FontStyle) node |
852 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
853 | if (nodeFontStyle != null) { |
854 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
855 | IPreferenceConstants.PREF_DEFAULT_FONT); |
856 | nodeFontStyle.setFontName(fontData.getName()); |
857 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
858 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
859 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
860 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
861 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
862 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
863 | .intValue()); |
864 | } |
865 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
866 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
867 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
868 | .getFillStyle_FillColor(), FigureUtilities |
869 | .RGBToInteger(fillRGB)); |
870 | createCompartment( |
871 | node, |
872 | PalladioComponentModelVisualIDRegistry |
873 | .getType(ScenarioBehaviourScenarioBehaviourStepsCompartment3EditPart.VISUAL_ID), |
874 | false, false, false, false); |
875 | return node; |
876 | } |
877 | |
878 | /** |
879 | * @generated |
880 | */ |
881 | public Node createDelay_3017(EObject domainElement, View containerView, |
882 | int index, boolean persisted, PreferencesHint preferencesHint) { |
883 | Shape node = NotationFactory.eINSTANCE.createShape(); |
884 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
885 | node.setType(PalladioComponentModelVisualIDRegistry |
886 | .getType(DelayEditPart.VISUAL_ID)); |
887 | ViewUtil.insertChildView(containerView, node, index, persisted); |
888 | node.setElement(domainElement); |
889 | // initializeFromPreferences |
890 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
891 | .getPreferenceStore(); |
892 | |
893 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
894 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
895 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
896 | .getLineStyle_LineColor(), FigureUtilities |
897 | .RGBToInteger(lineRGB)); |
898 | FontStyle nodeFontStyle = (FontStyle) node |
899 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
900 | if (nodeFontStyle != null) { |
901 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
902 | IPreferenceConstants.PREF_DEFAULT_FONT); |
903 | nodeFontStyle.setFontName(fontData.getName()); |
904 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
905 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
906 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
907 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
908 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
909 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
910 | .intValue()); |
911 | } |
912 | org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor( |
913 | prefStore, IPreferenceConstants.PREF_FILL_COLOR); |
914 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
915 | .getFillStyle_FillColor(), FigureUtilities |
916 | .RGBToInteger(fillRGB)); |
917 | Node label5018 = createLabel(node, |
918 | PalladioComponentModelVisualIDRegistry |
919 | .getType(DelayEntityNameEditPart.VISUAL_ID)); |
920 | Node label5019 = createLabel(node, |
921 | PalladioComponentModelVisualIDRegistry |
922 | .getType(DelayLabelSpecEditPart.VISUAL_ID)); |
923 | return node; |
924 | } |
925 | |
926 | /** |
927 | * @generated |
928 | */ |
929 | public Node createClosedWorkload_3015(EObject domainElement, |
930 | View containerView, int index, boolean persisted, |
931 | PreferencesHint preferencesHint) { |
932 | Node node = NotationFactory.eINSTANCE.createNode(); |
933 | node.getStyles() |
934 | .add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
935 | node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
936 | node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle()); |
937 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
938 | node.setType(PalladioComponentModelVisualIDRegistry |
939 | .getType(ClosedWorkloadEditPart.VISUAL_ID)); |
940 | ViewUtil.insertChildView(containerView, node, index, persisted); |
941 | node.setElement(domainElement); |
942 | // initializeFromPreferences |
943 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
944 | .getPreferenceStore(); |
945 | |
946 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
947 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
948 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
949 | .getLineStyle_LineColor(), FigureUtilities |
950 | .RGBToInteger(lineRGB)); |
951 | FontStyle nodeFontStyle = (FontStyle) node |
952 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
953 | if (nodeFontStyle != null) { |
954 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
955 | IPreferenceConstants.PREF_DEFAULT_FONT); |
956 | nodeFontStyle.setFontName(fontData.getName()); |
957 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
958 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
959 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
960 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
961 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
962 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
963 | .intValue()); |
964 | } |
965 | Node label5013 = createLabel(node, |
966 | PalladioComponentModelVisualIDRegistry |
967 | .getType(ClosedWorkloadPopulationEditPart.VISUAL_ID)); |
968 | Node label5014 = createLabel(node, |
969 | PalladioComponentModelVisualIDRegistry |
970 | .getType(ClosedWorkloadTitleLabelEditPart.VISUAL_ID)); |
971 | Node label5015 = createLabel( |
972 | node, |
973 | PalladioComponentModelVisualIDRegistry |
974 | .getType(ClosedWorkloadThinkTimeLabelEditPart.VISUAL_ID)); |
975 | return node; |
976 | } |
977 | |
978 | /** |
979 | * @generated |
980 | */ |
981 | public Node createOpenWorkload_3016(EObject domainElement, |
982 | View containerView, int index, boolean persisted, |
983 | PreferencesHint preferencesHint) { |
984 | Node node = NotationFactory.eINSTANCE.createNode(); |
985 | node.getStyles() |
986 | .add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
987 | node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
988 | node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle()); |
989 | node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); |
990 | node.setType(PalladioComponentModelVisualIDRegistry |
991 | .getType(OpenWorkloadEditPart.VISUAL_ID)); |
992 | ViewUtil.insertChildView(containerView, node, index, persisted); |
993 | node.setElement(domainElement); |
994 | // initializeFromPreferences |
995 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
996 | .getPreferenceStore(); |
997 | |
998 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
999 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
1000 | ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE |
1001 | .getLineStyle_LineColor(), FigureUtilities |
1002 | .RGBToInteger(lineRGB)); |
1003 | FontStyle nodeFontStyle = (FontStyle) node |
1004 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
1005 | if (nodeFontStyle != null) { |
1006 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
1007 | IPreferenceConstants.PREF_DEFAULT_FONT); |
1008 | nodeFontStyle.setFontName(fontData.getName()); |
1009 | nodeFontStyle.setFontHeight(fontData.getHeight()); |
1010 | nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
1011 | nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
1012 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
1013 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
1014 | nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
1015 | .intValue()); |
1016 | } |
1017 | Node label5016 = createLabel(node, |
1018 | PalladioComponentModelVisualIDRegistry |
1019 | .getType(OpenWorkloadSpecLabelEditPart.VISUAL_ID)); |
1020 | return node; |
1021 | } |
1022 | |
1023 | /** |
1024 | * @generated |
1025 | */ |
1026 | public Edge createAbstractUserActionSuccessor_4002(View containerView, |
1027 | int index, boolean persisted, PreferencesHint preferencesHint) { |
1028 | Connector edge = NotationFactory.eINSTANCE.createConnector(); |
1029 | edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |
1030 | RelativeBendpoints bendpoints = NotationFactory.eINSTANCE |
1031 | .createRelativeBendpoints(); |
1032 | ArrayList points = new ArrayList(2); |
1033 | points.add(new RelativeBendpoint()); |
1034 | points.add(new RelativeBendpoint()); |
1035 | bendpoints.setPoints(points); |
1036 | edge.setBendpoints(bendpoints); |
1037 | ViewUtil.insertChildView(containerView, edge, index, persisted); |
1038 | edge.setType(PalladioComponentModelVisualIDRegistry |
1039 | .getType(AbstractUserActionSuccessorEditPart.VISUAL_ID)); |
1040 | edge.setElement(null); |
1041 | // initializePreferences |
1042 | final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint |
1043 | .getPreferenceStore(); |
1044 | |
1045 | org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor( |
1046 | prefStore, IPreferenceConstants.PREF_LINE_COLOR); |
1047 | ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE |
1048 | .getLineStyle_LineColor(), FigureUtilities |
1049 | .RGBToInteger(lineRGB)); |
1050 | FontStyle edgeFontStyle = (FontStyle) edge |
1051 | .getStyle(NotationPackage.Literals.FONT_STYLE); |
1052 | if (edgeFontStyle != null) { |
1053 | FontData fontData = PreferenceConverter.getFontData(prefStore, |
1054 | IPreferenceConstants.PREF_DEFAULT_FONT); |
1055 | edgeFontStyle.setFontName(fontData.getName()); |
1056 | edgeFontStyle.setFontHeight(fontData.getHeight()); |
1057 | edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); |
1058 | edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); |
1059 | org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter |
1060 | .getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); |
1061 | edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB) |
1062 | .intValue()); |
1063 | } |
1064 | Routing routing = Routing.get(prefStore |
1065 | .getInt(IPreferenceConstants.PREF_LINE_STYLE)); |
1066 | if (routing != null) { |
1067 | ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE |
1068 | .getRoutingStyle_Routing(), routing); |
1069 | } |
1070 | return edge; |
1071 | } |
1072 | |
1073 | /** |
1074 | * @generated |
1075 | */ |
1076 | private void stampShortcut(View containerView, Node target) { |
1077 | if (!UsageScenarioEditPart.MODEL_ID |
1078 | .equals(PalladioComponentModelVisualIDRegistry |
1079 | .getModelID(containerView))) { |
1080 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
1081 | .createEAnnotation(); |
1082 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
1083 | shortcutAnnotation.getDetails().put( |
1084 | "modelID", UsageScenarioEditPart.MODEL_ID); //$NON-NLS-1$ |
1085 | target.getEAnnotations().add(shortcutAnnotation); |
1086 | } |
1087 | } |
1088 | |
1089 | /** |
1090 | * @generated |
1091 | */ |
1092 | private Node createLabel(View owner, String hint) { |
1093 | DecorationNode rv = NotationFactory.eINSTANCE.createDecorationNode(); |
1094 | rv.setType(hint); |
1095 | ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true); |
1096 | return rv; |
1097 | } |
1098 | |
1099 | /** |
1100 | * @generated |
1101 | */ |
1102 | private Node createCompartment(View owner, String hint, |
1103 | boolean canCollapse, boolean hasTitle, boolean canSort, |
1104 | boolean canFilter) { |
1105 | //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment(); |
1106 | //rv.setShowTitle(showTitle); |
1107 | //rv.setCollapsed(isCollapsed); |
1108 | Node rv; |
1109 | if (canCollapse) { |
1110 | rv = NotationFactory.eINSTANCE.createBasicCompartment(); |
1111 | } else { |
1112 | rv = NotationFactory.eINSTANCE.createDecorationNode(); |
1113 | } |
1114 | if (hasTitle) { |
1115 | TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle(); |
1116 | ts.setShowTitle(true); |
1117 | rv.getStyles().add(ts); |
1118 | } |
1119 | if (canSort) { |
1120 | rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle()); |
1121 | } |
1122 | if (canFilter) { |
1123 | rv.getStyles() |
1124 | .add(NotationFactory.eINSTANCE.createFilteringStyle()); |
1125 | } |
1126 | rv.setType(hint); |
1127 | ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true); |
1128 | return rv; |
1129 | } |
1130 | |
1131 | /** |
1132 | * @generated |
1133 | */ |
1134 | private EObject getSemanticElement(IAdaptable semanticAdapter) { |
1135 | if (semanticAdapter == null) { |
1136 | return null; |
1137 | } |
1138 | EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); |
1139 | if (eObject != null) { |
1140 | return EMFCoreUtil.resolve(TransactionUtil |
1141 | .getEditingDomain(eObject), eObject); |
1142 | } |
1143 | return null; |
1144 | } |
1145 | |
1146 | /** |
1147 | * @generated |
1148 | */ |
1149 | private IElementType getSemanticElementType(IAdaptable semanticAdapter) { |
1150 | if (semanticAdapter == null) { |
1151 | return null; |
1152 | } |
1153 | return (IElementType) semanticAdapter.getAdapter(IElementType.class); |
1154 | } |
1155 | |
1156 | } |