1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.provider; |
8 | |
9 | |
10 | import java.util.Collection; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.common.notify.AdapterFactory; |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.common.util.ResourceLocator; |
16 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
17 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
18 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
19 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
20 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
21 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
23 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
24 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
25 | import org.eclipse.emf.edit.provider.ViewerNotification; |
26 | |
27 | import de.uka.ipd.sdq.featuremodel.IntervalRange; |
28 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.featuremodel.IntervalRange} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class IntervalRangeItemProvider |
37 | extends ItemProviderAdapter |
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 IntervalRangeItemProvider(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 | addLowerBoundIncludedPropertyDescriptor(object); |
66 | addUpperBoundIncludedPropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Lower Bound Included feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addLowerBoundIncludedPropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_IntervalRange_lowerBoundIncluded_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_IntervalRange_lowerBoundIncluded_feature", "_UI_IntervalRange_type"), |
84 | featuremodelPackage.Literals.INTERVAL_RANGE__LOWER_BOUND_INCLUDED, |
85 | true, |
86 | false, |
87 | false, |
88 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This adds a property descriptor for the Upper Bound Included feature. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | protected void addUpperBoundIncludedPropertyDescriptor(Object object) { |
100 | itemPropertyDescriptors.add |
101 | (createItemPropertyDescriptor |
102 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
103 | getResourceLocator(), |
104 | getString("_UI_IntervalRange_upperBoundIncluded_feature"), |
105 | getString("_UI_PropertyDescriptor_description", "_UI_IntervalRange_upperBoundIncluded_feature", "_UI_IntervalRange_type"), |
106 | featuremodelPackage.Literals.INTERVAL_RANGE__UPPER_BOUND_INCLUDED, |
107 | true, |
108 | false, |
109 | false, |
110 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
111 | null, |
112 | null)); |
113 | } |
114 | |
115 | /** |
116 | * This returns the label text for the adapted class. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public String getText(Object object) { |
123 | IntervalRange intervalRange = (IntervalRange)object; |
124 | return getString("_UI_IntervalRange_type") + " " + intervalRange.isLowerBoundIncluded(); |
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 | |
138 | switch (notification.getFeatureID(IntervalRange.class)) { |
139 | case featuremodelPackage.INTERVAL_RANGE__LOWER_BOUND_INCLUDED: |
140 | case featuremodelPackage.INTERVAL_RANGE__UPPER_BOUND_INCLUDED: |
141 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
142 | return; |
143 | } |
144 | super.notifyChanged(notification); |
145 | } |
146 | |
147 | /** |
148 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
149 | * that can be created under this object. |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | @Override |
155 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
156 | super.collectNewChildDescriptors(newChildDescriptors, object); |
157 | } |
158 | |
159 | /** |
160 | * Return the resource locator for this item provider's resources. |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | @Override |
166 | public ResourceLocator getResourceLocator() { |
167 | return FeaturemodelEditPlugin.INSTANCE; |
168 | } |
169 | |
170 | } |