1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package QVTBase.provider; |
8 | |
9 | |
10 | import EMOF.EMOFPackage; |
11 | |
12 | import EMOF.provider.QvtmodelsEditPlugin; |
13 | |
14 | import EssentialOCL.provider.VariableItemProvider; |
15 | |
16 | import QVTBase.FunctionParameter; |
17 | import QVTBase.QVTBasePackage; |
18 | |
19 | import java.util.Collection; |
20 | import java.util.List; |
21 | |
22 | import org.eclipse.emf.common.notify.AdapterFactory; |
23 | import org.eclipse.emf.common.notify.Notification; |
24 | |
25 | import org.eclipse.emf.common.util.ResourceLocator; |
26 | |
27 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
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.ItemPropertyDescriptor; |
35 | import org.eclipse.emf.edit.provider.ViewerNotification; |
36 | |
37 | /** |
38 | * This is the item provider adapter for a {@link QVTBase.FunctionParameter} object. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public class FunctionParameterItemProvider |
44 | extends VariableItemProvider |
45 | implements |
46 | IEditingDomainItemProvider, |
47 | IStructuredItemContentProvider, |
48 | ITreeItemContentProvider, |
49 | IItemLabelProvider, |
50 | IItemPropertySource { |
51 | /** |
52 | * This constructs an instance from a factory and a notifier. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public FunctionParameterItemProvider(AdapterFactory adapterFactory) { |
58 | super(adapterFactory); |
59 | } |
60 | |
61 | /** |
62 | * This returns the property descriptors for the adapted class. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
69 | if (itemPropertyDescriptors == null) { |
70 | super.getPropertyDescriptors(object); |
71 | |
72 | addIsOrderedPropertyDescriptor(object); |
73 | addIsUniquePropertyDescriptor(object); |
74 | addLowerPropertyDescriptor(object); |
75 | addUpperPropertyDescriptor(object); |
76 | } |
77 | return itemPropertyDescriptors; |
78 | } |
79 | |
80 | /** |
81 | * This adds a property descriptor for the Is Ordered feature. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | protected void addIsOrderedPropertyDescriptor(Object object) { |
87 | itemPropertyDescriptors.add |
88 | (createItemPropertyDescriptor |
89 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
90 | getResourceLocator(), |
91 | getString("_UI_MultiplicityElement_isOrdered_feature"), |
92 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_isOrdered_feature", "_UI_MultiplicityElement_type"), |
93 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__IS_ORDERED, |
94 | true, |
95 | false, |
96 | false, |
97 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
98 | null, |
99 | null)); |
100 | } |
101 | |
102 | /** |
103 | * This adds a property descriptor for the Is Unique feature. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | protected void addIsUniquePropertyDescriptor(Object object) { |
109 | itemPropertyDescriptors.add |
110 | (createItemPropertyDescriptor |
111 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
112 | getResourceLocator(), |
113 | getString("_UI_MultiplicityElement_isUnique_feature"), |
114 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_isUnique_feature", "_UI_MultiplicityElement_type"), |
115 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__IS_UNIQUE, |
116 | true, |
117 | false, |
118 | false, |
119 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
120 | null, |
121 | null)); |
122 | } |
123 | |
124 | /** |
125 | * This adds a property descriptor for the Lower feature. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | protected void addLowerPropertyDescriptor(Object object) { |
131 | itemPropertyDescriptors.add |
132 | (createItemPropertyDescriptor |
133 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
134 | getResourceLocator(), |
135 | getString("_UI_MultiplicityElement_lower_feature"), |
136 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_lower_feature", "_UI_MultiplicityElement_type"), |
137 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__LOWER, |
138 | true, |
139 | false, |
140 | false, |
141 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
142 | null, |
143 | null)); |
144 | } |
145 | |
146 | /** |
147 | * This adds a property descriptor for the Upper feature. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | protected void addUpperPropertyDescriptor(Object object) { |
153 | itemPropertyDescriptors.add |
154 | (createItemPropertyDescriptor |
155 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
156 | getResourceLocator(), |
157 | getString("_UI_MultiplicityElement_upper_feature"), |
158 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_upper_feature", "_UI_MultiplicityElement_type"), |
159 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__UPPER, |
160 | true, |
161 | false, |
162 | false, |
163 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
164 | null, |
165 | null)); |
166 | } |
167 | |
168 | /** |
169 | * This returns FunctionParameter.gif. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | public Object getImage(Object object) { |
176 | return overlayImage(object, getResourceLocator().getImage("full/obj16/FunctionParameter")); |
177 | } |
178 | |
179 | /** |
180 | * This returns the label text for the adapted class. |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public String getText(Object object) { |
187 | String label = ((FunctionParameter)object).getName(); |
188 | return label == null || label.length() == 0 ? |
189 | getString("_UI_FunctionParameter_type") : |
190 | getString("_UI_FunctionParameter_type") + " " + label; |
191 | } |
192 | |
193 | /** |
194 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
195 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | @Override |
201 | public void notifyChanged(Notification notification) { |
202 | updateChildren(notification); |
203 | |
204 | switch (notification.getFeatureID(FunctionParameter.class)) { |
205 | case QVTBasePackage.FUNCTION_PARAMETER__IS_ORDERED: |
206 | case QVTBasePackage.FUNCTION_PARAMETER__IS_UNIQUE: |
207 | case QVTBasePackage.FUNCTION_PARAMETER__LOWER: |
208 | case QVTBasePackage.FUNCTION_PARAMETER__UPPER: |
209 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
210 | return; |
211 | } |
212 | super.notifyChanged(notification); |
213 | } |
214 | |
215 | /** |
216 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
217 | * that can be created under this object. |
218 | * <!-- begin-user-doc --> |
219 | * <!-- end-user-doc --> |
220 | * @generated |
221 | */ |
222 | @Override |
223 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
224 | super.collectNewChildDescriptors(newChildDescriptors, object); |
225 | } |
226 | |
227 | /** |
228 | * Return the resource locator for this item provider's resources. |
229 | * <!-- begin-user-doc --> |
230 | * <!-- end-user-doc --> |
231 | * @generated |
232 | */ |
233 | @Override |
234 | public ResourceLocator getResourceLocator() { |
235 | return QvtmodelsEditPlugin.INSTANCE; |
236 | } |
237 | |
238 | } |