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.ComponentCost; |
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.edit.provider.ComposeableAdapterFactory; |
20 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
21 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
22 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
24 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
25 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
26 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.ViewerNotification; |
28 | |
29 | /** |
30 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.cost.ComponentCost} object. |
31 | * <!-- begin-user-doc --> |
32 | * <!-- end-user-doc --> |
33 | * @generated |
34 | */ |
35 | public class ComponentCostItemProvider |
36 | extends CostItemProvider |
37 | implements |
38 | IEditingDomainItemProvider, |
39 | IStructuredItemContentProvider, |
40 | ITreeItemContentProvider, |
41 | IItemLabelProvider, |
42 | IItemPropertySource { |
43 | /** |
44 | * This constructs an instance from a factory and a notifier. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public ComponentCostItemProvider(AdapterFactory adapterFactory) { |
50 | super(adapterFactory); |
51 | } |
52 | |
53 | /** |
54 | * This returns the property descriptors for the adapted class. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | @Override |
60 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
61 | if (itemPropertyDescriptors == null) { |
62 | super.getPropertyDescriptors(object); |
63 | |
64 | addComponentOperatingCostPropertyDescriptor(object); |
65 | addComponentInitialCostPropertyDescriptor(object); |
66 | addRepositoryComponentPropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Component Operating Cost feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addComponentOperatingCostPropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_ComponentCost_componentOperatingCost_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentCost_componentOperatingCost_feature", "_UI_ComponentCost_type"), |
84 | costPackage.Literals.COMPONENT_COST__COMPONENT_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 Component Initial Cost feature. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | protected void addComponentInitialCostPropertyDescriptor(Object object) { |
100 | itemPropertyDescriptors.add |
101 | (createItemPropertyDescriptor |
102 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
103 | getResourceLocator(), |
104 | getString("_UI_ComponentCost_componentInitialCost_feature"), |
105 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentCost_componentInitialCost_feature", "_UI_ComponentCost_type"), |
106 | costPackage.Literals.COMPONENT_COST__COMPONENT_INITIAL_COST, |
107 | true, |
108 | false, |
109 | false, |
110 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
111 | null, |
112 | null)); |
113 | } |
114 | |
115 | /** |
116 | * This adds a property descriptor for the Repository Component feature. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | protected void addRepositoryComponentPropertyDescriptor(Object object) { |
122 | itemPropertyDescriptors.add |
123 | (createItemPropertyDescriptor |
124 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
125 | getResourceLocator(), |
126 | getString("_UI_ComponentCost_repositoryComponent_feature"), |
127 | getString("_UI_PropertyDescriptor_description", "_UI_ComponentCost_repositoryComponent_feature", "_UI_ComponentCost_type"), |
128 | costPackage.Literals.COMPONENT_COST__REPOSITORY_COMPONENT, |
129 | true, |
130 | false, |
131 | true, |
132 | null, |
133 | null, |
134 | null)); |
135 | } |
136 | |
137 | /** |
138 | * This returns ComponentCost.gif. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public Object getImage(Object object) { |
145 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ComponentCost")); |
146 | } |
147 | |
148 | /** |
149 | * This returns the label text for the adapted class. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | public String getText(Object object) { |
156 | ComponentCost componentCost = (ComponentCost)object; |
157 | return getString("_UI_ComponentCost_type") + " " + componentCost.getOperatingCost(); |
158 | } |
159 | |
160 | /** |
161 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
162 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public void notifyChanged(Notification notification) { |
169 | updateChildren(notification); |
170 | |
171 | switch (notification.getFeatureID(ComponentCost.class)) { |
172 | case costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST: |
173 | case costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST: |
174 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
175 | return; |
176 | } |
177 | super.notifyChanged(notification); |
178 | } |
179 | |
180 | /** |
181 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
182 | * that can be created under this object. |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | @Override |
188 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
189 | super.collectNewChildDescriptors(newChildDescriptors, object); |
190 | } |
191 | |
192 | } |