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.ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart; |
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.ListCompartmentViewFactory; |
20 | |
21 | import org.eclipse.gmf.runtime.notation.DrawerStyle; |
22 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
23 | import org.eclipse.gmf.runtime.notation.NotationPackage; |
24 | import org.eclipse.gmf.runtime.notation.TitleStyle; |
25 | import org.eclipse.gmf.runtime.notation.View; |
26 | |
27 | /** |
28 | * @generated |
29 | */ |
30 | public class ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentViewFactory |
31 | extends ListCompartmentViewFactory { |
32 | |
33 | /** |
34 | * @generated |
35 | */ |
36 | protected List createStyles(View view) { |
37 | List styles = new ArrayList(); |
38 | styles.add(NotationFactory.eINSTANCE.createSortingStyle()); |
39 | styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); |
40 | return styles; |
41 | } |
42 | |
43 | /** |
44 | * @generated |
45 | */ |
46 | protected void decorateView(View containerView, View view, |
47 | IAdaptable semanticAdapter, String semanticHint, int index, |
48 | boolean persisted) { |
49 | if (semanticHint == null) { |
50 | semanticHint = PalladioComponentModelVisualIDRegistry |
51 | .getType(ComposedProvidingRequiringEntityCompositeStructureInnerCompartmentEditPart.VISUAL_ID); |
52 | view.setType(semanticHint); |
53 | } |
54 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
55 | index, persisted); |
56 | setupCompartmentTitle(view); |
57 | setupCompartmentCollapsed(view); |
58 | if (!ComposedProvidingRequiringEntityEditPart.MODEL_ID |
59 | .equals(PalladioComponentModelVisualIDRegistry |
60 | .getModelID(containerView))) { |
61 | EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE |
62 | .createEAnnotation(); |
63 | shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ |
64 | shortcutAnnotation |
65 | .getDetails() |
66 | .put( |
67 | "modelID", ComposedProvidingRequiringEntityEditPart.MODEL_ID); //$NON-NLS-1$ |
68 | view.getEAnnotations().add(shortcutAnnotation); |
69 | } |
70 | } |
71 | |
72 | /** |
73 | * @generated |
74 | */ |
75 | protected void setupCompartmentTitle(View view) { |
76 | TitleStyle titleStyle = (TitleStyle) view |
77 | .getStyle(NotationPackage.eINSTANCE.getTitleStyle()); |
78 | if (titleStyle != null) { |
79 | titleStyle.setShowTitle(true); |
80 | } |
81 | } |
82 | |
83 | /** |
84 | * @generated |
85 | */ |
86 | protected void setupCompartmentCollapsed(View view) { |
87 | DrawerStyle drawerStyle = (DrawerStyle) view |
88 | .getStyle(NotationPackage.eINSTANCE.getDrawerStyle()); |
89 | if (drawerStyle != null) { |
90 | drawerStyle.setCollapsed(false); |
91 | } |
92 | } |
93 | |
94 | } |