| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.seff.seff_reliability.provider; |
| 7 | |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.seff.SeffFactory; |
| 10 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 11 | |
| 12 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour; |
| 13 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityFactory; |
| 14 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.Seff_reliabilityPackage; |
| 15 | |
| 16 | import java.util.Collection; |
| 17 | import java.util.List; |
| 18 | |
| 19 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 20 | import org.eclipse.emf.common.notify.Notification; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 23 | |
| 24 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| 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.ViewerNotification; |
| 32 | |
| 33 | /** |
| 34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.seff.seff_reliability.RecoveryActionBehaviour} object. |
| 35 | * <!-- begin-user-doc --> |
| 36 | * <!-- end-user-doc --> |
| 37 | * @generated |
| 38 | */ |
| 39 | public class RecoveryActionBehaviourItemProvider |
| 40 | extends FailureHandlingEntityItemProvider |
| 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 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 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 RecoveryActionBehaviourItemProvider(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 | addFailureHandlingAlternatives__RecoveryActionBehaviourPropertyDescriptor(object); |
| 76 | } |
| 77 | return itemPropertyDescriptors; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * This adds a property descriptor for the Failure Handling Alternatives Recovery Action Behaviour feature. |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | protected void addFailureHandlingAlternatives__RecoveryActionBehaviourPropertyDescriptor(Object object) { |
| 87 | itemPropertyDescriptors.add |
| 88 | (createItemPropertyDescriptor |
| 89 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 90 | getResourceLocator(), |
| 91 | getString("_UI_RecoveryActionBehaviour_failureHandlingAlternatives__RecoveryActionBehaviour_feature"), |
| 92 | getString("_UI_PropertyDescriptor_description", "_UI_RecoveryActionBehaviour_failureHandlingAlternatives__RecoveryActionBehaviour_feature", "_UI_RecoveryActionBehaviour_type"), |
| 93 | Seff_reliabilityPackage.Literals.RECOVERY_ACTION_BEHAVIOUR__FAILURE_HANDLING_ALTERNATIVES_RECOVERY_ACTION_BEHAVIOUR, |
| 94 | true, |
| 95 | false, |
| 96 | true, |
| 97 | null, |
| 98 | null, |
| 99 | null)); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 104 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 105 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 106 | * <!-- begin-user-doc --> |
| 107 | * <!-- end-user-doc --> |
| 108 | * @generated |
| 109 | */ |
| 110 | @Override |
| 111 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 112 | if (childrenFeatures == null) { |
| 113 | super.getChildrenFeatures(object); |
| 114 | childrenFeatures.add(SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR); |
| 115 | } |
| 116 | return childrenFeatures; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * <!-- begin-user-doc --> |
| 121 | * <!-- end-user-doc --> |
| 122 | * @generated |
| 123 | */ |
| 124 | @Override |
| 125 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 126 | // Check the type of the specified child object and return the proper feature to use for |
| 127 | // adding (see {@link AddCommand}) it as a child. |
| 128 | |
| 129 | return super.getChildFeature(object, child); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * This returns RecoveryActionBehaviour.gif. |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | @Override |
| 139 | public Object getImage(Object object) { |
| 140 | return overlayImage(object, getResourceLocator().getImage("full/obj16/RecoveryActionBehaviour")); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * This returns the label text for the adapted class. |
| 145 | * <!-- begin-user-doc --> |
| 146 | * <!-- end-user-doc --> |
| 147 | * @generated |
| 148 | */ |
| 149 | @Override |
| 150 | public String getText(Object object) { |
| 151 | String label = ((RecoveryActionBehaviour)object).getId(); |
| 152 | return label == null || label.length() == 0 ? |
| 153 | getString("_UI_RecoveryActionBehaviour_type") : |
| 154 | getString("_UI_RecoveryActionBehaviour_type") + " " + label; |
| 155 | } |
| 156 | |
| 157 | /** |
| 158 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 159 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | @Override |
| 165 | public void notifyChanged(Notification notification) { |
| 166 | updateChildren(notification); |
| 167 | |
| 168 | switch (notification.getFeatureID(RecoveryActionBehaviour.class)) { |
| 169 | case Seff_reliabilityPackage.RECOVERY_ACTION_BEHAVIOUR__STEPS_BEHAVIOUR: |
| 170 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 171 | return; |
| 172 | } |
| 173 | super.notifyChanged(notification); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 178 | * that can be created under this object. |
| 179 | * <!-- begin-user-doc --> |
| 180 | * <!-- end-user-doc --> |
| 181 | * @generated |
| 182 | */ |
| 183 | @Override |
| 184 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 185 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 186 | |
| 187 | newChildDescriptors.add |
| 188 | (createChildParameter |
| 189 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 190 | Seff_reliabilityFactory.eINSTANCE.createRecoveryAction())); |
| 191 | |
| 192 | newChildDescriptors.add |
| 193 | (createChildParameter |
| 194 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 195 | SeffFactory.eINSTANCE.createStopAction())); |
| 196 | |
| 197 | newChildDescriptors.add |
| 198 | (createChildParameter |
| 199 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 200 | SeffFactory.eINSTANCE.createBranchAction())); |
| 201 | |
| 202 | newChildDescriptors.add |
| 203 | (createChildParameter |
| 204 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 205 | SeffFactory.eINSTANCE.createStartAction())); |
| 206 | |
| 207 | newChildDescriptors.add |
| 208 | (createChildParameter |
| 209 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 210 | SeffFactory.eINSTANCE.createReleaseAction())); |
| 211 | |
| 212 | newChildDescriptors.add |
| 213 | (createChildParameter |
| 214 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 215 | SeffFactory.eINSTANCE.createLoopAction())); |
| 216 | |
| 217 | newChildDescriptors.add |
| 218 | (createChildParameter |
| 219 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 220 | SeffFactory.eINSTANCE.createForkAction())); |
| 221 | |
| 222 | newChildDescriptors.add |
| 223 | (createChildParameter |
| 224 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 225 | SeffFactory.eINSTANCE.createExternalCallAction())); |
| 226 | |
| 227 | newChildDescriptors.add |
| 228 | (createChildParameter |
| 229 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 230 | SeffFactory.eINSTANCE.createAcquireAction())); |
| 231 | |
| 232 | newChildDescriptors.add |
| 233 | (createChildParameter |
| 234 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 235 | SeffFactory.eINSTANCE.createCollectionIteratorAction())); |
| 236 | |
| 237 | newChildDescriptors.add |
| 238 | (createChildParameter |
| 239 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 240 | SeffFactory.eINSTANCE.createSetVariableAction())); |
| 241 | |
| 242 | newChildDescriptors.add |
| 243 | (createChildParameter |
| 244 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 245 | SeffFactory.eINSTANCE.createInternalCallAction())); |
| 246 | |
| 247 | newChildDescriptors.add |
| 248 | (createChildParameter |
| 249 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 250 | SeffFactory.eINSTANCE.createEmitEventAction())); |
| 251 | |
| 252 | newChildDescriptors.add |
| 253 | (createChildParameter |
| 254 | (SeffPackage.Literals.RESOURCE_DEMANDING_BEHAVIOUR__STEPS_BEHAVIOUR, |
| 255 | SeffFactory.eINSTANCE.createInternalAction())); |
| 256 | } |
| 257 | |
| 258 | } |