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.ComposeableAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
18 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
19 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
20 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
21 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
23 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
24 | import org.eclipse.emf.edit.provider.ViewerNotification; |
25 | |
26 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
27 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
28 | import de.uka.ipd.sdq.pcm.seff.ResourceDemandingSEFF; |
29 | import de.uka.ipd.sdq.pcm.seff.SeffFactory; |
30 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
31 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory; |
32 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.ResourceDemandingSEFF} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class ResourceDemandingSEFFItemProvider |
40 | extends IdentifierItemProvider |
41 | implements |
42 | IEditingDomainItemProvider, |
43 | IStructuredItemContentProvider, |
44 | ITreeItemContentProvider, |
45 | IItemLabelProvider, |
46 | IItemPropertySource { |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
53 | |
54 | /** |
55 | * This constructs an instance from a factory and a notifier. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | public ResourceDemandingSEFFItemProvider(AdapterFactory adapterFactory) { |
61 | super(adapterFactory); |
62 | } |
63 | |
64 | /** |
65 | * This returns the property descriptors for the adapted class. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @generated |
69 | */ |
70 | @Override |
71 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
72 | if (itemPropertyDescriptors == null) { |
73 | super.getPropertyDescriptors(object); |
74 | |
75 | addSeffTypeIDPropertyDescriptor(object); |
76 | addDescribedService__SEFFPropertyDescriptor(object); |
77 | } |
78 | return itemPropertyDescriptors; |
79 | } |
80 | |
81 | /** |
82 | * This adds a property descriptor for the Seff Type ID feature. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | protected void addSeffTypeIDPropertyDescriptor(Object object) { |
88 | itemPropertyDescriptors.add |
89 | (createItemPropertyDescriptor |
90 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
91 | getResourceLocator(), |
92 | getString("_UI_ServiceEffectSpecification_seffTypeID_feature"), |
93 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceEffectSpecification_seffTypeID_feature", "_UI_ServiceEffectSpecification_type"), |
94 | SeffPackage.Literals.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID, |
95 | true, |
96 | false, |
97 | false, |
98 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
99 | null, |
100 | null)); |
101 | } |
102 | |
103 | /** |
104 | * This adds a property descriptor for the Described Service SEFF feature. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | protected void addDescribedService__SEFFPropertyDescriptor(Object object) { |
110 | itemPropertyDescriptors.add |
111 | (createItemPropertyDescriptor |
112 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
113 | getResourceLocator(), |
114 | getString("_UI_ServiceEffectSpecification_describedService__SEFF_feature"), |
115 | getString("_UI_PropertyDescriptor_description", "_UI_ServiceEffectSpecification_describedService__SEFF_feature", "_UI_ServiceEffectSpecification_type"), |
116 | SeffPackage.Literals.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF, |
117 | true, |
118 | false, |
119 | true, |
120 | null, |
121 | null, |
122 | null)); |
123 | } |
124 | |
125 | /** |
126 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
127 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
128 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
135 | if (childrenFeatures == null) { |
136 | super.getChildrenFeatures(object); |
137 | childrenFeatures.add(SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR); |
138 | childrenFeatures.add(SeffPackage.Literals.RESOURCE_DEMANDING_SEFF__RESOURCE_DEMANDING_INTERNAL_BEHAVIOURS); |
139 | } |
140 | return childrenFeatures; |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
150 | // Check the type of the specified child object and return the proper feature to use for |
151 | // adding (see {@link AddCommand}) it as a child. |
152 | |
153 | return super.getChildFeature(object, child); |
154 | } |
155 | |
156 | /** |
157 | * This returns ResourceDemandingSEFF.gif. |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | @Override |
163 | public Object getImage(Object object) { |
164 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResourceDemandingSEFF")); |
165 | } |
166 | |
167 | /** |
168 | * This returns the label text for the adapted class. |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | @Override |
174 | public String getText(Object object) { |
175 | String label = ((ResourceDemandingSEFF)object).getId(); |
176 | return label == null || label.length() == 0 ? |
177 | getString("_UI_ResourceDemandingSEFF_type") : |
178 | getString("_UI_ResourceDemandingSEFF_type") + " " + label; |
179 | } |
180 | |
181 | /** |
182 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
183 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | @Override |
189 | public void notifyChanged(Notification notification) { |
190 | updateChildren(notification); |
191 | |
192 | switch (notification.getFeatureID(ResourceDemandingSEFF.class)) { |
193 | case SeffPackage.RESOURCE_DEMANDING_SEFF__SEFF_TYPE_ID: |
194 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
195 | return; |
196 | case SeffPackage.RESOURCE_DEMANDING_SEFF__STEPS_BEHAVIOUR: |
197 | case SeffPackage.RESOURCE_DEMANDING_SEFF__RESOURCE_DEMANDING_INTERNAL_BEHAVIOURS: |
198 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
199 | return; |
200 | } |
201 | super.notifyChanged(notification); |
202 | } |
203 | |
204 | /** |
205 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
206 | * that can be created under this object. |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | @Override |
212 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
213 | super.collectNewChildDescriptors(newChildDescriptors, object); |
214 | |
215 | newChildDescriptors.add |
216 | (createChildParameter |
217 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
218 | SeffFactory.eINSTANCE.createStopAction())); |
219 | |
220 | newChildDescriptors.add |
221 | (createChildParameter |
222 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
223 | SeffFactory.eINSTANCE.createBranchAction())); |
224 | |
225 | newChildDescriptors.add |
226 | (createChildParameter |
227 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
228 | SeffFactory.eINSTANCE.createStartAction())); |
229 | |
230 | newChildDescriptors.add |
231 | (createChildParameter |
232 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
233 | SeffFactory.eINSTANCE.createReleaseAction())); |
234 | |
235 | newChildDescriptors.add |
236 | (createChildParameter |
237 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
238 | SeffFactory.eINSTANCE.createLoopAction())); |
239 | |
240 | newChildDescriptors.add |
241 | (createChildParameter |
242 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
243 | SeffFactory.eINSTANCE.createForkAction())); |
244 | |
245 | newChildDescriptors.add |
246 | (createChildParameter |
247 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
248 | SeffFactory.eINSTANCE.createExternalCallAction())); |
249 | |
250 | newChildDescriptors.add |
251 | (createChildParameter |
252 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
253 | SeffFactory.eINSTANCE.createAcquireAction())); |
254 | |
255 | newChildDescriptors.add |
256 | (createChildParameter |
257 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
258 | SeffFactory.eINSTANCE.createCollectionIteratorAction())); |
259 | |
260 | newChildDescriptors.add |
261 | (createChildParameter |
262 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
263 | SeffFactory.eINSTANCE.createSetVariableAction())); |
264 | |
265 | newChildDescriptors.add |
266 | (createChildParameter |
267 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
268 | SeffFactory.eINSTANCE.createInternalCallAction())); |
269 | |
270 | newChildDescriptors.add |
271 | (createChildParameter |
272 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
273 | SeffFactory.eINSTANCE.createEmitEventAction())); |
274 | |
275 | newChildDescriptors.add |
276 | (createChildParameter |
277 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
278 | SeffFactory.eINSTANCE.createInternalAction())); |
279 | |
280 | newChildDescriptors.add |
281 | (createChildParameter |
282 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
283 | Seff_reliabilityFactory.eINSTANCE.createRecoveryAction())); |
284 | |
285 | newChildDescriptors.add |
286 | (createChildParameter |
287 | (SeffPackage.Literals.RESOURCE_DEMANDING_SEFF__RESOURCE_DEMANDING_INTERNAL_BEHAVIOURS, |
288 | SeffFactory.eINSTANCE.createResourceDemandingInternalBehaviour())); |
289 | } |
290 | |
291 | /** |
292 | * Return the resource locator for this item provider's resources. |
293 | * <!-- begin-user-doc --> |
294 | * <!-- end-user-doc --> |
295 | * @generated |
296 | */ |
297 | @Override |
298 | public ResourceLocator getResourceLocator() { |
299 | return PalladioComponentModelEditPlugin.INSTANCE; |
300 | } |
301 | |
302 | } |