1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
10 | import de.uka.ipd.sdq.context.computed_usage.ExternalCallOutput; |
11 | |
12 | import de.uka.ipd.sdq.pcm.parameter.ParameterFactory; |
13 | |
14 | import java.util.Collection; |
15 | import java.util.List; |
16 | |
17 | import org.eclipse.emf.common.notify.AdapterFactory; |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | |
20 | import org.eclipse.emf.common.util.ResourceLocator; |
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.ItemProviderAdapter; |
32 | import org.eclipse.emf.edit.provider.ViewerNotification; |
33 | |
34 | /** |
35 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.computed_usage.ExternalCallOutput} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class ExternalCallOutputItemProvider |
41 | extends ItemProviderAdapter |
42 | implements |
43 | IEditingDomainItemProvider, |
44 | IStructuredItemContentProvider, |
45 | ITreeItemContentProvider, |
46 | IItemLabelProvider, |
47 | IItemPropertySource { |
48 | /** |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
54 | |
55 | /** |
56 | * This constructs an instance from a factory and a notifier. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | public ExternalCallOutputItemProvider(AdapterFactory adapterFactory) { |
62 | super(adapterFactory); |
63 | } |
64 | |
65 | /** |
66 | * This returns the property descriptors for the adapted class. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | @Override |
72 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
73 | if (itemPropertyDescriptors == null) { |
74 | super.getPropertyDescriptors(object); |
75 | |
76 | addExternalCallAction_ExternalCallOutputPropertyDescriptor(object); |
77 | } |
78 | return itemPropertyDescriptors; |
79 | } |
80 | |
81 | /** |
82 | * This adds a property descriptor for the External Call Action External Call Output feature. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | protected void addExternalCallAction_ExternalCallOutputPropertyDescriptor(Object object) { |
88 | itemPropertyDescriptors.add |
89 | (createItemPropertyDescriptor |
90 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
91 | getResourceLocator(), |
92 | getString("_UI_ExternalCallOutput_externalCallAction_ExternalCallOutput_feature"), |
93 | getString("_UI_PropertyDescriptor_description", "_UI_ExternalCallOutput_externalCallAction_ExternalCallOutput_feature", "_UI_ExternalCallOutput_type"), |
94 | ComputedUsagePackage.Literals.EXTERNAL_CALL_OUTPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_OUTPUT, |
95 | true, |
96 | false, |
97 | true, |
98 | null, |
99 | null, |
100 | null)); |
101 | } |
102 | |
103 | /** |
104 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
105 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
106 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
107 | * <!-- begin-user-doc --> |
108 | * <!-- end-user-doc --> |
109 | * @generated |
110 | */ |
111 | @Override |
112 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
113 | if (childrenFeatures == null) { |
114 | super.getChildrenFeatures(object); |
115 | childrenFeatures.add(ComputedUsagePackage.Literals.EXTERNAL_CALL_OUTPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_OUTPUT); |
116 | } |
117 | return childrenFeatures; |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
127 | // Check the type of the specified child object and return the proper feature to use for |
128 | // adding (see {@link AddCommand}) it as a child. |
129 | |
130 | return super.getChildFeature(object, child); |
131 | } |
132 | |
133 | /** |
134 | * This returns ExternalCallOutput.gif. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public Object getImage(Object object) { |
141 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ExternalCallOutput")); |
142 | } |
143 | |
144 | /** |
145 | * This returns the label text for the adapted class. |
146 | * <!-- begin-user-doc --> |
147 | * <!-- end-user-doc --> |
148 | * @generated |
149 | */ |
150 | @Override |
151 | public String getText(Object object) { |
152 | return getString("_UI_ExternalCallOutput_type"); |
153 | } |
154 | |
155 | /** |
156 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
157 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | @Override |
163 | public void notifyChanged(Notification notification) { |
164 | updateChildren(notification); |
165 | |
166 | switch (notification.getFeatureID(ExternalCallOutput.class)) { |
167 | case ComputedUsagePackage.EXTERNAL_CALL_OUTPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_OUTPUT: |
168 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
169 | return; |
170 | } |
171 | super.notifyChanged(notification); |
172 | } |
173 | |
174 | /** |
175 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
176 | * that can be created under this object. |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | @Override |
182 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
183 | super.collectNewChildDescriptors(newChildDescriptors, object); |
184 | |
185 | newChildDescriptors.add |
186 | (createChildParameter |
187 | (ComputedUsagePackage.Literals.EXTERNAL_CALL_OUTPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_OUTPUT, |
188 | ParameterFactory.eINSTANCE.createVariableUsage())); |
189 | } |
190 | |
191 | /** |
192 | * Return the resource locator for this item provider's resources. |
193 | * <!-- begin-user-doc --> |
194 | * <!-- end-user-doc --> |
195 | * @generated |
196 | */ |
197 | @Override |
198 | public ResourceLocator getResourceLocator() { |
199 | return ContextEditPlugin.INSTANCE; |
200 | } |
201 | |
202 | } |