| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.sensitivity.provider; |
| 8 | |
| 9 | |
| 10 | import java.util.Collection; |
| 11 | import java.util.List; |
| 12 | |
| 13 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 14 | import org.eclipse.emf.common.notify.Notification; |
| 15 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 16 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 17 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 18 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 19 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 20 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 21 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 22 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 23 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 24 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 25 | |
| 26 | import de.uka.ipd.sdq.sensitivity.CombinedSensitivityParameter; |
| 27 | import de.uka.ipd.sdq.sensitivity.SensitivityFactory; |
| 28 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
| 29 | |
| 30 | /** |
| 31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.CombinedSensitivityParameter} object. |
| 32 | * <!-- begin-user-doc --> |
| 33 | * <!-- end-user-doc --> |
| 34 | * @generated |
| 35 | */ |
| 36 | public class CombinedSensitivityParameterItemProvider |
| 37 | extends SensitivityParameterItemProvider |
| 38 | implements |
| 39 | IEditingDomainItemProvider, |
| 40 | IStructuredItemContentProvider, |
| 41 | ITreeItemContentProvider, |
| 42 | IItemLabelProvider, |
| 43 | IItemPropertySource { |
| 44 | /** |
| 45 | * This constructs an instance from a factory and a notifier. |
| 46 | * <!-- begin-user-doc --> |
| 47 | * <!-- end-user-doc --> |
| 48 | * @generated |
| 49 | */ |
| 50 | public CombinedSensitivityParameterItemProvider(AdapterFactory adapterFactory) { |
| 51 | super(adapterFactory); |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * This returns the property descriptors for the adapted class. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @generated |
| 59 | */ |
| 60 | @Override |
| 61 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 62 | if (itemPropertyDescriptors == null) { |
| 63 | super.getPropertyDescriptors(object); |
| 64 | |
| 65 | addIsCombinatoryPropertyDescriptor(object); |
| 66 | } |
| 67 | return itemPropertyDescriptors; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * This adds a property descriptor for the Is Combinatory feature. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | protected void addIsCombinatoryPropertyDescriptor(Object object) { |
| 77 | itemPropertyDescriptors.add |
| 78 | (createItemPropertyDescriptor |
| 79 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 80 | getResourceLocator(), |
| 81 | getString("_UI_CombinedSensitivityParameter_isCombinatory_feature"), |
| 82 | getString("_UI_PropertyDescriptor_description", "_UI_CombinedSensitivityParameter_isCombinatory_feature", "_UI_CombinedSensitivityParameter_type"), |
| 83 | SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__IS_COMBINATORY, |
| 84 | true, |
| 85 | false, |
| 86 | false, |
| 87 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
| 88 | null, |
| 89 | null)); |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 94 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 95 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | @Override |
| 101 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 102 | if (childrenFeatures == null) { |
| 103 | super.getChildrenFeatures(object); |
| 104 | childrenFeatures.add(SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER); |
| 105 | } |
| 106 | return childrenFeatures; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * <!-- begin-user-doc --> |
| 111 | * <!-- end-user-doc --> |
| 112 | * @generated |
| 113 | */ |
| 114 | @Override |
| 115 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 116 | // Check the type of the specified child object and return the proper feature to use for |
| 117 | // adding (see {@link AddCommand}) it as a child. |
| 118 | |
| 119 | return super.getChildFeature(object, child); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * This returns CombinedSensitivityParameter.gif. |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | @Override |
| 129 | public Object getImage(Object object) { |
| 130 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CombinedSensitivityParameter")); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * This returns the label text for the adapted class. |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated not |
| 138 | */ |
| 139 | @Override |
| 140 | public String getText(Object object) { |
| 141 | return ((CombinedSensitivityParameter)object).getEntityName() |
| 142 | + " [ID: " + ((CombinedSensitivityParameter)object).getId() + "]" |
| 143 | + " <" + getString("_UI_CombinedSensitivityParameter_type") + ">"; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 148 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 149 | * <!-- begin-user-doc --> |
| 150 | * <!-- end-user-doc --> |
| 151 | * @generated |
| 152 | */ |
| 153 | @Override |
| 154 | public void notifyChanged(Notification notification) { |
| 155 | updateChildren(notification); |
| 156 | |
| 157 | switch (notification.getFeatureID(CombinedSensitivityParameter.class)) { |
| 158 | case SensitivityPackage.COMBINED_SENSITIVITY_PARAMETER__IS_COMBINATORY: |
| 159 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 160 | return; |
| 161 | case SensitivityPackage.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER: |
| 162 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 163 | return; |
| 164 | } |
| 165 | super.notifyChanged(notification); |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 170 | * that can be created under this object. |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | @Override |
| 176 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 177 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 178 | |
| 179 | newChildDescriptors.add |
| 180 | (createChildParameter |
| 181 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 182 | SensitivityFactory.eINSTANCE.createCombinedSensitivityParameter())); |
| 183 | |
| 184 | newChildDescriptors.add |
| 185 | (createChildParameter |
| 186 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 187 | SensitivityFactory.eINSTANCE.createComponentReliabilityParameter())); |
| 188 | |
| 189 | newChildDescriptors.add |
| 190 | (createChildParameter |
| 191 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 192 | SensitivityFactory.eINSTANCE.createInternalActionReliabilityParameter())); |
| 193 | |
| 194 | newChildDescriptors.add |
| 195 | (createChildParameter |
| 196 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 197 | SensitivityFactory.eINSTANCE.createProbabilisticBranchParameter())); |
| 198 | |
| 199 | newChildDescriptors.add |
| 200 | (createChildParameter |
| 201 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 202 | SensitivityFactory.eINSTANCE.createHardwareMTTFParameter())); |
| 203 | |
| 204 | newChildDescriptors.add |
| 205 | (createChildParameter |
| 206 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 207 | SensitivityFactory.eINSTANCE.createHardwareMTTRParameter())); |
| 208 | |
| 209 | newChildDescriptors.add |
| 210 | (createChildParameter |
| 211 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 212 | SensitivityFactory.eINSTANCE.createResourceMTTFParameter())); |
| 213 | |
| 214 | newChildDescriptors.add |
| 215 | (createChildParameter |
| 216 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 217 | SensitivityFactory.eINSTANCE.createResourceMTTRParameter())); |
| 218 | |
| 219 | newChildDescriptors.add |
| 220 | (createChildParameter |
| 221 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 222 | SensitivityFactory.eINSTANCE.createNetworkReliabilityParameter())); |
| 223 | |
| 224 | newChildDescriptors.add |
| 225 | (createChildParameter |
| 226 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 227 | SensitivityFactory.eINSTANCE.createCommunicationLinkReliabilityParameter())); |
| 228 | |
| 229 | newChildDescriptors.add |
| 230 | (createChildParameter |
| 231 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 232 | SensitivityFactory.eINSTANCE.createSoftwareReliabilityParameter())); |
| 233 | |
| 234 | newChildDescriptors.add |
| 235 | (createChildParameter |
| 236 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 237 | SensitivityFactory.eINSTANCE.createVariableUsageParameter())); |
| 238 | |
| 239 | newChildDescriptors.add |
| 240 | (createChildParameter |
| 241 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 242 | SensitivityFactory.eINSTANCE.createUsageBranchParameter())); |
| 243 | |
| 244 | newChildDescriptors.add |
| 245 | (createChildParameter |
| 246 | (SensitivityPackage.Literals.COMBINED_SENSITIVITY_PARAMETER__CHILD_PARAMETERS_COMBINED_SENSITIVITY_PARAMETER, |
| 247 | SensitivityFactory.eINSTANCE.createSoftwareFailureTypesParameter())); |
| 248 | } |
| 249 | |
| 250 | } |