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.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.featuremodel.IntegerIntervalRange; |
26 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.featuremodel.IntegerIntervalRange} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class IntegerIntervalRangeItemProvider |
35 | extends IntervalRangeItemProvider |
36 | implements |
37 | IEditingDomainItemProvider, |
38 | IStructuredItemContentProvider, |
39 | ITreeItemContentProvider, |
40 | IItemLabelProvider, |
41 | IItemPropertySource { |
42 | /** |
43 | * This constructs an instance from a factory and a notifier. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public IntegerIntervalRangeItemProvider(AdapterFactory adapterFactory) { |
49 | super(adapterFactory); |
50 | } |
51 | |
52 | /** |
53 | * This returns the property descriptors for the adapted class. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | @Override |
59 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
60 | if (itemPropertyDescriptors == null) { |
61 | super.getPropertyDescriptors(object); |
62 | |
63 | addToPropertyDescriptor(object); |
64 | addFromPropertyDescriptor(object); |
65 | } |
66 | return itemPropertyDescriptors; |
67 | } |
68 | |
69 | /** |
70 | * This adds a property descriptor for the To feature. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | protected void addToPropertyDescriptor(Object object) { |
76 | itemPropertyDescriptors.add |
77 | (createItemPropertyDescriptor |
78 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
79 | getResourceLocator(), |
80 | getString("_UI_IntegerIntervalRange_to_feature"), |
81 | getString("_UI_PropertyDescriptor_description", "_UI_IntegerIntervalRange_to_feature", "_UI_IntegerIntervalRange_type"), |
82 | featuremodelPackage.Literals.INTEGER_INTERVAL_RANGE__TO, |
83 | true, |
84 | false, |
85 | false, |
86 | ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
87 | null, |
88 | null)); |
89 | } |
90 | |
91 | /** |
92 | * This adds a property descriptor for the From feature. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | protected void addFromPropertyDescriptor(Object object) { |
98 | itemPropertyDescriptors.add |
99 | (createItemPropertyDescriptor |
100 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
101 | getResourceLocator(), |
102 | getString("_UI_IntegerIntervalRange_from_feature"), |
103 | getString("_UI_PropertyDescriptor_description", "_UI_IntegerIntervalRange_from_feature", "_UI_IntegerIntervalRange_type"), |
104 | featuremodelPackage.Literals.INTEGER_INTERVAL_RANGE__FROM, |
105 | true, |
106 | false, |
107 | false, |
108 | ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, |
109 | null, |
110 | null)); |
111 | } |
112 | |
113 | /** |
114 | * This returns IntegerIntervalRange.gif. |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | public Object getImage(Object object) { |
121 | return overlayImage(object, getResourceLocator().getImage("full/obj16/IntegerIntervalRange")); |
122 | } |
123 | |
124 | /** |
125 | * This returns the label text for the adapted class. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | @Override |
131 | public String getText(Object object) { |
132 | IntegerIntervalRange integerIntervalRange = (IntegerIntervalRange)object; |
133 | return getString("_UI_IntegerIntervalRange_type") + " " + integerIntervalRange.isLowerBoundIncluded(); |
134 | } |
135 | |
136 | /** |
137 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
138 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public void notifyChanged(Notification notification) { |
145 | updateChildren(notification); |
146 | |
147 | switch (notification.getFeatureID(IntegerIntervalRange.class)) { |
148 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__TO: |
149 | case featuremodelPackage.INTEGER_INTERVAL_RANGE__FROM: |
150 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
151 | return; |
152 | } |
153 | super.notifyChanged(notification); |
154 | } |
155 | |
156 | /** |
157 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
158 | * that can be created under this object. |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | @Override |
164 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
165 | super.collectNewChildDescriptors(newChildDescriptors, object); |
166 | } |
167 | |
168 | } |