| 1 | /** |
| 2 | * Copyright 2007-2009, SDQ, IPD, U Karlsruhe |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.probfunction.provider; |
| 7 | |
| 8 | |
| 9 | import java.util.Collection; |
| 10 | import java.util.List; |
| 11 | |
| 12 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 13 | import org.eclipse.emf.common.notify.Notification; |
| 14 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 15 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 16 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 17 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 18 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 19 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 20 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 21 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 22 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 23 | |
| 24 | import de.uka.ipd.sdq.probfunction.ExponentialDistribution; |
| 25 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
| 26 | |
| 27 | /** |
| 28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.probfunction.ExponentialDistribution} object. |
| 29 | * <!-- begin-user-doc --> |
| 30 | * <!-- end-user-doc --> |
| 31 | * @generated |
| 32 | */ |
| 33 | public class ExponentialDistributionItemProvider |
| 34 | extends ContinuousPDFItemProvider |
| 35 | implements |
| 36 | IEditingDomainItemProvider, |
| 37 | IStructuredItemContentProvider, |
| 38 | ITreeItemContentProvider, |
| 39 | IItemLabelProvider, |
| 40 | IItemPropertySource { |
| 41 | /** |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 47 | |
| 48 | /** |
| 49 | * This constructs an instance from a factory and a notifier. |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @generated |
| 53 | */ |
| 54 | public ExponentialDistributionItemProvider(AdapterFactory adapterFactory) { |
| 55 | super(adapterFactory); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * This returns the property descriptors for the adapted class. |
| 60 | * <!-- begin-user-doc --> |
| 61 | * <!-- end-user-doc --> |
| 62 | * @generated |
| 63 | */ |
| 64 | @Override |
| 65 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 66 | if (itemPropertyDescriptors == null) { |
| 67 | super.getPropertyDescriptors(object); |
| 68 | |
| 69 | addRatePropertyDescriptor(object); |
| 70 | } |
| 71 | return itemPropertyDescriptors; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * This adds a property descriptor for the Rate feature. |
| 76 | * <!-- begin-user-doc --> |
| 77 | * <!-- end-user-doc --> |
| 78 | * @generated |
| 79 | */ |
| 80 | protected void addRatePropertyDescriptor(Object object) { |
| 81 | itemPropertyDescriptors.add |
| 82 | (createItemPropertyDescriptor |
| 83 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 84 | getResourceLocator(), |
| 85 | getString("_UI_ExponentialDistribution_rate_feature"), |
| 86 | getString("_UI_PropertyDescriptor_description", "_UI_ExponentialDistribution_rate_feature", "_UI_ExponentialDistribution_type"), |
| 87 | ProbfunctionPackage.Literals.EXPONENTIAL_DISTRIBUTION__RATE, |
| 88 | true, |
| 89 | false, |
| 90 | false, |
| 91 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| 92 | null, |
| 93 | null)); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * This returns ExponentialDistribution.gif. |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | public Object getImage(Object object) { |
| 104 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ExponentialDistribution")); |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * This returns the label text for the adapted class. |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | @Override |
| 114 | public String getText(Object object) { |
| 115 | String label = ((ExponentialDistribution)object).getUnitSpecification(); |
| 116 | return label == null || label.length() == 0 ? |
| 117 | getString("_UI_ExponentialDistribution_type") : |
| 118 | getString("_UI_ExponentialDistribution_type") + " " + label; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 123 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | @Override |
| 129 | public void notifyChanged(Notification notification) { |
| 130 | updateChildren(notification); |
| 131 | |
| 132 | switch (notification.getFeatureID(ExponentialDistribution.class)) { |
| 133 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION__RATE: |
| 134 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 135 | return; |
| 136 | } |
| 137 | super.notifyChanged(notification); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 142 | * that can be created under this object. |
| 143 | * <!-- begin-user-doc --> |
| 144 | * <!-- end-user-doc --> |
| 145 | * @generated |
| 146 | */ |
| 147 | @Override |
| 148 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 149 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 150 | } |
| 151 | |
| 152 | } |