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