1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.provider; |
8 | |
9 | |
10 | import EssentialOCL.EssentialOCLFactory; |
11 | import EssentialOCL.EssentialOCLPackage; |
12 | import EssentialOCL.OperationCallExp; |
13 | |
14 | import QVTRelation.QVTRelationFactory; |
15 | |
16 | import QVTTemplate.QVTTemplateFactory; |
17 | |
18 | import java.util.Collection; |
19 | import java.util.List; |
20 | |
21 | import org.eclipse.emf.common.notify.AdapterFactory; |
22 | import org.eclipse.emf.common.notify.Notification; |
23 | |
24 | import org.eclipse.emf.ecore.EStructuralFeature; |
25 | |
26 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
27 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
28 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
29 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
30 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
31 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
32 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
33 | import org.eclipse.emf.edit.provider.ViewerNotification; |
34 | |
35 | /** |
36 | * This is the item provider adapter for a {@link EssentialOCL.OperationCallExp} object. |
37 | * <!-- begin-user-doc --> |
38 | * <!-- end-user-doc --> |
39 | * @generated |
40 | */ |
41 | public class OperationCallExpItemProvider |
42 | extends FeatureCallExpItemProvider |
43 | implements |
44 | IEditingDomainItemProvider, |
45 | IStructuredItemContentProvider, |
46 | ITreeItemContentProvider, |
47 | IItemLabelProvider, |
48 | IItemPropertySource { |
49 | /** |
50 | * This constructs an instance from a factory and a notifier. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public OperationCallExpItemProvider(AdapterFactory adapterFactory) { |
56 | super(adapterFactory); |
57 | } |
58 | |
59 | /** |
60 | * This returns the property descriptors for the adapted class. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | @Override |
66 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
67 | if (itemPropertyDescriptors == null) { |
68 | super.getPropertyDescriptors(object); |
69 | |
70 | addReferredOperationPropertyDescriptor(object); |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This adds a property descriptor for the Referred Operation feature. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | protected void addReferredOperationPropertyDescriptor(Object object) { |
82 | itemPropertyDescriptors.add |
83 | (createItemPropertyDescriptor |
84 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
85 | getResourceLocator(), |
86 | getString("_UI_OperationCallExp_referredOperation_feature"), |
87 | getString("_UI_PropertyDescriptor_description", "_UI_OperationCallExp_referredOperation_feature", "_UI_OperationCallExp_type"), |
88 | EssentialOCLPackage.Literals.OPERATION_CALL_EXP__REFERRED_OPERATION, |
89 | true, |
90 | false, |
91 | true, |
92 | null, |
93 | null, |
94 | null)); |
95 | } |
96 | |
97 | /** |
98 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
99 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
100 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
107 | if (childrenFeatures == null) { |
108 | super.getChildrenFeatures(object); |
109 | childrenFeatures.add(EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT); |
110 | } |
111 | return childrenFeatures; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
121 | // Check the type of the specified child object and return the proper feature to use for |
122 | // adding (see {@link AddCommand}) it as a child. |
123 | |
124 | return super.getChildFeature(object, child); |
125 | } |
126 | |
127 | /** |
128 | * This returns OperationCallExp.gif. |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public Object getImage(Object object) { |
135 | return overlayImage(object, getResourceLocator().getImage("full/obj16/OperationCallExp")); |
136 | } |
137 | |
138 | /** |
139 | * This returns the label text for the adapted class. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public String getText(Object object) { |
146 | String label = ((OperationCallExp)object).getName(); |
147 | return label == null || label.length() == 0 ? |
148 | getString("_UI_OperationCallExp_type") : |
149 | getString("_UI_OperationCallExp_type") + " " + label; |
150 | } |
151 | |
152 | /** |
153 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
154 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public void notifyChanged(Notification notification) { |
161 | updateChildren(notification); |
162 | |
163 | switch (notification.getFeatureID(OperationCallExp.class)) { |
164 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
165 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
166 | return; |
167 | } |
168 | super.notifyChanged(notification); |
169 | } |
170 | |
171 | /** |
172 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
173 | * that can be created under this object. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
180 | super.collectNewChildDescriptors(newChildDescriptors, object); |
181 | |
182 | newChildDescriptors.add |
183 | (createChildParameter |
184 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
185 | EssentialOCLFactory.eINSTANCE.createBooleanLiteralExp())); |
186 | |
187 | newChildDescriptors.add |
188 | (createChildParameter |
189 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
190 | EssentialOCLFactory.eINSTANCE.createCollectionLiteralExp())); |
191 | |
192 | newChildDescriptors.add |
193 | (createChildParameter |
194 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
195 | EssentialOCLFactory.eINSTANCE.createEnumLiteralExp())); |
196 | |
197 | newChildDescriptors.add |
198 | (createChildParameter |
199 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
200 | EssentialOCLFactory.eINSTANCE.createIfExp())); |
201 | |
202 | newChildDescriptors.add |
203 | (createChildParameter |
204 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
205 | EssentialOCLFactory.eINSTANCE.createIntegerLiteralExp())); |
206 | |
207 | newChildDescriptors.add |
208 | (createChildParameter |
209 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
210 | EssentialOCLFactory.eINSTANCE.createInvalidLiteralExp())); |
211 | |
212 | newChildDescriptors.add |
213 | (createChildParameter |
214 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
215 | EssentialOCLFactory.eINSTANCE.createIterateExp())); |
216 | |
217 | newChildDescriptors.add |
218 | (createChildParameter |
219 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
220 | EssentialOCLFactory.eINSTANCE.createIteratorExp())); |
221 | |
222 | newChildDescriptors.add |
223 | (createChildParameter |
224 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
225 | EssentialOCLFactory.eINSTANCE.createLetExp())); |
226 | |
227 | newChildDescriptors.add |
228 | (createChildParameter |
229 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
230 | EssentialOCLFactory.eINSTANCE.createNavigationCallExp())); |
231 | |
232 | newChildDescriptors.add |
233 | (createChildParameter |
234 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
235 | EssentialOCLFactory.eINSTANCE.createNullLiteralExp())); |
236 | |
237 | newChildDescriptors.add |
238 | (createChildParameter |
239 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
240 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
241 | |
242 | newChildDescriptors.add |
243 | (createChildParameter |
244 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
245 | EssentialOCLFactory.eINSTANCE.createPropertyCallExp())); |
246 | |
247 | newChildDescriptors.add |
248 | (createChildParameter |
249 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
250 | EssentialOCLFactory.eINSTANCE.createRealLiteralExp())); |
251 | |
252 | newChildDescriptors.add |
253 | (createChildParameter |
254 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
255 | EssentialOCLFactory.eINSTANCE.createStringLiteralExp())); |
256 | |
257 | newChildDescriptors.add |
258 | (createChildParameter |
259 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
260 | EssentialOCLFactory.eINSTANCE.createTupleLiteralExp())); |
261 | |
262 | newChildDescriptors.add |
263 | (createChildParameter |
264 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
265 | EssentialOCLFactory.eINSTANCE.createTypeExp())); |
266 | |
267 | newChildDescriptors.add |
268 | (createChildParameter |
269 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
270 | EssentialOCLFactory.eINSTANCE.createUnlimitedNaturalExp())); |
271 | |
272 | newChildDescriptors.add |
273 | (createChildParameter |
274 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
275 | EssentialOCLFactory.eINSTANCE.createVariableExp())); |
276 | |
277 | newChildDescriptors.add |
278 | (createChildParameter |
279 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
280 | QVTRelationFactory.eINSTANCE.createOppositePropertyCallExp())); |
281 | |
282 | newChildDescriptors.add |
283 | (createChildParameter |
284 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
285 | QVTRelationFactory.eINSTANCE.createRelationCallExp())); |
286 | |
287 | newChildDescriptors.add |
288 | (createChildParameter |
289 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
290 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
291 | |
292 | newChildDescriptors.add |
293 | (createChildParameter |
294 | (EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT, |
295 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
296 | } |
297 | |
298 | /** |
299 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | @Override |
305 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
306 | Object childFeature = feature; |
307 | Object childObject = child; |
308 | |
309 | boolean qualify = |
310 | childFeature == EssentialOCLPackage.Literals.CALL_EXP__SOURCE || |
311 | childFeature == EssentialOCLPackage.Literals.OPERATION_CALL_EXP__ARGUMENT; |
312 | |
313 | if (qualify) { |
314 | return getString |
315 | ("_UI_CreateChild_text2", |
316 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
317 | } |
318 | return super.getCreateChildText(owner, feature, child, selection); |
319 | } |
320 | |
321 | } |