1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.cost.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.cost.VariableLinkingResourceCost; |
11 | import de.uka.ipd.sdq.pcm.cost.costPackage; |
12 | |
13 | import java.util.Collection; |
14 | import java.util.List; |
15 | |
16 | import org.eclipse.emf.common.notify.AdapterFactory; |
17 | import org.eclipse.emf.common.notify.Notification; |
18 | |
19 | import org.eclipse.emf.common.util.ResourceLocator; |
20 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
21 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
22 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
23 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
24 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
25 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
26 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
27 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
28 | import org.eclipse.emf.edit.provider.ViewerNotification; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.cost.VariableLinkingResourceCost} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class VariableLinkingResourceCostItemProvider |
37 | extends VariableCostItemProvider |
38 | implements |
39 | IEditingDomainItemProvider, |
40 | IStructuredItemContentProvider, |
41 | ITreeItemContentProvider, |
42 | IItemLabelProvider, |
43 | IItemPropertySource { |
44 | /** |
45 | * This constructs an instance from a factory and a notifier. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public VariableLinkingResourceCostItemProvider(AdapterFactory adapterFactory) { |
51 | super(adapterFactory); |
52 | } |
53 | |
54 | /** |
55 | * This returns the property descriptors for the adapted class. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | @Override |
61 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
62 | if (itemPropertyDescriptors == null) { |
63 | super.getPropertyDescriptors(object); |
64 | |
65 | addLinkingresourcePropertyDescriptor(object); |
66 | addBandwithInitialFactorPropertyDescriptor(object); |
67 | addBandwidthOperatingFactorPropertyDescriptor(object); |
68 | } |
69 | return itemPropertyDescriptors; |
70 | } |
71 | |
72 | /** |
73 | * This adds a property descriptor for the Bandwith Initial Factor feature. |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @generated |
77 | */ |
78 | protected void addBandwithInitialFactorPropertyDescriptor(Object object) { |
79 | itemPropertyDescriptors.add |
80 | (createItemPropertyDescriptor |
81 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
82 | getResourceLocator(), |
83 | getString("_UI_VariableLinkingResourceCost_bandwithInitialFactor_feature"), |
84 | getString("_UI_PropertyDescriptor_description", "_UI_VariableLinkingResourceCost_bandwithInitialFactor_feature", "_UI_VariableLinkingResourceCost_type"), |
85 | costPackage.Literals.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR, |
86 | true, |
87 | false, |
88 | false, |
89 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
90 | null, |
91 | null)); |
92 | } |
93 | |
94 | /** |
95 | * This adds a property descriptor for the Bandwidth Operating Factor feature. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | protected void addBandwidthOperatingFactorPropertyDescriptor(Object object) { |
101 | itemPropertyDescriptors.add |
102 | (createItemPropertyDescriptor |
103 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
104 | getResourceLocator(), |
105 | getString("_UI_VariableLinkingResourceCost_bandwidthOperatingFactor_feature"), |
106 | getString("_UI_PropertyDescriptor_description", "_UI_VariableLinkingResourceCost_bandwidthOperatingFactor_feature", "_UI_VariableLinkingResourceCost_type"), |
107 | costPackage.Literals.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR, |
108 | true, |
109 | false, |
110 | false, |
111 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
112 | null, |
113 | null)); |
114 | } |
115 | |
116 | /** |
117 | * This adds a property descriptor for the Linkingresource feature. |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | protected void addLinkingresourcePropertyDescriptor(Object object) { |
123 | itemPropertyDescriptors.add |
124 | (createItemPropertyDescriptor |
125 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
126 | getResourceLocator(), |
127 | getString("_UI_LinkingResourceCost_linkingresource_feature"), |
128 | getString("_UI_PropertyDescriptor_description", "_UI_LinkingResourceCost_linkingresource_feature", "_UI_LinkingResourceCost_type"), |
129 | costPackage.Literals.LINKING_RESOURCE_COST__LINKINGRESOURCE, |
130 | true, |
131 | false, |
132 | true, |
133 | null, |
134 | null, |
135 | null)); |
136 | } |
137 | |
138 | /** |
139 | * This returns VariableLinkingResourceCost.gif. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public Object getImage(Object object) { |
146 | return overlayImage(object, getResourceLocator().getImage("full/obj16/VariableLinkingResourceCost")); |
147 | } |
148 | |
149 | /** |
150 | * This returns the label text for the adapted class. |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @Override |
156 | public String getText(Object object) { |
157 | VariableLinkingResourceCost variableLinkingResourceCost = (VariableLinkingResourceCost)object; |
158 | return getString("_UI_VariableLinkingResourceCost_type") + " " + variableLinkingResourceCost.getInitialCost(); |
159 | } |
160 | |
161 | /** |
162 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
163 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | @Override |
169 | public void notifyChanged(Notification notification) { |
170 | updateChildren(notification); |
171 | |
172 | switch (notification.getFeatureID(VariableLinkingResourceCost.class)) { |
173 | case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWITH_INITIAL_FACTOR: |
174 | case costPackage.VARIABLE_LINKING_RESOURCE_COST__BANDWIDTH_OPERATING_FACTOR: |
175 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
176 | return; |
177 | } |
178 | super.notifyChanged(notification); |
179 | } |
180 | |
181 | /** |
182 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
183 | * that can be created under this object. |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | @Override |
189 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
190 | super.collectNewChildDescriptors(newChildDescriptors, object); |
191 | } |
192 | |
193 | } |