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