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