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.AllocationComponentLabelEditPart; |
7 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationContextEditPart; |
8 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationContextEntityNameEditPart; |
9 | import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationEditPart; |
10 | |
11 | import de.uka.ipd.sdq.pcm.gmf.allocation.part.PalladioComponentModelVisualIDRegistry; |
12 | |
13 | import java.util.ArrayList; |
14 | import java.util.List; |
15 | |
16 | import org.eclipse.core.runtime.IAdaptable; |
17 | |
18 | import org.eclipse.emf.ecore.EAnnotation; |
19 | import org.eclipse.emf.ecore.EObject; |
20 | import org.eclipse.emf.ecore.EcoreFactory; |
21 | |
22 | import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; |
23 | |
24 | import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; |
25 | |
26 | import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; |
27 | import org.eclipse.gmf.runtime.notation.NotationFactory; |
28 | import org.eclipse.gmf.runtime.notation.View; |
29 | |
30 | /** |
31 | * @generated |
32 | */ |
33 | public class AllocationContextViewFactory extends AbstractShapeViewFactory { |
34 | |
35 | /** |
36 | * @generated |
37 | */ |
38 | protected List createStyles(View view) { |
39 | List styles = new ArrayList(); |
40 | styles.add(NotationFactory.eINSTANCE.createShapeStyle()); |
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(AllocationContextEditPart.VISUAL_ID); |
53 | view.setType(semanticHint); |
54 | } |
55 | super.decorateView(containerView, view, semanticAdapter, semanticHint, |
56 | index, persisted); |
57 | IAdaptable eObjectAdapter = null; |
58 | EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); |
59 | if (eObject != null) { |
60 | eObjectAdapter = new EObjectAdapter(eObject); |
61 | } |
62 | getViewService() |
63 | .createNode( |
64 | eObjectAdapter, |
65 | view, |
66 | PalladioComponentModelVisualIDRegistry |
67 | .getType(AllocationContextEntityNameEditPart.VISUAL_ID), |
68 | ViewUtil.APPEND, true, getPreferencesHint()); |
69 | getViewService().createNode( |
70 | eObjectAdapter, |
71 | view, |
72 | PalladioComponentModelVisualIDRegistry |
73 | .getType(AllocationComponentLabelEditPart.VISUAL_ID), |
74 | ViewUtil.APPEND, true, getPreferencesHint()); |
75 | } |
76 | |
77 | } |