1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package QVTTemplate.provider; |
8 | |
9 | |
10 | import EMOF.provider.QvtmodelsEditPlugin; |
11 | |
12 | import EssentialOCL.EssentialOCLFactory; |
13 | |
14 | import EssentialOCL.provider.LiteralExpItemProvider; |
15 | |
16 | import QVTRelation.QVTRelationFactory; |
17 | |
18 | import QVTTemplate.QVTTemplateFactory; |
19 | import QVTTemplate.QVTTemplatePackage; |
20 | import QVTTemplate.TemplateExp; |
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 QVTTemplate.TemplateExp} object. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | public class TemplateExpItemProvider |
48 | extends LiteralExpItemProvider |
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 TemplateExpItemProvider(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 | addBindsToPropertyDescriptor(object); |
77 | } |
78 | return itemPropertyDescriptors; |
79 | } |
80 | |
81 | /** |
82 | * This adds a property descriptor for the Binds To feature. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | protected void addBindsToPropertyDescriptor(Object object) { |
88 | itemPropertyDescriptors.add |
89 | (createItemPropertyDescriptor |
90 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
91 | getResourceLocator(), |
92 | getString("_UI_TemplateExp_bindsTo_feature"), |
93 | getString("_UI_PropertyDescriptor_description", "_UI_TemplateExp_bindsTo_feature", "_UI_TemplateExp_type"), |
94 | QVTTemplatePackage.Literals.TEMPLATE_EXP__BINDS_TO, |
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(QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE); |
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 the label text for the adapted class. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public String getText(Object object) { |
141 | String label = ((TemplateExp)object).getName(); |
142 | return label == null || label.length() == 0 ? |
143 | getString("_UI_TemplateExp_type") : |
144 | getString("_UI_TemplateExp_type") + " " + label; |
145 | } |
146 | |
147 | /** |
148 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
149 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public void notifyChanged(Notification notification) { |
156 | updateChildren(notification); |
157 | |
158 | switch (notification.getFeatureID(TemplateExp.class)) { |
159 | case QVTTemplatePackage.TEMPLATE_EXP__WHERE: |
160 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
161 | return; |
162 | } |
163 | super.notifyChanged(notification); |
164 | } |
165 | |
166 | /** |
167 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
168 | * that can be created under this object. |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | @Override |
174 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
175 | super.collectNewChildDescriptors(newChildDescriptors, object); |
176 | |
177 | newChildDescriptors.add |
178 | (createChildParameter |
179 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
180 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
181 | |
182 | newChildDescriptors.add |
183 | (createChildParameter |
184 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
185 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
186 | |
187 | newChildDescriptors.add |
188 | (createChildParameter |
189 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
190 | EssentialOCLFactory.eINSTANCE.createBooleanLiteralExp())); |
191 | |
192 | newChildDescriptors.add |
193 | (createChildParameter |
194 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
195 | EssentialOCLFactory.eINSTANCE.createCollectionLiteralExp())); |
196 | |
197 | newChildDescriptors.add |
198 | (createChildParameter |
199 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
200 | EssentialOCLFactory.eINSTANCE.createEnumLiteralExp())); |
201 | |
202 | newChildDescriptors.add |
203 | (createChildParameter |
204 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
205 | EssentialOCLFactory.eINSTANCE.createIfExp())); |
206 | |
207 | newChildDescriptors.add |
208 | (createChildParameter |
209 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
210 | EssentialOCLFactory.eINSTANCE.createIntegerLiteralExp())); |
211 | |
212 | newChildDescriptors.add |
213 | (createChildParameter |
214 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
215 | EssentialOCLFactory.eINSTANCE.createInvalidLiteralExp())); |
216 | |
217 | newChildDescriptors.add |
218 | (createChildParameter |
219 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
220 | EssentialOCLFactory.eINSTANCE.createIterateExp())); |
221 | |
222 | newChildDescriptors.add |
223 | (createChildParameter |
224 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
225 | EssentialOCLFactory.eINSTANCE.createIteratorExp())); |
226 | |
227 | newChildDescriptors.add |
228 | (createChildParameter |
229 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
230 | EssentialOCLFactory.eINSTANCE.createLetExp())); |
231 | |
232 | newChildDescriptors.add |
233 | (createChildParameter |
234 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
235 | EssentialOCLFactory.eINSTANCE.createNavigationCallExp())); |
236 | |
237 | newChildDescriptors.add |
238 | (createChildParameter |
239 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
240 | EssentialOCLFactory.eINSTANCE.createNullLiteralExp())); |
241 | |
242 | newChildDescriptors.add |
243 | (createChildParameter |
244 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
245 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
246 | |
247 | newChildDescriptors.add |
248 | (createChildParameter |
249 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
250 | EssentialOCLFactory.eINSTANCE.createPropertyCallExp())); |
251 | |
252 | newChildDescriptors.add |
253 | (createChildParameter |
254 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
255 | EssentialOCLFactory.eINSTANCE.createRealLiteralExp())); |
256 | |
257 | newChildDescriptors.add |
258 | (createChildParameter |
259 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
260 | EssentialOCLFactory.eINSTANCE.createStringLiteralExp())); |
261 | |
262 | newChildDescriptors.add |
263 | (createChildParameter |
264 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
265 | EssentialOCLFactory.eINSTANCE.createTupleLiteralExp())); |
266 | |
267 | newChildDescriptors.add |
268 | (createChildParameter |
269 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
270 | EssentialOCLFactory.eINSTANCE.createTypeExp())); |
271 | |
272 | newChildDescriptors.add |
273 | (createChildParameter |
274 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
275 | EssentialOCLFactory.eINSTANCE.createUnlimitedNaturalExp())); |
276 | |
277 | newChildDescriptors.add |
278 | (createChildParameter |
279 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
280 | EssentialOCLFactory.eINSTANCE.createVariableExp())); |
281 | |
282 | newChildDescriptors.add |
283 | (createChildParameter |
284 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
285 | QVTRelationFactory.eINSTANCE.createOppositePropertyCallExp())); |
286 | |
287 | newChildDescriptors.add |
288 | (createChildParameter |
289 | (QVTTemplatePackage.Literals.TEMPLATE_EXP__WHERE, |
290 | QVTRelationFactory.eINSTANCE.createRelationCallExp())); |
291 | } |
292 | |
293 | /** |
294 | * Return the resource locator for this item provider's resources. |
295 | * <!-- begin-user-doc --> |
296 | * <!-- end-user-doc --> |
297 | * @generated |
298 | */ |
299 | @Override |
300 | public ResourceLocator getResourceLocator() { |
301 | return QvtmodelsEditPlugin.INSTANCE; |
302 | } |
303 | |
304 | } |