1 | /* |
2 | *Copyright 2007, SDQ, IPD, U KA |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.allocation.view.factories; |
5 | |
6 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationEditPart; |
7 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.ResourceContainerAllocationCompartmentEditPart; |
8 | |
9 | import de.uka.ipd.sdq.pcm.gmf.allocation.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.BasicNodeViewFactory; |
20 | import org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory; |
21 | |
22 | import org.eclipse.gmf.runtime.notation.DrawerStyle; |
23 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
24 | import org.eclipse.gmf.runtime.notation.NotationPackage; |
25 | import org.eclipse.gmf.runtime.notation.TitleStyle; |
26 | import org.eclipse.gmf.runtime.notation.View; |
27 | |
28 | /** |
29 | * @generated |
30 | */ |
31 | public class ResourceContainerAllocationCompartmentViewFactory extends |
32 | BasicNodeViewFactory { |
33 | |
34 | /** |
35 | * @generated |
36 | */ |
37 | protected List createStyles(View view) { |
38 | List styles = new ArrayList(); |
39 | styles.add(NotationFactory.eINSTANCE.createSortingStyle()); |
40 | styles.add(NotationFactory.eINSTANCE.createFilteringStyle()); |
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(ResourceContainerAllocationCompartmentEditPart.VISUAL_ID); |
53 | view.setType(semanticHint); |
54 | } |
55 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
56 | index, persisted); |
57 | setupCompartmentTitle(view); |
58 | setupCompartmentCollapsed(view); |
59 | } |
60 | |
61 | /** |
62 | * @generated |
63 | */ |
64 | protected void setupCompartmentTitle(View view) { |
65 | TitleStyle titleStyle = (TitleStyle) view |
66 | .getStyle(NotationPackage.eINSTANCE.getTitleStyle()); |
67 | if (titleStyle != null) { |
68 | titleStyle.setShowTitle(true); |
69 | } |
70 | } |
71 | |
72 | /** |
73 | * @generated |
74 | */ |
75 | protected void setupCompartmentCollapsed(View view) { |
76 | DrawerStyle drawerStyle = (DrawerStyle) view |
77 | .getStyle(NotationPackage.eINSTANCE.getDrawerStyle()); |
78 | if (drawerStyle != null) { |
79 | drawerStyle.setCollapsed(false); |
80 | } |
81 | } |
82 | |
83 | } |