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.DoubleAttribute; |
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.DoubleAttribute} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class DoubleAttributeItemProvider |
35 | extends AttributeItemProvider |
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 DoubleAttributeItemProvider(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 | addDefaultValuePropertyDescriptor(object); |
64 | } |
65 | return itemPropertyDescriptors; |
66 | } |
67 | |
68 | /** |
69 | * This adds a property descriptor for the Default Value feature. |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | protected void addDefaultValuePropertyDescriptor(Object object) { |
75 | itemPropertyDescriptors.add |
76 | (createItemPropertyDescriptor |
77 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
78 | getResourceLocator(), |
79 | getString("_UI_DoubleAttribute_defaultValue_feature"), |
80 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleAttribute_defaultValue_feature", "_UI_DoubleAttribute_type"), |
81 | featuremodelPackage.Literals.DOUBLE_ATTRIBUTE__DEFAULT_VALUE, |
82 | true, |
83 | false, |
84 | false, |
85 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
86 | null, |
87 | null)); |
88 | } |
89 | |
90 | /** |
91 | * This returns DoubleAttribute.gif. |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | public Object getImage(Object object) { |
98 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DoubleAttribute")); |
99 | } |
100 | |
101 | /** |
102 | * This returns the label text for the adapted class. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | @Override |
108 | public String getText(Object object) { |
109 | String label = ((DoubleAttribute)object).getName(); |
110 | return label == null || label.length() == 0 ? |
111 | getString("_UI_DoubleAttribute_type") : |
112 | getString("_UI_DoubleAttribute_type") + " " + label; |
113 | } |
114 | |
115 | /** |
116 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
117 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | @Override |
123 | public void notifyChanged(Notification notification) { |
124 | updateChildren(notification); |
125 | |
126 | switch (notification.getFeatureID(DoubleAttribute.class)) { |
127 | case featuremodelPackage.DOUBLE_ATTRIBUTE__DEFAULT_VALUE: |
128 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
129 | return; |
130 | } |
131 | super.notifyChanged(notification); |
132 | } |
133 | |
134 | /** |
135 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
136 | * that can be created under this object. |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | @Override |
142 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
143 | super.collectNewChildDescriptors(newChildDescriptors, object); |
144 | } |
145 | |
146 | } |