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