1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resultdecorator.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.core.entity.provider.NamedElementItemProvider; |
11 | |
12 | import de.uka.ipd.sdq.pcm.resultdecorator.ResultDecoratorRepository; |
13 | import de.uka.ipd.sdq.pcm.resultdecorator.ResultdecoratorPackage; |
14 | |
15 | import de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.RepositorydecoratorFactory; |
16 | |
17 | import de.uka.ipd.sdq.pcm.resultdecorator.resourceenvironmentdecorator.ResourceenvironmentdecoratorFactory; |
18 | |
19 | import java.util.Collection; |
20 | import java.util.List; |
21 | |
22 | import org.eclipse.emf.common.notify.AdapterFactory; |
23 | import org.eclipse.emf.common.notify.Notification; |
24 | |
25 | import org.eclipse.emf.common.util.ResourceLocator; |
26 | |
27 | import org.eclipse.emf.ecore.EStructuralFeature; |
28 | |
29 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
30 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
31 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
32 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
33 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
34 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
35 | import org.eclipse.emf.edit.provider.ViewerNotification; |
36 | |
37 | /** |
38 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.resultdecorator.ResultDecoratorRepository} object. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public class ResultDecoratorRepositoryItemProvider |
44 | extends NamedElementItemProvider |
45 | implements |
46 | IEditingDomainItemProvider, |
47 | IStructuredItemContentProvider, |
48 | ITreeItemContentProvider, |
49 | IItemLabelProvider, |
50 | IItemPropertySource { |
51 | /** |
52 | * This constructs an instance from a factory and a notifier. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public ResultDecoratorRepositoryItemProvider(AdapterFactory adapterFactory) { |
58 | super(adapterFactory); |
59 | } |
60 | |
61 | /** |
62 | * This returns the property descriptors for the adapted class. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | @Override |
68 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
69 | if (itemPropertyDescriptors == null) { |
70 | super.getPropertyDescriptors(object); |
71 | |
72 | } |
73 | return itemPropertyDescriptors; |
74 | } |
75 | |
76 | /** |
77 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
78 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
79 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | @Override |
85 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
86 | if (childrenFeatures == null) { |
87 | super.getChildrenFeatures(object); |
88 | childrenFeatures.add(ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__COMPONENT_RESULTS_RESULT_DECORATOR_REPOSITORY); |
89 | childrenFeatures.add(ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY); |
90 | childrenFeatures.add(ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__SERVICE_RESULT_RESULT_DECORATOR_REPOSITORY); |
91 | } |
92 | return childrenFeatures; |
93 | } |
94 | |
95 | /** |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | @Override |
101 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
102 | // Check the type of the specified child object and return the proper feature to use for |
103 | // adding (see {@link AddCommand}) it as a child. |
104 | |
105 | return super.getChildFeature(object, child); |
106 | } |
107 | |
108 | /** |
109 | * This returns ResultDecoratorRepository.gif. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public Object getImage(Object object) { |
116 | return overlayImage(object, getResourceLocator().getImage("full/obj16/ResultDecoratorRepository")); |
117 | } |
118 | |
119 | /** |
120 | * This returns the label text for the adapted class. |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public String getText(Object object) { |
127 | String label = ((ResultDecoratorRepository)object).getEntityName(); |
128 | return label == null || label.length() == 0 ? |
129 | getString("_UI_ResultDecoratorRepository_type") : |
130 | getString("_UI_ResultDecoratorRepository_type") + " " + label; |
131 | } |
132 | |
133 | /** |
134 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
135 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public void notifyChanged(Notification notification) { |
142 | updateChildren(notification); |
143 | |
144 | switch (notification.getFeatureID(ResultDecoratorRepository.class)) { |
145 | case ResultdecoratorPackage.RESULT_DECORATOR_REPOSITORY__COMPONENT_RESULTS_RESULT_DECORATOR_REPOSITORY: |
146 | case ResultdecoratorPackage.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY: |
147 | case ResultdecoratorPackage.RESULT_DECORATOR_REPOSITORY__SERVICE_RESULT_RESULT_DECORATOR_REPOSITORY: |
148 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
149 | return; |
150 | } |
151 | super.notifyChanged(notification); |
152 | } |
153 | |
154 | /** |
155 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
156 | * that can be created under this object. |
157 | * <!-- begin-user-doc --> |
158 | * <!-- end-user-doc --> |
159 | * @generated |
160 | */ |
161 | @Override |
162 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
163 | super.collectNewChildDescriptors(newChildDescriptors, object); |
164 | |
165 | newChildDescriptors.add |
166 | (createChildParameter |
167 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__COMPONENT_RESULTS_RESULT_DECORATOR_REPOSITORY, |
168 | RepositorydecoratorFactory.eINSTANCE.createInterfaceProvidingRequiringEntityResults())); |
169 | |
170 | newChildDescriptors.add |
171 | (createChildParameter |
172 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__COMPONENT_RESULTS_RESULT_DECORATOR_REPOSITORY, |
173 | RepositorydecoratorFactory.eINSTANCE.createAllocationContextResults())); |
174 | |
175 | newChildDescriptors.add |
176 | (createChildParameter |
177 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY, |
178 | ResourceenvironmentdecoratorFactory.eINSTANCE.createLinkingResourceResults())); |
179 | |
180 | newChildDescriptors.add |
181 | (createChildParameter |
182 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY, |
183 | ResourceenvironmentdecoratorFactory.eINSTANCE.createResourceContainerResults())); |
184 | |
185 | newChildDescriptors.add |
186 | (createChildParameter |
187 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY, |
188 | ResourceenvironmentdecoratorFactory.eINSTANCE.createProcessingResourceSpecificationResult())); |
189 | |
190 | newChildDescriptors.add |
191 | (createChildParameter |
192 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__UTILISATION_RESULTS_RESULT_DECORATOR_REPOSITORY, |
193 | ResourceenvironmentdecoratorFactory.eINSTANCE.createPassiveResourceResult())); |
194 | |
195 | newChildDescriptors.add |
196 | (createChildParameter |
197 | (ResultdecoratorPackage.Literals.RESULT_DECORATOR_REPOSITORY__SERVICE_RESULT_RESULT_DECORATOR_REPOSITORY, |
198 | RepositorydecoratorFactory.eINSTANCE.createAllocationServiceResult())); |
199 | } |
200 | |
201 | /** |
202 | * Return the resource locator for this item provider's resources. |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | @Override |
208 | public ResourceLocator getResourceLocator() { |
209 | return ResultdecoratorEditPlugin.INSTANCE; |
210 | } |
211 | |
212 | } |