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.CharacterisedPCMParameterPartitionRange; |
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.CharacterisedPCMParameterPartitionRange} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class CharacterisedPCMParameterPartitionRangeItemProvider |
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 CharacterisedPCMParameterPartitionRangeItemProvider(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_RANGE__VALUES); |
83 | } |
84 | return childrenFeatures; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | @Override |
93 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
94 | // Check the type of the specified child object and return the proper feature to use for |
95 | // adding (see {@link AddCommand}) it as a child. |
96 | |
97 | return super.getChildFeature(object, child); |
98 | } |
99 | |
100 | /** |
101 | * This returns CharacterisedPCMParameterPartitionRange.gif. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | @Override |
107 | public Object getImage(Object object) { |
108 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CharacterisedPCMParameterPartitionRange")); |
109 | } |
110 | |
111 | /** |
112 | * This returns the label text for the adapted class. |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | @Override |
118 | public String getText(Object object) { |
119 | String label = ((CharacterisedPCMParameterPartitionRange)object).getId(); |
120 | return label == null || label.length() == 0 ? |
121 | getString("_UI_CharacterisedPCMParameterPartitionRange_type") : |
122 | getString("_UI_CharacterisedPCMParameterPartitionRange_type") + " " + label; |
123 | } |
124 | |
125 | /** |
126 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
127 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | @Override |
133 | public void notifyChanged(Notification notification) { |
134 | updateChildren(notification); |
135 | |
136 | switch (notification.getFeatureID(CharacterisedPCMParameterPartitionRange.class)) { |
137 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION_RANGE__VALUES: |
138 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
139 | return; |
140 | } |
141 | super.notifyChanged(notification); |
142 | } |
143 | |
144 | /** |
145 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
146 | * that can be created under this object. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
153 | super.collectNewChildDescriptors(newChildDescriptors, object); |
154 | |
155 | newChildDescriptors.add |
156 | (createChildParameter |
157 | (QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION_RANGE__VALUES, |
158 | CoreFactory.eINSTANCE.createPCMRandomVariable())); |
159 | } |
160 | |
161 | } |