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.QualityPropertiesPackage; |
11 | import de.uka.ipd.sdq.pcm.designdecision.QualityProperties.QualityProperty; |
12 | |
13 | import de.uka.ipd.sdq.pcm.designdecision.provider.DesignDecisionEditPlugin; |
14 | |
15 | import java.util.Collection; |
16 | import java.util.List; |
17 | |
18 | import org.eclipse.emf.common.notify.AdapterFactory; |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.ResourceLocator; |
22 | |
23 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
26 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
27 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
28 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
32 | import org.eclipse.emf.edit.provider.ViewerNotification; |
33 | |
34 | /** |
35 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.designdecision.QualityProperties.QualityProperty} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class QualityPropertyItemProvider |
41 | extends ItemProviderAdapter |
42 | implements |
43 | IEditingDomainItemProvider, |
44 | IStructuredItemContentProvider, |
45 | ITreeItemContentProvider, |
46 | IItemLabelProvider, |
47 | IItemPropertySource { |
48 | /** |
49 | * This constructs an instance from a factory and a notifier. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public QualityPropertyItemProvider(AdapterFactory adapterFactory) { |
55 | super(adapterFactory); |
56 | } |
57 | |
58 | /** |
59 | * This returns the property descriptors for the adapted class. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | @Override |
65 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
66 | if (itemPropertyDescriptors == null) { |
67 | super.getPropertyDescriptors(object); |
68 | |
69 | addQualityValuePropertyDescriptor(object); |
70 | } |
71 | return itemPropertyDescriptors; |
72 | } |
73 | |
74 | /** |
75 | * This adds a property descriptor for the Quality Value feature. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | protected void addQualityValuePropertyDescriptor(Object object) { |
81 | itemPropertyDescriptors.add |
82 | (createItemPropertyDescriptor |
83 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
84 | getResourceLocator(), |
85 | getString("_UI_QualityProperty_qualityValue_feature"), |
86 | getString("_UI_PropertyDescriptor_description", "_UI_QualityProperty_qualityValue_feature", "_UI_QualityProperty_type"), |
87 | QualityPropertiesPackage.Literals.QUALITY_PROPERTY__QUALITY_VALUE, |
88 | true, |
89 | false, |
90 | false, |
91 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
92 | null, |
93 | null)); |
94 | } |
95 | |
96 | /** |
97 | * This returns the label text for the adapted class. |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | @Override |
103 | public String getText(Object object) { |
104 | Object labelValue = ((QualityProperty)object).getQualityValue(); |
105 | String label = labelValue == null ? null : labelValue.toString(); |
106 | return label == null || label.length() == 0 ? |
107 | getString("_UI_QualityProperty_type") : |
108 | getString("_UI_QualityProperty_type") + " " + label; |
109 | } |
110 | |
111 | /** |
112 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
113 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | public void notifyChanged(Notification notification) { |
120 | updateChildren(notification); |
121 | |
122 | switch (notification.getFeatureID(QualityProperty.class)) { |
123 | case QualityPropertiesPackage.QUALITY_PROPERTY__QUALITY_VALUE: |
124 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
125 | return; |
126 | } |
127 | super.notifyChanged(notification); |
128 | } |
129 | |
130 | /** |
131 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
132 | * that can be created under this object. |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | @Override |
138 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
139 | super.collectNewChildDescriptors(newChildDescriptors, object); |
140 | } |
141 | |
142 | /** |
143 | * Return the resource locator for this item provider's resources. |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public ResourceLocator getResourceLocator() { |
150 | return DesignDecisionEditPlugin.INSTANCE; |
151 | } |
152 | |
153 | } |