1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.QualityProperties.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.designdecision.QualityProperties.NumericQualityProperty; |
11 | import de.uka.ipd.sdq.pcm.designdecision.QualityProperties.QualityPropertiesPackage; |
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 | |
27 | /** |
28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.designdecision.QualityProperties.NumericQualityProperty} object. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public class NumericQualityPropertyItemProvider |
34 | extends QualityPropertyItemProvider |
35 | implements |
36 | IEditingDomainItemProvider, |
37 | IStructuredItemContentProvider, |
38 | ITreeItemContentProvider, |
39 | IItemLabelProvider, |
40 | IItemPropertySource { |
41 | /** |
42 | * This constructs an instance from a factory and a notifier. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | public NumericQualityPropertyItemProvider(AdapterFactory adapterFactory) { |
48 | super(adapterFactory); |
49 | } |
50 | |
51 | /** |
52 | * This returns the property descriptors for the adapted class. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | @Override |
58 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
59 | if (itemPropertyDescriptors == null) { |
60 | super.getPropertyDescriptors(object); |
61 | |
62 | addResultDecoratorRepositoryPropertyDescriptor(object); |
63 | addConfidenceIntervalPropertyDescriptor(object); |
64 | } |
65 | return itemPropertyDescriptors; |
66 | } |
67 | |
68 | /** |
69 | * This adds a property descriptor for the Result Decorator Repository feature. |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | protected void addResultDecoratorRepositoryPropertyDescriptor(Object object) { |
75 | itemPropertyDescriptors.add |
76 | (createItemPropertyDescriptor |
77 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
78 | getResourceLocator(), |
79 | getString("_UI_NumericQualityProperty_resultDecoratorRepository_feature"), |
80 | getString("_UI_PropertyDescriptor_description", "_UI_NumericQualityProperty_resultDecoratorRepository_feature", "_UI_NumericQualityProperty_type"), |
81 | QualityPropertiesPackage.Literals.NUMERIC_QUALITY_PROPERTY__RESULT_DECORATOR_REPOSITORY, |
82 | true, |
83 | false, |
84 | true, |
85 | null, |
86 | null, |
87 | null)); |
88 | } |
89 | |
90 | /** |
91 | * This adds a property descriptor for the Confidence Interval feature. |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | protected void addConfidenceIntervalPropertyDescriptor(Object object) { |
97 | itemPropertyDescriptors.add |
98 | (createItemPropertyDescriptor |
99 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
100 | getResourceLocator(), |
101 | getString("_UI_NumericQualityProperty_confidenceInterval_feature"), |
102 | getString("_UI_PropertyDescriptor_description", "_UI_NumericQualityProperty_confidenceInterval_feature", "_UI_NumericQualityProperty_type"), |
103 | QualityPropertiesPackage.Literals.NUMERIC_QUALITY_PROPERTY__CONFIDENCE_INTERVAL, |
104 | true, |
105 | false, |
106 | true, |
107 | null, |
108 | null, |
109 | null)); |
110 | } |
111 | |
112 | /** |
113 | * This returns the label text for the adapted class. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | public String getText(Object object) { |
120 | Object labelValue = ((NumericQualityProperty)object).getQualityValue(); |
121 | String label = labelValue == null ? null : labelValue.toString(); |
122 | return label == null || label.length() == 0 ? |
123 | getString("_UI_NumericQualityProperty_type") : |
124 | getString("_UI_NumericQualityProperty_type") + " " + label; |
125 | } |
126 | |
127 | /** |
128 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
129 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | @Override |
135 | public void notifyChanged(Notification notification) { |
136 | updateChildren(notification); |
137 | super.notifyChanged(notification); |
138 | } |
139 | |
140 | /** |
141 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
142 | * that can be created under this object. |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | @Override |
148 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
149 | super.collectNewChildDescriptors(newChildDescriptors, object); |
150 | } |
151 | |
152 | } |