1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.provider; |
8 | |
9 | |
10 | import de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartitionInterval; |
11 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
12 | |
13 | import de.uka.ipd.sdq.pcm.core.CoreFactory; |
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.ecore.EStructuralFeature; |
22 | |
23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
25 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ViewerNotification; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartitionInterval} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class CharacterisedPCMParameterPartitionIntervalItemProvider |
38 | extends CharacterisedPCMParameterPartitionItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * This constructs an instance from a factory and a notifier. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | public CharacterisedPCMParameterPartitionIntervalItemProvider(AdapterFactory adapterFactory) { |
52 | super(adapterFactory); |
53 | } |
54 | |
55 | /** |
56 | * This returns the property descriptors for the adapted class. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
63 | if (itemPropertyDescriptors == null) { |
64 | super.getPropertyDescriptors(object); |
65 | |
66 | } |
67 | return itemPropertyDescriptors; |
68 | } |
69 | |
70 | /** |
71 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
72 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
73 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @generated |
77 | */ |
78 | @Override |
79 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
80 | if (childrenFeatures == null) { |
81 | super.getChildrenFeatures(object); |
82 | childrenFeatures.add(QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__FROM); |
83 | childrenFeatures.add(QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__TO); |
84 | } |
85 | return childrenFeatures; |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | @Override |
94 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
95 | // Check the type of the specified child object and return the proper feature to use for |
96 | // adding (see {@link AddCommand}) it as a child. |
97 | |
98 | return super.getChildFeature(object, child); |
99 | } |
100 | |
101 | /** |
102 | * This returns CharacterisedPCMParameterPartitionInterval.gif. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | @Override |
108 | public Object getImage(Object object) { |
109 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CharacterisedPCMParameterPartitionInterval")); |
110 | } |
111 | |
112 | /** |
113 | * This returns the label text for the adapted class. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | public String getText(Object object) { |
120 | String label = ((CharacterisedPCMParameterPartitionInterval)object).getId(); |
121 | return label == null || label.length() == 0 ? |
122 | getString("_UI_CharacterisedPCMParameterPartitionInterval_type") : |
123 | getString("_UI_CharacterisedPCMParameterPartitionInterval_type") + " " + label; |
124 | } |
125 | |
126 | /** |
127 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
128 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public void notifyChanged(Notification notification) { |
135 | updateChildren(notification); |
136 | |
137 | switch (notification.getFeatureID(CharacterisedPCMParameterPartitionInterval.class)) { |
138 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__FROM: |
139 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__TO: |
140 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
141 | return; |
142 | } |
143 | super.notifyChanged(notification); |
144 | } |
145 | |
146 | /** |
147 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
148 | * that can be created under this object. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
155 | super.collectNewChildDescriptors(newChildDescriptors, object); |
156 | |
157 | newChildDescriptors.add |
158 | (createChildParameter |
159 | (QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__FROM, |
160 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
161 | |
162 | newChildDescriptors.add |
163 | (createChildParameter |
164 | (QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__TO, |
165 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
166 | } |
167 | |
168 | /** |
169 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
176 | Object childFeature = feature; |
177 | Object childObject = child; |
178 | |
179 | boolean qualify = |
180 | childFeature == QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__FROM || |
181 | childFeature == QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_INTERVAL__TO; |
182 | |
183 | if (qualify) { |
184 | return getString |
185 | ("_UI_CreateChild_text2", |
186 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
187 | } |
188 | return super.getCreateChildText(owner, feature, child, selection); |
189 | } |
190 | |
191 | } |