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.Constraint; |
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.Constraint} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class ConstraintItemProvider |
35 | extends NamedElementItemProvider |
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 ConstraintItemProvider(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 | addSourcePropertyDescriptor(object); |
64 | addTargetPropertyDescriptor(object); |
65 | addDescriptionPropertyDescriptor(object); |
66 | } |
67 | return itemPropertyDescriptors; |
68 | } |
69 | |
70 | /** |
71 | * This adds a property descriptor for the Source feature. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | protected void addSourcePropertyDescriptor(Object object) { |
77 | itemPropertyDescriptors.add |
78 | (createItemPropertyDescriptor |
79 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
80 | getResourceLocator(), |
81 | getString("_UI_Constraint_source_feature"), |
82 | getString("_UI_PropertyDescriptor_description", "_UI_Constraint_source_feature", "_UI_Constraint_type"), |
83 | featuremodelPackage.Literals.CONSTRAINT__SOURCE, |
84 | true, |
85 | false, |
86 | true, |
87 | null, |
88 | null, |
89 | null)); |
90 | } |
91 | |
92 | /** |
93 | * This adds a property descriptor for the Target feature. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | protected void addTargetPropertyDescriptor(Object object) { |
99 | itemPropertyDescriptors.add |
100 | (createItemPropertyDescriptor |
101 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
102 | getResourceLocator(), |
103 | getString("_UI_Constraint_target_feature"), |
104 | getString("_UI_PropertyDescriptor_description", "_UI_Constraint_target_feature", "_UI_Constraint_type"), |
105 | featuremodelPackage.Literals.CONSTRAINT__TARGET, |
106 | true, |
107 | false, |
108 | true, |
109 | null, |
110 | null, |
111 | null)); |
112 | } |
113 | |
114 | /** |
115 | * This adds a property descriptor for the Description feature. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | protected void addDescriptionPropertyDescriptor(Object object) { |
121 | itemPropertyDescriptors.add |
122 | (createItemPropertyDescriptor |
123 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
124 | getResourceLocator(), |
125 | getString("_UI_Constraint_description_feature"), |
126 | getString("_UI_PropertyDescriptor_description", "_UI_Constraint_description_feature", "_UI_Constraint_type"), |
127 | featuremodelPackage.Literals.CONSTRAINT__DESCRIPTION, |
128 | true, |
129 | false, |
130 | false, |
131 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
132 | null, |
133 | null)); |
134 | } |
135 | |
136 | /** |
137 | * This returns the label text for the adapted class. |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | public String getText(Object object) { |
144 | String label = ((Constraint)object).getName(); |
145 | return label == null || label.length() == 0 ? |
146 | getString("_UI_Constraint_type") : |
147 | getString("_UI_Constraint_type") + " " + label; |
148 | } |
149 | |
150 | /** |
151 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
152 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @Override |
158 | public void notifyChanged(Notification notification) { |
159 | updateChildren(notification); |
160 | |
161 | switch (notification.getFeatureID(Constraint.class)) { |
162 | case featuremodelPackage.CONSTRAINT__DESCRIPTION: |
163 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
164 | return; |
165 | } |
166 | super.notifyChanged(notification); |
167 | } |
168 | |
169 | /** |
170 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
171 | * that can be created under this object. |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | @Override |
177 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
178 | super.collectNewChildDescriptors(newChildDescriptors, object); |
179 | } |
180 | |
181 | } |