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