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.AssemblyConnectorEditPart; |
7 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityEditPart; |
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 AssemblyConnectorViewFactory extends ConnectionViewFactory { |
28 | |
29 | /** |
30 | * @generated |
31 | */ |
32 | protected List createStyles(View view) { |
33 | List styles = new ArrayList(); |
34 | styles.add(NotationFactory.eINSTANCE.createRoutingStyle()); |
35 | styles.add(NotationFactory.eINSTANCE.createFontStyle()); |
36 | styles.add(NotationFactory.eINSTANCE.createLineStyle()); |
37 | return styles; |
38 | } |
39 | |
40 | /** |
41 | * @generated |
42 | */ |
43 | protected void decorateView(View containerView, View view, |
44 | IAdaptable semanticAdapter, String semanticHint, int index, |
45 | boolean persisted) { |
46 | if (semanticHint == null) { |
47 | semanticHint = PalladioComponentModelVisualIDRegistry |
48 | .getType(AssemblyConnectorEditPart.VISUAL_ID); |
49 | view.setType(semanticHint); |
50 | } |
51 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
52 | index, persisted); |
53 | if (!ComposedProvidingRequiringEntityEditPart.MODEL_ID |
54 | .equals(PalladioComponentModelVisualIDRegistry |
55 | .getModelID(containerView))) { |
56 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
57 | .createEAnnotation(); |
58 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
59 | shortcutAnnotation |
60 | .getDetails() |
61 | .put( |
62 | "modelID", ComposedProvidingRequiringEntityEditPart.MODEL_ID); //$NON-NLS-1$ |
63 | view.getEAnnotations().add(shortcutAnnotation); |
64 | } |
65 | } |
66 | |
67 | } |