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