| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.seff.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.ecore.EStructuralFeature; |
| 15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
| 17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| 19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
| 20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
| 21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
| 22 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| 23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 24 | |
| 25 | import de.uka.ipd.sdq.identifier.IdentifierPackage; |
| 26 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
| 27 | import de.uka.ipd.sdq.pcm.seff.InternalCallAction; |
| 28 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 29 | import de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performanceFactory; |
| 30 | |
| 31 | /** |
| 32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.InternalCallAction} object. |
| 33 | * <!-- begin-user-doc --> |
| 34 | * <!-- end-user-doc --> |
| 35 | * @generated |
| 36 | */ |
| 37 | public class InternalCallActionItemProvider |
| 38 | extends CallActionItemProvider |
| 39 | implements |
| 40 | IEditingDomainItemProvider, |
| 41 | IStructuredItemContentProvider, |
| 42 | ITreeItemContentProvider, |
| 43 | IItemLabelProvider, |
| 44 | IItemPropertySource { |
| 45 | /** |
| 46 | * <!-- begin-user-doc --> |
| 47 | * <!-- end-user-doc --> |
| 48 | * @generated |
| 49 | */ |
| 50 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 51 | |
| 52 | /** |
| 53 | * This constructs an instance from a factory and a notifier. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @generated |
| 57 | */ |
| 58 | public InternalCallActionItemProvider(AdapterFactory adapterFactory) { |
| 59 | super(adapterFactory); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * This returns the property descriptors for the adapted class. |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @generated |
| 67 | */ |
| 68 | @Override |
| 69 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
| 70 | if (itemPropertyDescriptors == null) { |
| 71 | super.getPropertyDescriptors(object); |
| 72 | |
| 73 | addIdPropertyDescriptor(object); |
| 74 | addEntityNamePropertyDescriptor(object); |
| 75 | addPredecessor_AbstractActionPropertyDescriptor(object); |
| 76 | addSuccessor_AbstractActionPropertyDescriptor(object); |
| 77 | addCalledResourceDemandingInternalBehaviourPropertyDescriptor(object); |
| 78 | } |
| 79 | return itemPropertyDescriptors; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * This adds a property descriptor for the Id feature. |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | protected void addIdPropertyDescriptor(Object object) { |
| 89 | itemPropertyDescriptors.add |
| 90 | (createItemPropertyDescriptor |
| 91 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 92 | getResourceLocator(), |
| 93 | getString("_UI_Identifier_id_feature"), |
| 94 | getString("_UI_PropertyDescriptor_description", "_UI_Identifier_id_feature", "_UI_Identifier_type"), |
| 95 | IdentifierPackage.Literals.IDENTIFIER__ID, |
| 96 | true, |
| 97 | false, |
| 98 | false, |
| 99 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 100 | null, |
| 101 | null)); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * This adds a property descriptor for the Entity Name feature. |
| 106 | * <!-- begin-user-doc --> |
| 107 | * <!-- end-user-doc --> |
| 108 | * @generated |
| 109 | */ |
| 110 | protected void addEntityNamePropertyDescriptor(Object object) { |
| 111 | itemPropertyDescriptors.add |
| 112 | (createItemPropertyDescriptor |
| 113 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 114 | getResourceLocator(), |
| 115 | getString("_UI_NamedElement_entityName_feature"), |
| 116 | getString("_UI_PropertyDescriptor_description", "_UI_NamedElement_entityName_feature", "_UI_NamedElement_type"), |
| 117 | EntityPackage.Literals.NAMED_ELEMENT__ENTITY_NAME, |
| 118 | true, |
| 119 | false, |
| 120 | false, |
| 121 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
| 122 | null, |
| 123 | null)); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * This adds a property descriptor for the Predecessor Abstract Action feature. |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | protected void addPredecessor_AbstractActionPropertyDescriptor(Object object) { |
| 133 | itemPropertyDescriptors.add |
| 134 | (createItemPropertyDescriptor |
| 135 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 136 | getResourceLocator(), |
| 137 | getString("_UI_AbstractAction_predecessor_AbstractAction_feature"), |
| 138 | getString("_UI_PropertyDescriptor_description", "_UI_AbstractAction_predecessor_AbstractAction_feature", "_UI_AbstractAction_type"), |
| 139 | SeffPackage.Literals.ABSTRACT_ACTION__PREDECESSOR_ABSTRACT_ACTION, |
| 140 | true, |
| 141 | false, |
| 142 | true, |
| 143 | null, |
| 144 | null, |
| 145 | null)); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * This adds a property descriptor for the Successor Abstract Action feature. |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | protected void addSuccessor_AbstractActionPropertyDescriptor(Object object) { |
| 155 | itemPropertyDescriptors.add |
| 156 | (createItemPropertyDescriptor |
| 157 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 158 | getResourceLocator(), |
| 159 | getString("_UI_AbstractAction_successor_AbstractAction_feature"), |
| 160 | getString("_UI_PropertyDescriptor_description", "_UI_AbstractAction_successor_AbstractAction_feature", "_UI_AbstractAction_type"), |
| 161 | SeffPackage.Literals.ABSTRACT_ACTION__SUCCESSOR_ABSTRACT_ACTION, |
| 162 | true, |
| 163 | false, |
| 164 | true, |
| 165 | null, |
| 166 | null, |
| 167 | null)); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * This adds a property descriptor for the Called Resource Demanding Internal Behaviour feature. |
| 172 | * <!-- begin-user-doc --> |
| 173 | * <!-- end-user-doc --> |
| 174 | * @generated |
| 175 | */ |
| 176 | protected void addCalledResourceDemandingInternalBehaviourPropertyDescriptor(Object object) { |
| 177 | itemPropertyDescriptors.add |
| 178 | (createItemPropertyDescriptor |
| 179 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 180 | getResourceLocator(), |
| 181 | getString("_UI_InternalCallAction_calledResourceDemandingInternalBehaviour_feature"), |
| 182 | getString("_UI_PropertyDescriptor_description", "_UI_InternalCallAction_calledResourceDemandingInternalBehaviour_feature", "_UI_InternalCallAction_type"), |
| 183 | SeffPackage.Literals.INTERNAL_CALL_ACTION__CALLED_RESOURCE_DEMANDING_INTERNAL_BEHAVIOUR, |
| 184 | true, |
| 185 | false, |
| 186 | true, |
| 187 | null, |
| 188 | null, |
| 189 | null)); |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 194 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 195 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 196 | * <!-- begin-user-doc --> |
| 197 | * <!-- end-user-doc --> |
| 198 | * @generated |
| 199 | */ |
| 200 | @Override |
| 201 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 202 | if (childrenFeatures == null) { |
| 203 | super.getChildrenFeatures(object); |
| 204 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_DEMAND_ACTION); |
| 205 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__INFRASTRUCTURE_CALL_ACTION); |
| 206 | childrenFeatures.add(SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_CALL_ACTION); |
| 207 | } |
| 208 | return childrenFeatures; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * <!-- begin-user-doc --> |
| 213 | * <!-- end-user-doc --> |
| 214 | * @generated |
| 215 | */ |
| 216 | @Override |
| 217 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 218 | // Check the type of the specified child object and return the proper feature to use for |
| 219 | // adding (see {@link AddCommand}) it as a child. |
| 220 | |
| 221 | return super.getChildFeature(object, child); |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * This returns InternalCallAction.gif. |
| 226 | * <!-- begin-user-doc --> |
| 227 | * <!-- end-user-doc --> |
| 228 | * @generated |
| 229 | */ |
| 230 | @Override |
| 231 | public Object getImage(Object object) { |
| 232 | return overlayImage(object, getResourceLocator().getImage("full/obj16/InternalCallAction")); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * This returns the label text for the adapted class. |
| 237 | * <!-- begin-user-doc --> |
| 238 | * <!-- end-user-doc --> |
| 239 | * @generated |
| 240 | */ |
| 241 | @Override |
| 242 | public String getText(Object object) { |
| 243 | String label = ((InternalCallAction)object).getId(); |
| 244 | return label == null || label.length() == 0 ? |
| 245 | getString("_UI_InternalCallAction_type") : |
| 246 | getString("_UI_InternalCallAction_type") + " " + label; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 251 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 252 | * <!-- begin-user-doc --> |
| 253 | * <!-- end-user-doc --> |
| 254 | * @generated |
| 255 | */ |
| 256 | @Override |
| 257 | public void notifyChanged(Notification notification) { |
| 258 | updateChildren(notification); |
| 259 | |
| 260 | switch (notification.getFeatureID(InternalCallAction.class)) { |
| 261 | case SeffPackage.INTERNAL_CALL_ACTION__ID: |
| 262 | case SeffPackage.INTERNAL_CALL_ACTION__ENTITY_NAME: |
| 263 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
| 264 | return; |
| 265 | case SeffPackage.INTERNAL_CALL_ACTION__RESOURCE_DEMAND_ACTION: |
| 266 | case SeffPackage.INTERNAL_CALL_ACTION__INFRASTRUCTURE_CALL_ACTION: |
| 267 | case SeffPackage.INTERNAL_CALL_ACTION__RESOURCE_CALL_ACTION: |
| 268 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 269 | return; |
| 270 | } |
| 271 | super.notifyChanged(notification); |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 276 | * that can be created under this object. |
| 277 | * <!-- begin-user-doc --> |
| 278 | * <!-- end-user-doc --> |
| 279 | * @generated |
| 280 | */ |
| 281 | @Override |
| 282 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 283 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 284 | |
| 285 | newChildDescriptors.add |
| 286 | (createChildParameter |
| 287 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_DEMAND_ACTION, |
| 288 | Seff_performanceFactory.eINSTANCE.createParametricResourceDemand())); |
| 289 | |
| 290 | newChildDescriptors.add |
| 291 | (createChildParameter |
| 292 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__INFRASTRUCTURE_CALL_ACTION, |
| 293 | Seff_performanceFactory.eINSTANCE.createInfrastructureCall())); |
| 294 | |
| 295 | newChildDescriptors.add |
| 296 | (createChildParameter |
| 297 | (SeffPackage.Literals.ABSTRACT_INTERNAL_CONTROL_FLOW_ACTION__RESOURCE_CALL_ACTION, |
| 298 | Seff_performanceFactory.eINSTANCE.createResourceCall())); |
| 299 | } |
| 300 | |
| 301 | } |