| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.provider; |
| 8 | |
| 9 | |
| 10 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EnumLiteral; |
| 11 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.QMLContractPackage; |
| 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 | |
| 27 | /** |
| 28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EnumLiteral} object. |
| 29 | * <!-- begin-user-doc --> |
| 30 | * <!-- end-user-doc --> |
| 31 | * @generated |
| 32 | */ |
| 33 | public class EnumLiteralItemProvider |
| 34 | extends ValueLiteralItemProvider |
| 35 | implements |
| 36 | IEditingDomainItemProvider, |
| 37 | IStructuredItemContentProvider, |
| 38 | ITreeItemContentProvider, |
| 39 | IItemLabelProvider, |
| 40 | IItemPropertySource { |
| 41 | /** |
| 42 | * This constructs an instance from a factory and a notifier. |
| 43 | * <!-- begin-user-doc --> |
| 44 | * <!-- end-user-doc --> |
| 45 | * @generated |
| 46 | */ |
| 47 | public EnumLiteralItemProvider(AdapterFactory adapterFactory) { |
| 48 | super(adapterFactory); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * This returns the property descriptors for the adapted class. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @generated |
| 56 | */ |
| 57 | @Override |
| 58 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 59 | if (itemPropertyDescriptors == null) { |
| 60 | super.getPropertyDescriptors(object); |
| 61 | |
| 62 | addValuePropertyDescriptor(object); |
| 63 | } |
| 64 | return itemPropertyDescriptors; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * This adds a property descriptor for the Value feature. |
| 69 | * <!-- begin-user-doc --> |
| 70 | * <!-- end-user-doc --> |
| 71 | * @generated |
| 72 | */ |
| 73 | protected void addValuePropertyDescriptor(Object object) { |
| 74 | itemPropertyDescriptors.add |
| 75 | (createItemPropertyDescriptor |
| 76 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 77 | getResourceLocator(), |
| 78 | getString("_UI_EnumLiteral_value_feature"), |
| 79 | getString("_UI_PropertyDescriptor_description", "_UI_EnumLiteral_value_feature", "_UI_EnumLiteral_type"), |
| 80 | QMLContractPackage.Literals.ENUM_LITERAL__VALUE, |
| 81 | true, |
| 82 | false, |
| 83 | true, |
| 84 | null, |
| 85 | null, |
| 86 | null)); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * This returns EnumLiteral.gif. |
| 91 | * <!-- begin-user-doc --> |
| 92 | * <!-- end-user-doc --> |
| 93 | * @generated |
| 94 | */ |
| 95 | @Override |
| 96 | public Object getImage(Object object) { |
| 97 | return overlayImage(object, getResourceLocator().getImage("full/obj16/EnumLiteral")); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * This returns the label text for the adapted class. |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @generated |
| 105 | */ |
| 106 | @Override |
| 107 | public String getText(Object object) { |
| 108 | String label = ((EnumLiteral)object).getId(); |
| 109 | return label == null || label.length() == 0 ? |
| 110 | getString("_UI_EnumLiteral_type") : |
| 111 | getString("_UI_EnumLiteral_type") + " " + label; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 116 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 117 | * <!-- begin-user-doc --> |
| 118 | * <!-- end-user-doc --> |
| 119 | * @generated |
| 120 | */ |
| 121 | @Override |
| 122 | public void notifyChanged(Notification notification) { |
| 123 | updateChildren(notification); |
| 124 | super.notifyChanged(notification); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 129 | * that can be created under this object. |
| 130 | * <!-- begin-user-doc --> |
| 131 | * <!-- end-user-doc --> |
| 132 | * @generated |
| 133 | */ |
| 134 | @Override |
| 135 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 136 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 137 | } |
| 138 | |
| 139 | } |