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.AggregationRecorder; |
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.ecore.EStructuralFeature; |
21 | |
22 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
23 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
24 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
25 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
26 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
27 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ViewerNotification; |
29 | |
30 | /** |
31 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pipesandfilters.AggregationRecorder} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class AggregationRecorderItemProvider |
37 | extends RecorderItemProvider |
38 | implements |
39 | IEditingDomainItemProvider, |
40 | IStructuredItemContentProvider, |
41 | ITreeItemContentProvider, |
42 | IItemLabelProvider, |
43 | IItemPropertySource { |
44 | /** |
45 | * This constructs an instance from a factory and a notifier. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public AggregationRecorderItemProvider(AdapterFactory adapterFactory) { |
51 | super(adapterFactory); |
52 | } |
53 | |
54 | /** |
55 | * This returns the property descriptors for the adapted class. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @generated |
59 | */ |
60 | @Override |
61 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
62 | if (itemPropertyDescriptors == null) { |
63 | super.getPropertyDescriptors(object); |
64 | |
65 | } |
66 | return itemPropertyDescriptors; |
67 | } |
68 | |
69 | /** |
70 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
71 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
72 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | @Override |
78 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
79 | if (childrenFeatures == null) { |
80 | super.getChildrenFeatures(object); |
81 | childrenFeatures.add(pipesandfiltersPackage.Literals.AGGREGATION_RECORDER__WRITER); |
82 | } |
83 | return childrenFeatures; |
84 | } |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | @Override |
92 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
93 | // Check the type of the specified child object and return the proper feature to use for |
94 | // adding (see {@link AddCommand}) it as a child. |
95 | |
96 | return super.getChildFeature(object, child); |
97 | } |
98 | |
99 | /** |
100 | * This returns the label text for the adapted class. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public String getText(Object object) { |
107 | String label = ((AggregationRecorder)object).getId(); |
108 | return label == null || label.length() == 0 ? |
109 | getString("_UI_AggregationRecorder_type") : |
110 | getString("_UI_AggregationRecorder_type") + " " + label; |
111 | } |
112 | |
113 | /** |
114 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
115 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | public void notifyChanged(Notification notification) { |
122 | updateChildren(notification); |
123 | |
124 | switch (notification.getFeatureID(AggregationRecorder.class)) { |
125 | case pipesandfiltersPackage.AGGREGATION_RECORDER__WRITER: |
126 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
127 | return; |
128 | } |
129 | super.notifyChanged(notification); |
130 | } |
131 | |
132 | /** |
133 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
134 | * that can be created under this object. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
141 | super.collectNewChildDescriptors(newChildDescriptors, object); |
142 | |
143 | newChildDescriptors.add |
144 | (createChildParameter |
145 | (pipesandfiltersPackage.Literals.AGGREGATION_RECORDER__WRITER, |
146 | pipesandfiltersFactory.eINSTANCE.createEDP2Writer())); |
147 | } |
148 | |
149 | } |