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