| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.fzi.se.quality.qualityannotation.provider; |
| 8 | |
| 9 | |
| 10 | import de.fzi.se.quality.provider.QualityEditPlugin; |
| 11 | |
| 12 | import de.fzi.se.quality.qualityannotation.NumberOfCallsDeviation; |
| 13 | import de.fzi.se.quality.qualityannotation.QualityAnnotationFactory; |
| 14 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
| 15 | |
| 16 | import java.util.Collection; |
| 17 | import java.util.List; |
| 18 | |
| 19 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 20 | import org.eclipse.emf.common.notify.Notification; |
| 21 | |
| 22 | import org.eclipse.emf.common.util.ResourceLocator; |
| 23 | |
| 24 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 25 | |
| 26 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 27 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 28 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 29 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 30 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 31 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 32 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 33 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 34 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
| 35 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 36 | |
| 37 | /** |
| 38 | * This is the item provider adapter for a {@link de.fzi.se.quality.qualityannotation.NumberOfCallsDeviation} object. |
| 39 | * <!-- begin-user-doc --> |
| 40 | * <!-- end-user-doc --> |
| 41 | * @generated |
| 42 | */ |
| 43 | public class NumberOfCallsDeviationItemProvider |
| 44 | extends ItemProviderAdapter |
| 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 NumberOfCallsDeviationItemProvider(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 | addMaximumPropertyDescriptor(object); |
| 73 | } |
| 74 | return itemPropertyDescriptors; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * This adds a property descriptor for the Maximum feature. |
| 79 | * <!-- begin-user-doc --> |
| 80 | * <!-- end-user-doc --> |
| 81 | * @generated |
| 82 | */ |
| 83 | protected void addMaximumPropertyDescriptor(Object object) { |
| 84 | itemPropertyDescriptors.add |
| 85 | (createItemPropertyDescriptor |
| 86 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 87 | getResourceLocator(), |
| 88 | getString("_UI_NumberOfCallsDeviation_maximum_feature"), |
| 89 | getString("_UI_PropertyDescriptor_description", "_UI_NumberOfCallsDeviation_maximum_feature", "_UI_NumberOfCallsDeviation_type"), |
| 90 | QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__MAXIMUM, |
| 91 | true, |
| 92 | false, |
| 93 | false, |
| 94 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| 95 | null, |
| 96 | null)); |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 101 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 102 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 103 | * <!-- begin-user-doc --> |
| 104 | * <!-- end-user-doc --> |
| 105 | * @generated |
| 106 | */ |
| 107 | @Override |
| 108 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 109 | if (childrenFeatures == null) { |
| 110 | super.getChildrenFeatures(object); |
| 111 | childrenFeatures.add(QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT); |
| 112 | } |
| 113 | return childrenFeatures; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * <!-- begin-user-doc --> |
| 118 | * <!-- end-user-doc --> |
| 119 | * @generated |
| 120 | */ |
| 121 | @Override |
| 122 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 123 | // Check the type of the specified child object and return the proper feature to use for |
| 124 | // adding (see {@link AddCommand}) it as a child. |
| 125 | |
| 126 | return super.getChildFeature(object, child); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * This returns NumberOfCallsDeviation.gif. |
| 131 | * <!-- begin-user-doc --> |
| 132 | * <!-- end-user-doc --> |
| 133 | * @generated |
| 134 | */ |
| 135 | @Override |
| 136 | public Object getImage(Object object) { |
| 137 | return overlayImage(object, getResourceLocator().getImage("full/obj16/NumberOfCallsDeviation")); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * This returns the label text for the adapted class. |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | @Override |
| 147 | public String getText(Object object) { |
| 148 | NumberOfCallsDeviation numberOfCallsDeviation = (NumberOfCallsDeviation)object; |
| 149 | return getString("_UI_NumberOfCallsDeviation_type") + " " + numberOfCallsDeviation.getMaximum(); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 154 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | @Override |
| 160 | public void notifyChanged(Notification notification) { |
| 161 | updateChildren(notification); |
| 162 | |
| 163 | switch (notification.getFeatureID(NumberOfCallsDeviation.class)) { |
| 164 | case QualityAnnotationPackage.NUMBER_OF_CALLS_DEVIATION__MAXIMUM: |
| 165 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 166 | return; |
| 167 | case QualityAnnotationPackage.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT: |
| 168 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 169 | return; |
| 170 | } |
| 171 | super.notifyChanged(notification); |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 176 | * that can be created under this object. |
| 177 | * <!-- begin-user-doc --> |
| 178 | * <!-- end-user-doc --> |
| 179 | * @generated |
| 180 | */ |
| 181 | @Override |
| 182 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 183 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 184 | |
| 185 | newChildDescriptors.add |
| 186 | (createChildParameter |
| 187 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 188 | QualityAnnotationFactory.eINSTANCE.createRequiredElement())); |
| 189 | |
| 190 | newChildDescriptors.add |
| 191 | (createChildParameter |
| 192 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 193 | QualityAnnotationFactory.eINSTANCE.createPCMRECategory())); |
| 194 | |
| 195 | newChildDescriptors.add |
| 196 | (createChildParameter |
| 197 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 198 | QualityAnnotationFactory.eINSTANCE.createPCMREInterface())); |
| 199 | |
| 200 | newChildDescriptors.add |
| 201 | (createChildParameter |
| 202 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 203 | QualityAnnotationFactory.eINSTANCE.createPCMRERole())); |
| 204 | |
| 205 | newChildDescriptors.add |
| 206 | (createChildParameter |
| 207 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 208 | QualityAnnotationFactory.eINSTANCE.createPCMRESignature())); |
| 209 | |
| 210 | newChildDescriptors.add |
| 211 | (createChildParameter |
| 212 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 213 | QualityAnnotationFactory.eINSTANCE.createPCMREResourceInterface())); |
| 214 | |
| 215 | newChildDescriptors.add |
| 216 | (createChildParameter |
| 217 | (QualityAnnotationPackage.Literals.NUMBER_OF_CALLS_DEVIATION__REQUIRED_ELEMENT, |
| 218 | QualityAnnotationFactory.eINSTANCE.createPCMREResourceSignature())); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Return the resource locator for this item provider's resources. |
| 223 | * <!-- begin-user-doc --> |
| 224 | * <!-- end-user-doc --> |
| 225 | * @generated |
| 226 | */ |
| 227 | @Override |
| 228 | public ResourceLocator getResourceLocator() { |
| 229 | return QualityEditPlugin.INSTANCE; |
| 230 | } |
| 231 | |
| 232 | } |