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