1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.aggregatedUsageContext.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedResourceDemand; |
10 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextPackage; |
11 | |
12 | import de.uka.ipd.sdq.context.computed_usage.provider.ContextEditPlugin; |
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.edit.provider.ComposeableAdapterFactory; |
23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
25 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
30 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
31 | import org.eclipse.emf.edit.provider.ViewerNotification; |
32 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedResourceDemand} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class AggregatedResourceDemandItemProvider |
40 | extends ItemProviderAdapter |
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 2006, SDQ Group, University Karlsruhe (TH)"; |
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 AggregatedResourceDemandItemProvider(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 | addAggregatedResourceDemandPropertyDescriptor(object); |
76 | addResourceType_AggregatedResourceDemandPropertyDescriptor(object); |
77 | } |
78 | return itemPropertyDescriptors; |
79 | } |
80 | |
81 | /** |
82 | * This adds a property descriptor for the Aggregated Resource Demand feature. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | protected void addAggregatedResourceDemandPropertyDescriptor(Object object) { |
88 | itemPropertyDescriptors.add |
89 | (createItemPropertyDescriptor |
90 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
91 | getResourceLocator(), |
92 | getString("_UI_AggregatedResourceDemand_aggregatedResourceDemand_feature"), |
93 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedResourceDemand_aggregatedResourceDemand_feature", "_UI_AggregatedResourceDemand_type"), |
94 | AggregatedUsageContextPackage.Literals.AGGREGATED_RESOURCE_DEMAND__AGGREGATED_RESOURCE_DEMAND, |
95 | true, |
96 | false, |
97 | false, |
98 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
99 | null, |
100 | null)); |
101 | } |
102 | |
103 | /** |
104 | * This adds a property descriptor for the Resource Type Aggregated Resource Demand feature. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | protected void addResourceType_AggregatedResourceDemandPropertyDescriptor(Object object) { |
110 | itemPropertyDescriptors.add |
111 | (createItemPropertyDescriptor |
112 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
113 | getResourceLocator(), |
114 | getString("_UI_AggregatedResourceDemand_resourceType_AggregatedResourceDemand_feature"), |
115 | getString("_UI_PropertyDescriptor_description", "_UI_AggregatedResourceDemand_resourceType_AggregatedResourceDemand_feature", "_UI_AggregatedResourceDemand_type"), |
116 | AggregatedUsageContextPackage.Literals.AGGREGATED_RESOURCE_DEMAND__RESOURCE_TYPE_AGGREGATED_RESOURCE_DEMAND, |
117 | true, |
118 | false, |
119 | true, |
120 | null, |
121 | null, |
122 | null)); |
123 | } |
124 | |
125 | /** |
126 | * This returns AggregatedResourceDemand.gif. |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | @Override |
132 | public Object getImage(Object object) { |
133 | return overlayImage(object, getResourceLocator().getImage("full/obj16/AggregatedResourceDemand")); |
134 | } |
135 | |
136 | /** |
137 | * This returns the label text for the adapted class. |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | public String getText(Object object) { |
144 | AggregatedResourceDemand aggregatedResourceDemand = (AggregatedResourceDemand)object; |
145 | return getString("_UI_AggregatedResourceDemand_type") + " " + aggregatedResourceDemand.getAggregatedResourceDemand(); |
146 | } |
147 | |
148 | /** |
149 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
150 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @Override |
156 | public void notifyChanged(Notification notification) { |
157 | updateChildren(notification); |
158 | |
159 | switch (notification.getFeatureID(AggregatedResourceDemand.class)) { |
160 | case AggregatedUsageContextPackage.AGGREGATED_RESOURCE_DEMAND__AGGREGATED_RESOURCE_DEMAND: |
161 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
162 | return; |
163 | } |
164 | super.notifyChanged(notification); |
165 | } |
166 | |
167 | /** |
168 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
169 | * that can be created under this object. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
176 | super.collectNewChildDescriptors(newChildDescriptors, object); |
177 | } |
178 | |
179 | /** |
180 | * Return the resource locator for this item provider's resources. |
181 | * <!-- begin-user-doc --> |
182 | * <!-- end-user-doc --> |
183 | * @generated |
184 | */ |
185 | @Override |
186 | public ResourceLocator getResourceLocator() { |
187 | return ContextEditPlugin.INSTANCE; |
188 | } |
189 | |
190 | } |