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