| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.sensitivity.provider; |
| 8 | |
| 9 | |
| 10 | import de.uka.ipd.sdq.sensitivity.SensitivityPackage; |
| 11 | import de.uka.ipd.sdq.sensitivity.VariableUsageParameter; |
| 12 | |
| 13 | import java.util.Collection; |
| 14 | import java.util.List; |
| 15 | |
| 16 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 17 | import org.eclipse.emf.common.notify.Notification; |
| 18 | |
| 19 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 20 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 21 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 22 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 23 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 24 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 25 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 26 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 27 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 28 | |
| 29 | /** |
| 30 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.sensitivity.VariableUsageParameter} object. |
| 31 | * <!-- begin-user-doc --> |
| 32 | * <!-- end-user-doc --> |
| 33 | * @generated |
| 34 | */ |
| 35 | public class VariableUsageParameterItemProvider |
| 36 | extends SingleSensitivityParameterItemProvider |
| 37 | implements |
| 38 | IEditingDomainItemProvider, |
| 39 | IStructuredItemContentProvider, |
| 40 | ITreeItemContentProvider, |
| 41 | IItemLabelProvider, |
| 42 | IItemPropertySource { |
| 43 | /** |
| 44 | * This constructs an instance from a factory and a notifier. |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @generated |
| 48 | */ |
| 49 | public VariableUsageParameterItemProvider(AdapterFactory adapterFactory) { |
| 50 | super(adapterFactory); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * This returns the property descriptors for the adapted class. |
| 55 | * <!-- begin-user-doc --> |
| 56 | * <!-- end-user-doc --> |
| 57 | * @generated |
| 58 | */ |
| 59 | @Override |
| 60 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 61 | if (itemPropertyDescriptors == null) { |
| 62 | super.getPropertyDescriptors(object); |
| 63 | |
| 64 | addVariableNamePropertyDescriptor(object); |
| 65 | addEntryLevelSystemCall__VariableUsageParameterPropertyDescriptor(object); |
| 66 | addVariableCharacterisationType__VariableUsageParameterPropertyDescriptor(object); |
| 67 | addVariableUsageType__VariableUsageParameterPropertyDescriptor(object); |
| 68 | addBasicComponent__VariableUsageParameterPropertyDescriptor(object); |
| 69 | } |
| 70 | return itemPropertyDescriptors; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * This adds a property descriptor for the Variable Name feature. |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | protected void addVariableNamePropertyDescriptor(Object object) { |
| 80 | itemPropertyDescriptors.add |
| 81 | (createItemPropertyDescriptor |
| 82 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 83 | getResourceLocator(), |
| 84 | getString("_UI_VariableUsageParameter_VariableName_feature"), |
| 85 | getString("_UI_PropertyDescriptor_description", "_UI_VariableUsageParameter_VariableName_feature", "_UI_VariableUsageParameter_type"), |
| 86 | SensitivityPackage.Literals.VARIABLE_USAGE_PARAMETER__VARIABLE_NAME, |
| 87 | true, |
| 88 | false, |
| 89 | false, |
| 90 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 91 | null, |
| 92 | null)); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * This adds a property descriptor for the Entry Level System Call Variable Usage Parameter feature. |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | protected void addEntryLevelSystemCall__VariableUsageParameterPropertyDescriptor(Object object) { |
| 102 | itemPropertyDescriptors.add |
| 103 | (createItemPropertyDescriptor |
| 104 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 105 | getResourceLocator(), |
| 106 | getString("_UI_VariableUsageParameter_entryLevelSystemCall__VariableUsageParameter_feature"), |
| 107 | getString("_UI_PropertyDescriptor_description", "_UI_VariableUsageParameter_entryLevelSystemCall__VariableUsageParameter_feature", "_UI_VariableUsageParameter_type"), |
| 108 | SensitivityPackage.Literals.VARIABLE_USAGE_PARAMETER__ENTRY_LEVEL_SYSTEM_CALL_VARIABLE_USAGE_PARAMETER, |
| 109 | true, |
| 110 | false, |
| 111 | true, |
| 112 | null, |
| 113 | null, |
| 114 | null)); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * This adds a property descriptor for the Variable Characterisation Type Variable Usage Parameter feature. |
| 119 | * <!-- begin-user-doc --> |
| 120 | * <!-- end-user-doc --> |
| 121 | * @generated |
| 122 | */ |
| 123 | protected void addVariableCharacterisationType__VariableUsageParameterPropertyDescriptor(Object object) { |
| 124 | itemPropertyDescriptors.add |
| 125 | (createItemPropertyDescriptor |
| 126 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 127 | getResourceLocator(), |
| 128 | getString("_UI_VariableUsageParameter_variableCharacterisationType__VariableUsageParameter_feature"), |
| 129 | getString("_UI_PropertyDescriptor_description", "_UI_VariableUsageParameter_variableCharacterisationType__VariableUsageParameter_feature", "_UI_VariableUsageParameter_type"), |
| 130 | SensitivityPackage.Literals.VARIABLE_USAGE_PARAMETER__VARIABLE_CHARACTERISATION_TYPE_VARIABLE_USAGE_PARAMETER, |
| 131 | true, |
| 132 | false, |
| 133 | false, |
| 134 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 135 | null, |
| 136 | null)); |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * This adds a property descriptor for the Variable Usage Type Variable Usage Parameter feature. |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | protected void addVariableUsageType__VariableUsageParameterPropertyDescriptor(Object object) { |
| 146 | itemPropertyDescriptors.add |
| 147 | (createItemPropertyDescriptor |
| 148 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 149 | getResourceLocator(), |
| 150 | getString("_UI_VariableUsageParameter_variableUsageType__VariableUsageParameter_feature"), |
| 151 | getString("_UI_PropertyDescriptor_description", "_UI_VariableUsageParameter_variableUsageType__VariableUsageParameter_feature", "_UI_VariableUsageParameter_type"), |
| 152 | SensitivityPackage.Literals.VARIABLE_USAGE_PARAMETER__VARIABLE_USAGE_TYPE_VARIABLE_USAGE_PARAMETER, |
| 153 | true, |
| 154 | false, |
| 155 | false, |
| 156 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 157 | null, |
| 158 | null)); |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * This adds a property descriptor for the Basic Component Variable Usage Parameter feature. |
| 163 | * <!-- begin-user-doc --> |
| 164 | * <!-- end-user-doc --> |
| 165 | * @generated |
| 166 | */ |
| 167 | protected void addBasicComponent__VariableUsageParameterPropertyDescriptor(Object object) { |
| 168 | itemPropertyDescriptors.add |
| 169 | (createItemPropertyDescriptor |
| 170 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 171 | getResourceLocator(), |
| 172 | getString("_UI_VariableUsageParameter_basicComponent__VariableUsageParameter_feature"), |
| 173 | getString("_UI_PropertyDescriptor_description", "_UI_VariableUsageParameter_basicComponent__VariableUsageParameter_feature", "_UI_VariableUsageParameter_type"), |
| 174 | SensitivityPackage.Literals.VARIABLE_USAGE_PARAMETER__BASIC_COMPONENT_VARIABLE_USAGE_PARAMETER, |
| 175 | true, |
| 176 | false, |
| 177 | true, |
| 178 | null, |
| 179 | null, |
| 180 | null)); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * This returns VariableUsageParameter.gif. |
| 185 | * <!-- begin-user-doc --> |
| 186 | * <!-- end-user-doc --> |
| 187 | * @generated |
| 188 | */ |
| 189 | @Override |
| 190 | public Object getImage(Object object) { |
| 191 | return overlayImage(object, getResourceLocator().getImage("full/obj16/VariableUsageParameter")); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * This returns the label text for the adapted class. |
| 196 | * <!-- begin-user-doc --> |
| 197 | * <!-- end-user-doc --> |
| 198 | * @generated not |
| 199 | */ |
| 200 | @Override |
| 201 | public String getText(Object object) { |
| 202 | String paramName = "UNSPECIFIED"; |
| 203 | try { |
| 204 | switch(((VariableUsageParameter)object). |
| 205 | getVariableUsageType__VariableUsageParameter()) { |
| 206 | case SYSTEM_CALL_INPUT: |
| 207 | paramName = ((VariableUsageParameter)object). |
| 208 | getEntryLevelSystemCall__VariableUsageParameter().getEntityName(); |
| 209 | break; |
| 210 | case COMPONENT_CONFIGURATION: |
| 211 | paramName = ((VariableUsageParameter)object). |
| 212 | getBasicComponent__VariableUsageParameter().getEntityName(); |
| 213 | break; |
| 214 | } |
| 215 | } catch(Exception e) {} |
| 216 | String inputCharacterisation = ((VariableUsageParameter)object). |
| 217 | getVariableName() + "." + ((VariableUsageParameter)object). |
| 218 | getVariableCharacterisationType__VariableUsageParameter().toString(); |
| 219 | return ((VariableUsageParameter)object).getEntityName() |
| 220 | + " (" + paramName + "/" + inputCharacterisation + ")" |
| 221 | + " [ID: " + ((VariableUsageParameter)object).getId() + "]" |
| 222 | + " <" + getString("_UI_VariableUsageParameter_type") + ">"; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 227 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 228 | * <!-- begin-user-doc --> |
| 229 | * <!-- end-user-doc --> |
| 230 | * @generated |
| 231 | */ |
| 232 | @Override |
| 233 | public void notifyChanged(Notification notification) { |
| 234 | updateChildren(notification); |
| 235 | |
| 236 | switch (notification.getFeatureID(VariableUsageParameter.class)) { |
| 237 | case SensitivityPackage.VARIABLE_USAGE_PARAMETER__VARIABLE_NAME: |
| 238 | case SensitivityPackage.VARIABLE_USAGE_PARAMETER__VARIABLE_CHARACTERISATION_TYPE_VARIABLE_USAGE_PARAMETER: |
| 239 | case SensitivityPackage.VARIABLE_USAGE_PARAMETER__VARIABLE_USAGE_TYPE_VARIABLE_USAGE_PARAMETER: |
| 240 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 241 | return; |
| 242 | } |
| 243 | super.notifyChanged(notification); |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 248 | * that can be created under this object. |
| 249 | * <!-- begin-user-doc --> |
| 250 | * <!-- end-user-doc --> |
| 251 | * @generated |
| 252 | */ |
| 253 | @Override |
| 254 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 255 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 256 | } |
| 257 | |
| 258 | } |