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.FixedProcessingResourceCost; |
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.FixedProcessingResourceCost} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class FixedProcessingResourceCostItemProvider |
37 | extends ProcessingResourceCostItemProvider |
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 FixedProcessingResourceCostItemProvider(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 | addFixedOperatingCostPropertyDescriptor(object); |
66 | addFixedInitialCostPropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Fixed Operating Cost feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addFixedOperatingCostPropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_FixedProcessingResourceCost_fixedOperatingCost_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_FixedProcessingResourceCost_fixedOperatingCost_feature", "_UI_FixedProcessingResourceCost_type"), |
84 | costPackage.Literals.FIXED_PROCESSING_RESOURCE_COST__FIXED_OPERATING_COST, |
85 | true, |
86 | false, |
87 | false, |
88 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This adds a property descriptor for the Fixed Initial Cost feature. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | protected void addFixedInitialCostPropertyDescriptor(Object object) { |
100 | itemPropertyDescriptors.add |
101 | (createItemPropertyDescriptor |
102 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
103 | getResourceLocator(), |
104 | getString("_UI_FixedProcessingResourceCost_fixedInitialCost_feature"), |
105 | getString("_UI_PropertyDescriptor_description", "_UI_FixedProcessingResourceCost_fixedInitialCost_feature", "_UI_FixedProcessingResourceCost_type"), |
106 | costPackage.Literals.FIXED_PROCESSING_RESOURCE_COST__FIXED_INITIAL_COST, |
107 | true, |
108 | false, |
109 | false, |
110 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
111 | null, |
112 | null)); |
113 | } |
114 | |
115 | /** |
116 | * This returns FixedProcessingResourceCost.gif. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public Object getImage(Object object) { |
123 | return overlayImage(object, getResourceLocator().getImage("full/obj16/FixedProcessingResourceCost")); |
124 | } |
125 | |
126 | /** |
127 | * This returns the label text for the adapted class. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | @Override |
133 | public String getText(Object object) { |
134 | FixedProcessingResourceCost fixedProcessingResourceCost = (FixedProcessingResourceCost)object; |
135 | return getString("_UI_FixedProcessingResourceCost_type") + " " + fixedProcessingResourceCost.getInitialCost(); |
136 | } |
137 | |
138 | /** |
139 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
140 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
141 | * <!-- begin-user-doc --> |
142 | * <!-- end-user-doc --> |
143 | * @generated |
144 | */ |
145 | @Override |
146 | public void notifyChanged(Notification notification) { |
147 | updateChildren(notification); |
148 | |
149 | switch (notification.getFeatureID(FixedProcessingResourceCost.class)) { |
150 | case costPackage.FIXED_PROCESSING_RESOURCE_COST__FIXED_OPERATING_COST: |
151 | case costPackage.FIXED_PROCESSING_RESOURCE_COST__FIXED_INITIAL_COST: |
152 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
153 | return; |
154 | } |
155 | super.notifyChanged(notification); |
156 | } |
157 | |
158 | /** |
159 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
160 | * that can be created under this object. |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | @Override |
166 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
167 | super.collectNewChildDescriptors(newChildDescriptors, object); |
168 | } |
169 | |
170 | } |