| 1 | /** |
| 2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.context.aggregatedUsageContext.provider; |
| 7 | |
| 8 | |
| 9 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedCommunication; |
| 10 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextPackage; |
| 11 | |
| 12 | import de.uka.ipd.sdq.context.computed_usage.provider.ContextEditPlugin; |
| 13 | |
| 14 | import java.util.Collection; |
| 15 | import java.util.List; |
| 16 | |
| 17 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 18 | import org.eclipse.emf.common.notify.Notification; |
| 19 | |
| 20 | import org.eclipse.emf.common.util.ResourceLocator; |
| 21 | |
| 22 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 25 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 29 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 30 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
| 31 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 32 | |
| 33 | /** |
| 34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedCommunication} object. |
| 35 | * <!-- begin-user-doc --> |
| 36 | * <!-- end-user-doc --> |
| 37 | * @generated |
| 38 | */ |
| 39 | public class AggregatedCommunicationItemProvider |
| 40 | extends ItemProviderAdapter |
| 41 | implements |
| 42 | IEditingDomainItemProvider, |
| 43 | IStructuredItemContentProvider, |
| 44 | ITreeItemContentProvider, |
| 45 | IItemLabelProvider, |
| 46 | IItemPropertySource { |
| 47 | /** |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @generated |
| 51 | */ |
| 52 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
| 53 | |
| 54 | /** |
| 55 | * This constructs an instance from a factory and a notifier. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | public AggregatedCommunicationItemProvider(AdapterFactory adapterFactory) { |
| 61 | super(adapterFactory); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * This returns the property descriptors for the adapted class. |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | @Override |
| 71 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 72 | if (itemPropertyDescriptors == null) { |
| 73 | super.getPropertyDescriptors(object); |
| 74 | |
| 75 | addAverageMessageSizePropertyDescriptor(object); |
| 76 | addAverageMessageFrequencyPropertyDescriptor(object); |
| 77 | addReceiver_AggregatedCommunicationPropertyDescriptor(object); |
| 78 | addUsedCommunicationLinkResourceSpecification_AggregatedCommunicationPropertyDescriptor(object); |
| 79 | } |
| 80 | return itemPropertyDescriptors; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * This adds a property descriptor for the Average Message Size feature. |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | protected void addAverageMessageSizePropertyDescriptor(Object object) { |
| 90 | itemPropertyDescriptors.add |
| 91 | (createItemPropertyDescriptor |
| 92 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 93 | getResourceLocator(), |
| 94 | getString("_UI_AggregatedCommunication_averageMessageSize_feature"), |
| 95 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedCommunication_averageMessageSize_feature", "_UI_AggregatedCommunication_type"), |
| 96 | AggregatedUsageContextPackage.Literals.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE, |
| 97 | true, |
| 98 | false, |
| 99 | false, |
| 100 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| 101 | null, |
| 102 | null)); |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * This adds a property descriptor for the Average Message Frequency feature. |
| 107 | * <!-- begin-user-doc --> |
| 108 | * <!-- end-user-doc --> |
| 109 | * @generated |
| 110 | */ |
| 111 | protected void addAverageMessageFrequencyPropertyDescriptor(Object object) { |
| 112 | itemPropertyDescriptors.add |
| 113 | (createItemPropertyDescriptor |
| 114 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 115 | getResourceLocator(), |
| 116 | getString("_UI_AggregatedCommunication_averageMessageFrequency_feature"), |
| 117 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedCommunication_averageMessageFrequency_feature", "_UI_AggregatedCommunication_type"), |
| 118 | AggregatedUsageContextPackage.Literals.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY, |
| 119 | true, |
| 120 | false, |
| 121 | false, |
| 122 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
| 123 | null, |
| 124 | null)); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * This adds a property descriptor for the Receiver Aggregated Communication feature. |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | protected void addReceiver_AggregatedCommunicationPropertyDescriptor(Object object) { |
| 134 | itemPropertyDescriptors.add |
| 135 | (createItemPropertyDescriptor |
| 136 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 137 | getResourceLocator(), |
| 138 | getString("_UI_AggregatedCommunication_receiver_AggregatedCommunication_feature"), |
| 139 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedCommunication_receiver_AggregatedCommunication_feature", "_UI_AggregatedCommunication_type"), |
| 140 | AggregatedUsageContextPackage.Literals.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION, |
| 141 | true, |
| 142 | false, |
| 143 | true, |
| 144 | null, |
| 145 | null, |
| 146 | null)); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * This adds a property descriptor for the Used Communication Link Resource Specification Aggregated Communication feature. |
| 151 | * <!-- begin-user-doc --> |
| 152 | * <!-- end-user-doc --> |
| 153 | * @generated |
| 154 | */ |
| 155 | protected void addUsedCommunicationLinkResourceSpecification_AggregatedCommunicationPropertyDescriptor(Object object) { |
| 156 | itemPropertyDescriptors.add |
| 157 | (createItemPropertyDescriptor |
| 158 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 159 | getResourceLocator(), |
| 160 | getString("_UI_AggregatedCommunication_usedCommunicationLinkResourceSpecification_AggregatedCommunication_feature"), |
| 161 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedCommunication_usedCommunicationLinkResourceSpecification_AggregatedCommunication_feature", "_UI_AggregatedCommunication_type"), |
| 162 | AggregatedUsageContextPackage.Literals.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION, |
| 163 | true, |
| 164 | false, |
| 165 | true, |
| 166 | null, |
| 167 | null, |
| 168 | null)); |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * This returns AggregatedCommunication.gif. |
| 173 | * <!-- begin-user-doc --> |
| 174 | * <!-- end-user-doc --> |
| 175 | * @generated |
| 176 | */ |
| 177 | @Override |
| 178 | public Object getImage(Object object) { |
| 179 | return overlayImage(object, getResourceLocator().getImage("full/obj16/AggregatedCommunication")); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * This returns the label text for the adapted class. |
| 184 | * <!-- begin-user-doc --> |
| 185 | * <!-- end-user-doc --> |
| 186 | * @generated |
| 187 | */ |
| 188 | @Override |
| 189 | public String getText(Object object) { |
| 190 | AggregatedCommunication aggregatedCommunication = (AggregatedCommunication)object; |
| 191 | return getString("_UI_AggregatedCommunication_type") + " " + aggregatedCommunication.getAverageMessageSize(); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 196 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 197 | * <!-- begin-user-doc --> |
| 198 | * <!-- end-user-doc --> |
| 199 | * @generated |
| 200 | */ |
| 201 | @Override |
| 202 | public void notifyChanged(Notification notification) { |
| 203 | updateChildren(notification); |
| 204 | |
| 205 | switch (notification.getFeatureID(AggregatedCommunication.class)) { |
| 206 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE: |
| 207 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY: |
| 208 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 209 | return; |
| 210 | } |
| 211 | super.notifyChanged(notification); |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 216 | * that can be created under this object. |
| 217 | * <!-- begin-user-doc --> |
| 218 | * <!-- end-user-doc --> |
| 219 | * @generated |
| 220 | */ |
| 221 | @Override |
| 222 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 223 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Return the resource locator for this item provider's resources. |
| 228 | * <!-- begin-user-doc --> |
| 229 | * <!-- end-user-doc --> |
| 230 | * @generated |
| 231 | */ |
| 232 | @Override |
| 233 | public ResourceLocator getResourceLocator() { |
| 234 | return ContextEditPlugin.INSTANCE; |
| 235 | } |
| 236 | |
| 237 | } |