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.AssemblyContextEditPart; |
7 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.AssemblyContextEntityNameEditPart; |
8 | import de.uka.ipd.sdq.pcm.gmf.composite.edit.parts.ComposedProvidingRequiringEntityEditPart; |
9 | |
10 | import de.uka.ipd.sdq.pcm.gmf.composite.part.PalladioComponentModelVisualIDRegistry; |
11 | |
12 | import java.util.ArrayList; |
13 | import java.util.List; |
14 | |
15 | import org.eclipse.core.runtime.IAdaptable; |
16 | |
17 | import org.eclipse.emf.ecore.EAnnotation; |
18 | import org.eclipse.emf.ecore.EcoreFactory; |
19 | |
20 | import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; |
21 | |
22 | import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; |
23 | |
24 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
25 | import org.eclipse.gmf.runtime.notation.View; |
26 | |
27 | /** |
28 | * @generated |
29 | */ |
30 | public class AssemblyContextViewFactory extends AbstractShapeViewFactory { |
31 | |
32 | /** |
33 | * @generated |
34 | */ |
35 | protected List createStyles(View view) { |
36 | List styles = new ArrayList(); |
37 | styles.add(NotationFactory.eINSTANCE.createFontStyle()); |
38 | styles.add(NotationFactory.eINSTANCE.createDescriptionStyle()); |
39 | styles.add(NotationFactory.eINSTANCE.createFillStyle()); |
40 | styles.add(NotationFactory.eINSTANCE.createLineStyle()); |
41 | return styles; |
42 | } |
43 | |
44 | /** |
45 | * @generated |
46 | */ |
47 | protected void decorateView(View containerView, View view, |
48 | IAdaptable semanticAdapter, String semanticHint, int index, |
49 | boolean persisted) { |
50 | if (semanticHint == null) { |
51 | semanticHint = PalladioComponentModelVisualIDRegistry |
52 | .getType(AssemblyContextEditPart.VISUAL_ID); |
53 | view.setType(semanticHint); |
54 | } |
55 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
56 | index, persisted); |
57 | if (!ComposedProvidingRequiringEntityEditPart.MODEL_ID |
58 | .equals(PalladioComponentModelVisualIDRegistry |
59 | .getModelID(containerView))) { |
60 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
61 | .createEAnnotation(); |
62 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
63 | shortcutAnnotation |
64 | .getDetails() |
65 | .put( |
66 | "modelID", ComposedProvidingRequiringEntityEditPart.MODEL_ID); //$NON-NLS-1$ |
67 | view.getEAnnotations().add(shortcutAnnotation); |
68 | } |
69 | getViewService().createNode( |
70 | semanticAdapter, |
71 | view, |
72 | PalladioComponentModelVisualIDRegistry |
73 | .getType(AssemblyContextEntityNameEditPart.VISUAL_ID), |
74 | ViewUtil.APPEND, true, getPreferencesHint()); |
75 | } |
76 | |
77 | } |