| 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.AggregatedUsageContextFactory; |
| 10 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextPackage; |
| 11 | import de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage; |
| 12 | |
| 13 | import de.uka.ipd.sdq.context.computed_usage.provider.ContextEditPlugin; |
| 14 | |
| 15 | import java.util.Collection; |
| 16 | import java.util.List; |
| 17 | |
| 18 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 19 | import org.eclipse.emf.common.notify.Notification; |
| 20 | |
| 21 | import org.eclipse.emf.common.util.ResourceLocator; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 24 | |
| 25 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 26 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 27 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 28 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 29 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 30 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 31 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
| 32 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 33 | |
| 34 | /** |
| 35 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.ComputedAggregatedUsage} object. |
| 36 | * <!-- begin-user-doc --> |
| 37 | * <!-- end-user-doc --> |
| 38 | * @generated |
| 39 | */ |
| 40 | public class ComputedAggregatedUsageItemProvider |
| 41 | extends ItemProviderAdapter |
| 42 | implements |
| 43 | IEditingDomainItemProvider, |
| 44 | IStructuredItemContentProvider, |
| 45 | ITreeItemContentProvider, |
| 46 | IItemLabelProvider, |
| 47 | IItemPropertySource { |
| 48 | /** |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
| 54 | |
| 55 | /** |
| 56 | * This constructs an instance from a factory and a notifier. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @generated |
| 60 | */ |
| 61 | public ComputedAggregatedUsageItemProvider(AdapterFactory adapterFactory) { |
| 62 | super(adapterFactory); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * This returns the property descriptors for the adapted class. |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @generated |
| 70 | */ |
| 71 | @Override |
| 72 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 73 | if (itemPropertyDescriptors == null) { |
| 74 | super.getPropertyDescriptors(object); |
| 75 | |
| 76 | } |
| 77 | return itemPropertyDescriptors; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 82 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 83 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | @Override |
| 89 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 90 | if (childrenFeatures == null) { |
| 91 | super.getChildrenFeatures(object); |
| 92 | childrenFeatures.add(AggregatedUsageContextPackage.Literals.COMPUTED_AGGREGATED_USAGE__SERVICE_EXECUTION_CONTEXTS_COMPUTED_AGGREGATED_USAGE); |
| 93 | } |
| 94 | return childrenFeatures; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 104 | // Check the type of the specified child object and return the proper feature to use for |
| 105 | // adding (see {@link AddCommand}) it as a child. |
| 106 | |
| 107 | return super.getChildFeature(object, child); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * This returns ComputedAggregatedUsage.gif. |
| 112 | * <!-- begin-user-doc --> |
| 113 | * <!-- end-user-doc --> |
| 114 | * @generated |
| 115 | */ |
| 116 | @Override |
| 117 | public Object getImage(Object object) { |
| 118 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ComputedAggregatedUsage")); |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * This returns the label text for the adapted class. |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | @Override |
| 128 | public String getText(Object object) { |
| 129 | return getString("_UI_ComputedAggregatedUsage_type"); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 134 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | @Override |
| 140 | public void notifyChanged(Notification notification) { |
| 141 | updateChildren(notification); |
| 142 | |
| 143 | switch (notification.getFeatureID(ComputedAggregatedUsage.class)) { |
| 144 | case AggregatedUsageContextPackage.COMPUTED_AGGREGATED_USAGE__SERVICE_EXECUTION_CONTEXTS_COMPUTED_AGGREGATED_USAGE: |
| 145 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 146 | return; |
| 147 | } |
| 148 | super.notifyChanged(notification); |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 153 | * that can be created under this object. |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | @Override |
| 159 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 160 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 161 | |
| 162 | newChildDescriptors.add |
| 163 | (createChildParameter |
| 164 | (AggregatedUsageContextPackage.Literals.COMPUTED_AGGREGATED_USAGE__SERVICE_EXECUTION_CONTEXTS_COMPUTED_AGGREGATED_USAGE, |
| 165 | AggregatedUsageContextFactory.eINSTANCE.createServiceExecutionContext())); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * Return the resource locator for this item provider's resources. |
| 170 | * <!-- begin-user-doc --> |
| 171 | * <!-- end-user-doc --> |
| 172 | * @generated |
| 173 | */ |
| 174 | @Override |
| 175 | public ResourceLocator getResourceLocator() { |
| 176 | return ContextEditPlugin.INSTANCE; |
| 177 | } |
| 178 | |
| 179 | } |