1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.designdecision.Candidate; |
11 | import de.uka.ipd.sdq.pcm.designdecision.QualityProperties.QualityPropertiesFactory; |
12 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionFactory; |
13 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
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.ecore.EStructuralFeature; |
24 | |
25 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
26 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
27 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
28 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
29 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
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.Candidate} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class CandidateItemProvider |
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 CandidateItemProvider(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 | } |
70 | return itemPropertyDescriptors; |
71 | } |
72 | |
73 | /** |
74 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
75 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
76 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | @Override |
82 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
83 | if (childrenFeatures == null) { |
84 | super.getChildrenFeatures(object); |
85 | childrenFeatures.add(designdecisionPackage.Literals.CANDIDATE__CHOICES); |
86 | childrenFeatures.add(designdecisionPackage.Literals.CANDIDATE__QUALITY_PROPERTY); |
87 | } |
88 | return childrenFeatures; |
89 | } |
90 | |
91 | /** |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
98 | // Check the type of the specified child object and return the proper feature to use for |
99 | // adding (see {@link AddCommand}) it as a child. |
100 | |
101 | return super.getChildFeature(object, child); |
102 | } |
103 | |
104 | /** |
105 | * This returns Candidate.gif. |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public Object getImage(Object object) { |
112 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Candidate")); |
113 | } |
114 | |
115 | /** |
116 | * This returns the label text for the adapted class. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public String getText(Object object) { |
123 | return getString("_UI_Candidate_type"); |
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(Candidate.class)) { |
138 | case designdecisionPackage.CANDIDATE__CHOICES: |
139 | case designdecisionPackage.CANDIDATE__QUALITY_PROPERTY: |
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 | (designdecisionPackage.Literals.CANDIDATE__CHOICES, |
160 | designdecisionFactory.eINSTANCE.createClassChoice())); |
161 | |
162 | newChildDescriptors.add |
163 | (createChildParameter |
164 | (designdecisionPackage.Literals.CANDIDATE__CHOICES, |
165 | designdecisionFactory.eINSTANCE.createContinousRangeChoice())); |
166 | |
167 | newChildDescriptors.add |
168 | (createChildParameter |
169 | (designdecisionPackage.Literals.CANDIDATE__CHOICES, |
170 | designdecisionFactory.eINSTANCE.createDiscreteRangeChoice())); |
171 | |
172 | newChildDescriptors.add |
173 | (createChildParameter |
174 | (designdecisionPackage.Literals.CANDIDATE__CHOICES, |
175 | designdecisionFactory.eINSTANCE.createSchedulingPolicyChoice())); |
176 | |
177 | newChildDescriptors.add |
178 | (createChildParameter |
179 | (designdecisionPackage.Literals.CANDIDATE__QUALITY_PROPERTY, |
180 | QualityPropertiesFactory.eINSTANCE.createElementQualityProperty())); |
181 | |
182 | newChildDescriptors.add |
183 | (createChildParameter |
184 | (designdecisionPackage.Literals.CANDIDATE__QUALITY_PROPERTY, |
185 | QualityPropertiesFactory.eINSTANCE.createIntegerQualityProperty())); |
186 | |
187 | newChildDescriptors.add |
188 | (createChildParameter |
189 | (designdecisionPackage.Literals.CANDIDATE__QUALITY_PROPERTY, |
190 | QualityPropertiesFactory.eINSTANCE.createDoubleQualityProperty())); |
191 | } |
192 | |
193 | /** |
194 | * Return the resource locator for this item provider's resources. |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | @Override |
200 | public ResourceLocator getResourceLocator() { |
201 | return DesignDecisionEditPlugin.INSTANCE; |
202 | } |
203 | |
204 | } |