1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.provider; |
8 | |
9 | |
10 | import EssentialOCL.CollectionItem; |
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.CollectionItem} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class CollectionItemItemProvider |
41 | extends CollectionLiteralPartItemProvider |
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 CollectionItemItemProvider(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.COLLECTION_ITEM__ITEM); |
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 CollectionItem.gif. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | public Object getImage(Object object) { |
111 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CollectionItem")); |
112 | } |
113 | |
114 | /** |
115 | * This returns the label text for the adapted class. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | public String getText(Object object) { |
122 | String label = ((CollectionItem)object).getName(); |
123 | return label == null || label.length() == 0 ? |
124 | getString("_UI_CollectionItem_type") : |
125 | getString("_UI_CollectionItem_type") + " " + label; |
126 | } |
127 | |
128 | /** |
129 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
130 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | @Override |
136 | public void notifyChanged(Notification notification) { |
137 | updateChildren(notification); |
138 | |
139 | switch (notification.getFeatureID(CollectionItem.class)) { |
140 | case EssentialOCLPackage.COLLECTION_ITEM__ITEM: |
141 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
142 | return; |
143 | } |
144 | super.notifyChanged(notification); |
145 | } |
146 | |
147 | /** |
148 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
149 | * that can be created under this object. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
156 | super.collectNewChildDescriptors(newChildDescriptors, object); |
157 | |
158 | newChildDescriptors.add |
159 | (createChildParameter |
160 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
161 | EssentialOCLFactory.eINSTANCE.createBooleanLiteralExp())); |
162 | |
163 | newChildDescriptors.add |
164 | (createChildParameter |
165 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
166 | EssentialOCLFactory.eINSTANCE.createCollectionLiteralExp())); |
167 | |
168 | newChildDescriptors.add |
169 | (createChildParameter |
170 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
171 | EssentialOCLFactory.eINSTANCE.createEnumLiteralExp())); |
172 | |
173 | newChildDescriptors.add |
174 | (createChildParameter |
175 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
176 | EssentialOCLFactory.eINSTANCE.createIfExp())); |
177 | |
178 | newChildDescriptors.add |
179 | (createChildParameter |
180 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
181 | EssentialOCLFactory.eINSTANCE.createIntegerLiteralExp())); |
182 | |
183 | newChildDescriptors.add |
184 | (createChildParameter |
185 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
186 | EssentialOCLFactory.eINSTANCE.createInvalidLiteralExp())); |
187 | |
188 | newChildDescriptors.add |
189 | (createChildParameter |
190 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
191 | EssentialOCLFactory.eINSTANCE.createIterateExp())); |
192 | |
193 | newChildDescriptors.add |
194 | (createChildParameter |
195 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
196 | EssentialOCLFactory.eINSTANCE.createIteratorExp())); |
197 | |
198 | newChildDescriptors.add |
199 | (createChildParameter |
200 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
201 | EssentialOCLFactory.eINSTANCE.createLetExp())); |
202 | |
203 | newChildDescriptors.add |
204 | (createChildParameter |
205 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
206 | EssentialOCLFactory.eINSTANCE.createNavigationCallExp())); |
207 | |
208 | newChildDescriptors.add |
209 | (createChildParameter |
210 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
211 | EssentialOCLFactory.eINSTANCE.createNullLiteralExp())); |
212 | |
213 | newChildDescriptors.add |
214 | (createChildParameter |
215 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
216 | EssentialOCLFactory.eINSTANCE.createOperationCallExp())); |
217 | |
218 | newChildDescriptors.add |
219 | (createChildParameter |
220 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
221 | EssentialOCLFactory.eINSTANCE.createPropertyCallExp())); |
222 | |
223 | newChildDescriptors.add |
224 | (createChildParameter |
225 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
226 | EssentialOCLFactory.eINSTANCE.createRealLiteralExp())); |
227 | |
228 | newChildDescriptors.add |
229 | (createChildParameter |
230 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
231 | EssentialOCLFactory.eINSTANCE.createStringLiteralExp())); |
232 | |
233 | newChildDescriptors.add |
234 | (createChildParameter |
235 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
236 | EssentialOCLFactory.eINSTANCE.createTupleLiteralExp())); |
237 | |
238 | newChildDescriptors.add |
239 | (createChildParameter |
240 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
241 | EssentialOCLFactory.eINSTANCE.createTypeExp())); |
242 | |
243 | newChildDescriptors.add |
244 | (createChildParameter |
245 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
246 | EssentialOCLFactory.eINSTANCE.createUnlimitedNaturalExp())); |
247 | |
248 | newChildDescriptors.add |
249 | (createChildParameter |
250 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
251 | EssentialOCLFactory.eINSTANCE.createVariableExp())); |
252 | |
253 | newChildDescriptors.add |
254 | (createChildParameter |
255 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
256 | QVTRelationFactory.eINSTANCE.createOppositePropertyCallExp())); |
257 | |
258 | newChildDescriptors.add |
259 | (createChildParameter |
260 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
261 | QVTRelationFactory.eINSTANCE.createRelationCallExp())); |
262 | |
263 | newChildDescriptors.add |
264 | (createChildParameter |
265 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
266 | QVTTemplateFactory.eINSTANCE.createCollectionTemplateExp())); |
267 | |
268 | newChildDescriptors.add |
269 | (createChildParameter |
270 | (EssentialOCLPackage.Literals.COLLECTION_ITEM__ITEM, |
271 | QVTTemplateFactory.eINSTANCE.createObjectTemplateExp())); |
272 | } |
273 | |
274 | } |