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.Candidates; |
11 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionFactory; |
12 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
13 | |
14 | import java.util.Collection; |
15 | import java.util.List; |
16 | |
17 | import org.eclipse.emf.common.notify.AdapterFactory; |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | |
20 | import org.eclipse.emf.common.util.ResourceLocator; |
21 | |
22 | import org.eclipse.emf.ecore.EStructuralFeature; |
23 | |
24 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
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.Candidates} object. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public class CandidatesItemProvider |
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 CandidatesItemProvider(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 | addProblemPropertyDescriptor(object); |
70 | } |
71 | return itemPropertyDescriptors; |
72 | } |
73 | |
74 | /** |
75 | * This adds a property descriptor for the Problem feature. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | protected void addProblemPropertyDescriptor(Object object) { |
81 | itemPropertyDescriptors.add |
82 | (createItemPropertyDescriptor |
83 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
84 | getResourceLocator(), |
85 | getString("_UI_Candidates_problem_feature"), |
86 | getString("_UI_PropertyDescriptor_description", "_UI_Candidates_problem_feature", "_UI_Candidates_type"), |
87 | designdecisionPackage.Literals.CANDIDATES__PROBLEM, |
88 | true, |
89 | false, |
90 | true, |
91 | null, |
92 | null, |
93 | null)); |
94 | } |
95 | |
96 | /** |
97 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
98 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
99 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | @Override |
105 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
106 | if (childrenFeatures == null) { |
107 | super.getChildrenFeatures(object); |
108 | childrenFeatures.add(designdecisionPackage.Literals.CANDIDATES__CANDIDATE); |
109 | } |
110 | return childrenFeatures; |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
120 | // Check the type of the specified child object and return the proper feature to use for |
121 | // adding (see {@link AddCommand}) it as a child. |
122 | |
123 | return super.getChildFeature(object, child); |
124 | } |
125 | |
126 | /** |
127 | * This returns Candidates.gif. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | @Override |
133 | public Object getImage(Object object) { |
134 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Candidates")); |
135 | } |
136 | |
137 | /** |
138 | * This returns the label text for the adapted class. |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public String getText(Object object) { |
145 | return getString("_UI_Candidates_type"); |
146 | } |
147 | |
148 | /** |
149 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
150 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @Override |
156 | public void notifyChanged(Notification notification) { |
157 | updateChildren(notification); |
158 | |
159 | switch (notification.getFeatureID(Candidates.class)) { |
160 | case designdecisionPackage.CANDIDATES__CANDIDATE: |
161 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
162 | return; |
163 | } |
164 | super.notifyChanged(notification); |
165 | } |
166 | |
167 | /** |
168 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
169 | * that can be created under this object. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
176 | super.collectNewChildDescriptors(newChildDescriptors, object); |
177 | |
178 | newChildDescriptors.add |
179 | (createChildParameter |
180 | (designdecisionPackage.Literals.CANDIDATES__CANDIDATE, |
181 | designdecisionFactory.eINSTANCE.createCandidate())); |
182 | } |
183 | |
184 | /** |
185 | * Return the resource locator for this item provider's resources. |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | @Override |
191 | public ResourceLocator getResourceLocator() { |
192 | return DesignDecisionEditPlugin.INSTANCE; |
193 | } |
194 | |
195 | } |