1 | /* |
2 | *Copyright 2007, SDQ, IPD, Uni Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.composite.view.factories; |
5 | |
6 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityEditPart; |
7 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ProvidedDelegationConnectorEditPart; |
8 | |
9 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry; |
10 | |
11 | import java.util.ArrayList; |
12 | import java.util.List; |
13 | |
14 | import org.eclipse.core.runtime.IAdaptable; |
15 | |
16 | import org.eclipse.emf.ecore.EAnnotation; |
17 | import org.eclipse.emf.ecore.EcoreFactory; |
18 | |
19 | import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory; |
20 | |
21 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
22 | import org.eclipse.gmf.runtime.notation.View; |
23 | |
24 | /** |
25 | * @generated |
26 | */ |
27 | public class ProvidedDelegationConnectorViewFactory extends |
28 | ConnectionViewFactory { |
29 | |
30 | /** |
31 | * @generated |
32 | */ |
33 | protected List createStyles(View view) { |
34 | List styles = new ArrayList(); |
35 | styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); |
36 | styles.add(NotationFactory.eINSTANCE.createFontStyle()); |
37 | styles.add(NotationFactory.eINSTANCE.createLineStyle()); |
38 | return styles; |
39 | } |
40 | |
41 | /** |
42 | * @generated |
43 | */ |
44 | protected void decorateView(View containerView, View view, |
45 | IAdaptable semanticAdapter, String semanticHint, int index, |
46 | boolean persisted) { |
47 | if (semanticHint == null) { |
48 | semanticHint = PalladioComponentModelVisualIDRegistry |
49 | .getType(ProvidedDelegationConnectorEditPart.VISUAL_ID); |
50 | view.setType(semanticHint); |
51 | } |
52 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
53 | index, persisted); |
54 | if (!ComposedProvidingRequiringEntityEditPart.MODEL_ID |
55 | .equals(PalladioComponentModelVisualIDRegistry |
56 | .getModelID(containerView))) { |
57 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
58 | .createEAnnotation(); |
59 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
60 | shortcutAnnotation |
61 | .getDetails() |
62 | .put( |
63 | "modelID", ComposedProvidingRequiringEntityEditPart.MODEL_ID); //$NON-NLS-1$ |
64 | view.getEAnnotations().add(shortcutAnnotation); |
65 | } |
66 | } |
67 | |
68 | } |