1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.provider; |
7 | |
8 | |
9 | import java.util.Collection; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.notify.AdapterFactory; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.common.util.ResourceLocator; |
15 | import org.eclipse.emf.ecore.EStructuralFeature; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
26 | import de.uka.ipd.sdq.pcm.parameter.ParameterFactory; |
27 | import de.uka.ipd.sdq.pcm.seff.SeffFactory; |
28 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
29 | import de.uka.ipd.sdq.pcm.seff.SynchronisationPoint; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.SynchronisationPoint} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class SynchronisationPointItemProvider |
38 | extends ItemProviderAdapter |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
51 | |
52 | /** |
53 | * This constructs an instance from a factory and a notifier. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public SynchronisationPointItemProvider(AdapterFactory adapterFactory) { |
59 | super(adapterFactory); |
60 | } |
61 | |
62 | /** |
63 | * This returns the property descriptors for the adapted class. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | @Override |
69 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
70 | if (itemPropertyDescriptors == null) { |
71 | super.getPropertyDescriptors(object); |
72 | |
73 | } |
74 | return itemPropertyDescriptors; |
75 | } |
76 | |
77 | /** |
78 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
79 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
80 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | @Override |
86 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
87 | if (childrenFeatures == null) { |
88 | super.getChildrenFeatures(object); |
89 | childrenFeatures.add(SeffPackage.Literals.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT); |
90 | childrenFeatures.add(SeffPackage.Literals.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT); |
91 | } |
92 | return childrenFeatures; |
93 | } |
94 | |
95 | /** |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | @Override |
101 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
102 | // Check the type of the specified child object and return the proper feature to use for |
103 | // adding (see {@link AddCommand}) it as a child. |
104 | |
105 | return super.getChildFeature(object, child); |
106 | } |
107 | |
108 | /** |
109 | * This returns SynchronisationPoint.gif. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public Object getImage(Object object) { |
116 | return overlayImage(object, getResourceLocator().getImage("full/obj16/SynchronisationPoint")); |
117 | } |
118 | |
119 | /** |
120 | * This returns the label text for the adapted class. |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public String getText(Object object) { |
127 | return getString("_UI_SynchronisationPoint_type"); |
128 | } |
129 | |
130 | /** |
131 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
132 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | public void notifyChanged(Notification notification) { |
139 | updateChildren(notification); |
140 | |
141 | switch (notification.getFeatureID(SynchronisationPoint.class)) { |
142 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
143 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
144 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
145 | return; |
146 | } |
147 | super.notifyChanged(notification); |
148 | } |
149 | |
150 | /** |
151 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
152 | * that can be created under this object. |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @Override |
158 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
159 | super.collectNewChildDescriptors(newChildDescriptors, object); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (SeffPackage.Literals.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT, |
164 | ParameterFactory.eINSTANCE.createVariableUsage())); |
165 | |
166 | newChildDescriptors.add |
167 | (createChildParameter |
168 | (SeffPackage.Literals.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT, |
169 | SeffFactory.eINSTANCE.createForkedBehaviour())); |
170 | } |
171 | |
172 | /** |
173 | * Return the resource locator for this item provider's resources. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | public ResourceLocator getResourceLocator() { |
180 | return PalladioComponentModelEditPlugin.INSTANCE; |
181 | } |
182 | |
183 | } |