| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.qosannotations.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.common.util.ResourceLocator; |
| 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.ItemProviderAdapter; |
| 24 | import org.eclipse.emf.edit.provider.ViewerNotification; |
| 25 | |
| 26 | import de.uka.ipd.sdq.pcm.core.provider.PalladioComponentModelEditPlugin; |
| 27 | import de.uka.ipd.sdq.pcm.parameter.ParameterFactory; |
| 28 | import de.uka.ipd.sdq.pcm.qosannotations.QosannotationsPackage; |
| 29 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedOutputParameterAbstraction; |
| 30 | |
| 31 | /** |
| 32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.qosannotations.SpecifiedOutputParameterAbstraction} object. |
| 33 | * <!-- begin-user-doc --> |
| 34 | * <!-- end-user-doc --> |
| 35 | * @generated |
| 36 | */ |
| 37 | public class SpecifiedOutputParameterAbstractionItemProvider |
| 38 | extends ItemProviderAdapter |
| 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 SpecifiedOutputParameterAbstractionItemProvider(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 | addSignature_SpecifiedOutputParameterAbstractionPropertyDescriptor(object); |
| 74 | addRole_SpecifiedOutputParameterAbstractionPropertyDescriptor(object); |
| 75 | } |
| 76 | return itemPropertyDescriptors; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * This adds a property descriptor for the Signature Specified Output Parameter Abstraction feature. |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | protected void addSignature_SpecifiedOutputParameterAbstractionPropertyDescriptor(Object object) { |
| 86 | itemPropertyDescriptors.add |
| 87 | (createItemPropertyDescriptor |
| 88 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 89 | getResourceLocator(), |
| 90 | getString("_UI_SpecifiedOutputParameterAbstraction_signature_SpecifiedOutputParameterAbstraction_feature"), |
| 91 | getString("_UI_PropertyDescriptor_description", "_UI_SpecifiedOutputParameterAbstraction_signature_SpecifiedOutputParameterAbstraction_feature", "_UI_SpecifiedOutputParameterAbstraction_type"), |
| 92 | QosannotationsPackage.Literals.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__SIGNATURE_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION, |
| 93 | true, |
| 94 | false, |
| 95 | true, |
| 96 | null, |
| 97 | null, |
| 98 | null)); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * This adds a property descriptor for the Role Specified Output Parameter Abstraction feature. |
| 103 | * <!-- begin-user-doc --> |
| 104 | * <!-- end-user-doc --> |
| 105 | * @generated |
| 106 | */ |
| 107 | protected void addRole_SpecifiedOutputParameterAbstractionPropertyDescriptor(Object object) { |
| 108 | itemPropertyDescriptors.add |
| 109 | (createItemPropertyDescriptor |
| 110 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
| 111 | getResourceLocator(), |
| 112 | getString("_UI_SpecifiedOutputParameterAbstraction_role_SpecifiedOutputParameterAbstraction_feature"), |
| 113 | getString("_UI_PropertyDescriptor_description", "_UI_SpecifiedOutputParameterAbstraction_role_SpecifiedOutputParameterAbstraction_feature", "_UI_SpecifiedOutputParameterAbstraction_type"), |
| 114 | QosannotationsPackage.Literals.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__ROLE_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION, |
| 115 | true, |
| 116 | false, |
| 117 | true, |
| 118 | null, |
| 119 | null, |
| 120 | null)); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
| 125 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
| 126 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
| 127 | * <!-- begin-user-doc --> |
| 128 | * <!-- end-user-doc --> |
| 129 | * @generated |
| 130 | */ |
| 131 | @Override |
| 132 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
| 133 | if (childrenFeatures == null) { |
| 134 | super.getChildrenFeatures(object); |
| 135 | childrenFeatures.add(QosannotationsPackage.Literals.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__EXPECTED_EXTERNAL_OUTPUTS_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION); |
| 136 | } |
| 137 | return childrenFeatures; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | @Override |
| 146 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
| 147 | // Check the type of the specified child object and return the proper feature to use for |
| 148 | // adding (see {@link AddCommand}) it as a child. |
| 149 | |
| 150 | return super.getChildFeature(object, child); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * This returns the label text for the adapted class. |
| 155 | * <!-- begin-user-doc --> |
| 156 | * <!-- end-user-doc --> |
| 157 | * @generated |
| 158 | */ |
| 159 | @Override |
| 160 | public String getText(Object object) { |
| 161 | return getString("_UI_SpecifiedOutputParameterAbstraction_type"); |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
| 166 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
| 167 | * <!-- begin-user-doc --> |
| 168 | * <!-- end-user-doc --> |
| 169 | * @generated |
| 170 | */ |
| 171 | @Override |
| 172 | public void notifyChanged(Notification notification) { |
| 173 | updateChildren(notification); |
| 174 | |
| 175 | switch (notification.getFeatureID(SpecifiedOutputParameterAbstraction.class)) { |
| 176 | case QosannotationsPackage.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__EXPECTED_EXTERNAL_OUTPUTS_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION: |
| 177 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
| 178 | return; |
| 179 | } |
| 180 | super.notifyChanged(notification); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
| 185 | * that can be created under this object. |
| 186 | * <!-- begin-user-doc --> |
| 187 | * <!-- end-user-doc --> |
| 188 | * @generated |
| 189 | */ |
| 190 | @Override |
| 191 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
| 192 | super.collectNewChildDescriptors(newChildDescriptors, object); |
| 193 | |
| 194 | newChildDescriptors.add |
| 195 | (createChildParameter |
| 196 | (QosannotationsPackage.Literals.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__EXPECTED_EXTERNAL_OUTPUTS_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION, |
| 197 | ParameterFactory.eINSTANCE.createVariableUsage())); |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Return the resource locator for this item provider's resources. |
| 202 | * <!-- begin-user-doc --> |
| 203 | * <!-- end-user-doc --> |
| 204 | * @generated |
| 205 | */ |
| 206 | @Override |
| 207 | public ResourceLocator getResourceLocator() { |
| 208 | return PalladioComponentModelEditPlugin.INSTANCE; |
| 209 | } |
| 210 | |
| 211 | } |