| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package EMOF.provider; |
| 8 | |
| 9 | |
| 10 | import EMOF.EMOFPackage; |
| 11 | import EMOF.Property; |
| 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.Property} object. |
| 31 | * <!-- begin-user-doc --> |
| 32 | * <!-- end-user-doc --> |
| 33 | * @generated |
| 34 | */ |
| 35 | public class PropertyItemProvider |
| 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 PropertyItemProvider(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 | addDefaultPropertyDescriptor(object); |
| 69 | addIsCompositePropertyDescriptor(object); |
| 70 | addIsDerivedPropertyDescriptor(object); |
| 71 | addIsIDPropertyDescriptor(object); |
| 72 | addIsReadOnlyPropertyDescriptor(object); |
| 73 | addOppositePropertyDescriptor(object); |
| 74 | } |
| 75 | return itemPropertyDescriptors; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * This adds a property descriptor for the Is Ordered feature. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | protected void addIsOrderedPropertyDescriptor(Object object) { |
| 85 | itemPropertyDescriptors.add |
| 86 | (createItemPropertyDescriptor |
| 87 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 88 | getResourceLocator(), |
| 89 | getString("_UI_MultiplicityElement_isOrdered_feature"), |
| 90 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_isOrdered_feature", "_UI_MultiplicityElement_type"), |
| 91 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__IS_ORDERED, |
| 92 | true, |
| 93 | false, |
| 94 | false, |
| 95 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 96 | null, |
| 97 | null)); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * This adds a property descriptor for the Is Unique feature. |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @generated |
| 105 | */ |
| 106 | protected void addIsUniquePropertyDescriptor(Object object) { |
| 107 | itemPropertyDescriptors.add |
| 108 | (createItemPropertyDescriptor |
| 109 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 110 | getResourceLocator(), |
| 111 | getString("_UI_MultiplicityElement_isUnique_feature"), |
| 112 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_isUnique_feature", "_UI_MultiplicityElement_type"), |
| 113 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__IS_UNIQUE, |
| 114 | true, |
| 115 | false, |
| 116 | false, |
| 117 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 118 | null, |
| 119 | null)); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * This adds a property descriptor for the Lower feature. |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | protected void addLowerPropertyDescriptor(Object object) { |
| 129 | itemPropertyDescriptors.add |
| 130 | (createItemPropertyDescriptor |
| 131 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 132 | getResourceLocator(), |
| 133 | getString("_UI_MultiplicityElement_lower_feature"), |
| 134 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_lower_feature", "_UI_MultiplicityElement_type"), |
| 135 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__LOWER, |
| 136 | true, |
| 137 | false, |
| 138 | false, |
| 139 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 140 | null, |
| 141 | null)); |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * This adds a property descriptor for the Upper feature. |
| 146 | * <!-- begin-user-doc --> |
| 147 | * <!-- end-user-doc --> |
| 148 | * @generated |
| 149 | */ |
| 150 | protected void addUpperPropertyDescriptor(Object object) { |
| 151 | itemPropertyDescriptors.add |
| 152 | (createItemPropertyDescriptor |
| 153 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 154 | getResourceLocator(), |
| 155 | getString("_UI_MultiplicityElement_upper_feature"), |
| 156 | getString("_UI_PropertyDescriptor_description", "_UI_MultiplicityElement_upper_feature", "_UI_MultiplicityElement_type"), |
| 157 | EMOFPackage.Literals.MULTIPLICITY_ELEMENT__UPPER, |
| 158 | true, |
| 159 | false, |
| 160 | false, |
| 161 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 162 | null, |
| 163 | null)); |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * This adds a property descriptor for the Default feature. |
| 168 | * <!-- begin-user-doc --> |
| 169 | * <!-- end-user-doc --> |
| 170 | * @generated |
| 171 | */ |
| 172 | protected void addDefaultPropertyDescriptor(Object object) { |
| 173 | itemPropertyDescriptors.add |
| 174 | (createItemPropertyDescriptor |
| 175 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 176 | getResourceLocator(), |
| 177 | getString("_UI_Property_default_feature"), |
| 178 | getString("_UI_PropertyDescriptor_description", "_UI_Property_default_feature", "_UI_Property_type"), |
| 179 | EMOFPackage.Literals.PROPERTY__DEFAULT, |
| 180 | true, |
| 181 | false, |
| 182 | false, |
| 183 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 184 | null, |
| 185 | null)); |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * This adds a property descriptor for the Is Composite feature. |
| 190 | * <!-- begin-user-doc --> |
| 191 | * <!-- end-user-doc --> |
| 192 | * @generated |
| 193 | */ |
| 194 | protected void addIsCompositePropertyDescriptor(Object object) { |
| 195 | itemPropertyDescriptors.add |
| 196 | (createItemPropertyDescriptor |
| 197 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 198 | getResourceLocator(), |
| 199 | getString("_UI_Property_isComposite_feature"), |
| 200 | getString("_UI_PropertyDescriptor_description", "_UI_Property_isComposite_feature", "_UI_Property_type"), |
| 201 | EMOFPackage.Literals.PROPERTY__IS_COMPOSITE, |
| 202 | true, |
| 203 | false, |
| 204 | false, |
| 205 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 206 | null, |
| 207 | null)); |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * This adds a property descriptor for the Is Derived feature. |
| 212 | * <!-- begin-user-doc --> |
| 213 | * <!-- end-user-doc --> |
| 214 | * @generated |
| 215 | */ |
| 216 | protected void addIsDerivedPropertyDescriptor(Object object) { |
| 217 | itemPropertyDescriptors.add |
| 218 | (createItemPropertyDescriptor |
| 219 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 220 | getResourceLocator(), |
| 221 | getString("_UI_Property_isDerived_feature"), |
| 222 | getString("_UI_PropertyDescriptor_description", "_UI_Property_isDerived_feature", "_UI_Property_type"), |
| 223 | EMOFPackage.Literals.PROPERTY__IS_DERIVED, |
| 224 | true, |
| 225 | false, |
| 226 | false, |
| 227 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 228 | null, |
| 229 | null)); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * This adds a property descriptor for the Is ID feature. |
| 234 | * <!-- begin-user-doc --> |
| 235 | * <!-- end-user-doc --> |
| 236 | * @generated |
| 237 | */ |
| 238 | protected void addIsIDPropertyDescriptor(Object object) { |
| 239 | itemPropertyDescriptors.add |
| 240 | (createItemPropertyDescriptor |
| 241 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 242 | getResourceLocator(), |
| 243 | getString("_UI_Property_isID_feature"), |
| 244 | getString("_UI_PropertyDescriptor_description", "_UI_Property_isID_feature", "_UI_Property_type"), |
| 245 | EMOFPackage.Literals.PROPERTY__IS_ID, |
| 246 | true, |
| 247 | false, |
| 248 | false, |
| 249 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 250 | null, |
| 251 | null)); |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * This adds a property descriptor for the Is Read Only feature. |
| 256 | * <!-- begin-user-doc --> |
| 257 | * <!-- end-user-doc --> |
| 258 | * @generated |
| 259 | */ |
| 260 | protected void addIsReadOnlyPropertyDescriptor(Object object) { |
| 261 | itemPropertyDescriptors.add |
| 262 | (createItemPropertyDescriptor |
| 263 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 264 | getResourceLocator(), |
| 265 | getString("_UI_Property_isReadOnly_feature"), |
| 266 | getString("_UI_PropertyDescriptor_description", "_UI_Property_isReadOnly_feature", "_UI_Property_type"), |
| 267 | EMOFPackage.Literals.PROPERTY__IS_READ_ONLY, |
| 268 | true, |
| 269 | false, |
| 270 | false, |
| 271 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 272 | null, |
| 273 | null)); |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * This adds a property descriptor for the Opposite feature. |
| 278 | * <!-- begin-user-doc --> |
| 279 | * <!-- end-user-doc --> |
| 280 | * @generated |
| 281 | */ |
| 282 | protected void addOppositePropertyDescriptor(Object object) { |
| 283 | itemPropertyDescriptors.add |
| 284 | (createItemPropertyDescriptor |
| 285 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 286 | getResourceLocator(), |
| 287 | getString("_UI_Property_opposite_feature"), |
| 288 | getString("_UI_PropertyDescriptor_description", "_UI_Property_opposite_feature", "_UI_Property_type"), |
| 289 | EMOFPackage.Literals.PROPERTY__OPPOSITE, |
| 290 | true, |
| 291 | false, |
| 292 | true, |
| 293 | null, |
| 294 | null, |
| 295 | null)); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * This returns Property.gif. |
| 300 | * <!-- begin-user-doc --> |
| 301 | * <!-- end-user-doc --> |
| 302 | * @generated |
| 303 | */ |
| 304 | @Override |
| 305 | public Object getImage(Object object) { |
| 306 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Property")); |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * This returns the label text for the adapted class. |
| 311 | * <!-- begin-user-doc --> |
| 312 | * <!-- end-user-doc --> |
| 313 | * @generated |
| 314 | */ |
| 315 | @Override |
| 316 | public String getText(Object object) { |
| 317 | String label = ((Property)object).getName(); |
| 318 | return label == null || label.length() == 0 ? |
| 319 | getString("_UI_Property_type") : |
| 320 | getString("_UI_Property_type") + " " + label; |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 325 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 326 | * <!-- begin-user-doc --> |
| 327 | * <!-- end-user-doc --> |
| 328 | * @generated |
| 329 | */ |
| 330 | @Override |
| 331 | public void notifyChanged(Notification notification) { |
| 332 | updateChildren(notification); |
| 333 | |
| 334 | switch (notification.getFeatureID(Property.class)) { |
| 335 | case EMOFPackage.PROPERTY__IS_ORDERED: |
| 336 | case EMOFPackage.PROPERTY__IS_UNIQUE: |
| 337 | case EMOFPackage.PROPERTY__LOWER: |
| 338 | case EMOFPackage.PROPERTY__UPPER: |
| 339 | case EMOFPackage.PROPERTY__DEFAULT: |
| 340 | case EMOFPackage.PROPERTY__IS_COMPOSITE: |
| 341 | case EMOFPackage.PROPERTY__IS_DERIVED: |
| 342 | case EMOFPackage.PROPERTY__IS_ID: |
| 343 | case EMOFPackage.PROPERTY__IS_READ_ONLY: |
| 344 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 345 | return; |
| 346 | } |
| 347 | super.notifyChanged(notification); |
| 348 | } |
| 349 | |
| 350 | /** |
| 351 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 352 | * that can be created under this object. |
| 353 | * <!-- begin-user-doc --> |
| 354 | * <!-- end-user-doc --> |
| 355 | * @generated |
| 356 | */ |
| 357 | @Override |
| 358 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 359 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 360 | } |
| 361 | |
| 362 | } |