1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.QMLProfileFactory; |
11 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.QMLProfilePackage; |
12 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.RefinedQMLProfile; |
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.ComposeableAdapterFactory; |
23 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
24 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
25 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
26 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
27 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
29 | import org.eclipse.emf.edit.provider.ViewerNotification; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.RefinedQMLProfile} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class RefinedQMLProfileItemProvider |
38 | extends GenericQMLProfileItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * This constructs an instance from a factory and a notifier. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | public RefinedQMLProfileItemProvider(AdapterFactory adapterFactory) { |
52 | super(adapterFactory); |
53 | } |
54 | |
55 | /** |
56 | * This returns the property descriptors for the adapted class. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
63 | if (itemPropertyDescriptors == null) { |
64 | super.getPropertyDescriptors(object); |
65 | |
66 | addBaseProfilePropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Base Profile feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addBaseProfilePropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_RefinedQMLProfile_baseProfile_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_RefinedQMLProfile_baseProfile_feature", "_UI_RefinedQMLProfile_type"), |
84 | QMLProfilePackage.Literals.REFINED_QML_PROFILE__BASE_PROFILE, |
85 | true, |
86 | false, |
87 | true, |
88 | null, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
95 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
96 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | @Override |
102 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
103 | if (childrenFeatures == null) { |
104 | super.getChildrenFeatures(object); |
105 | childrenFeatures.add(QMLProfilePackage.Literals.REFINED_QML_PROFILE__REFINED_BY); |
106 | } |
107 | return childrenFeatures; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | @Override |
116 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
117 | // Check the type of the specified child object and return the proper feature to use for |
118 | // adding (see {@link AddCommand}) it as a child. |
119 | |
120 | return super.getChildFeature(object, child); |
121 | } |
122 | |
123 | /** |
124 | * This returns RefinedQMLProfile.gif. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | @Override |
130 | public Object getImage(Object object) { |
131 | return overlayImage(object, getResourceLocator().getImage("full/obj16/RefinedQMLProfile")); |
132 | } |
133 | |
134 | /** |
135 | * This returns the label text for the adapted class. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public String getText(Object object) { |
142 | String label = ((RefinedQMLProfile)object).getId(); |
143 | return label == null || label.length() == 0 ? |
144 | getString("_UI_RefinedQMLProfile_type") : |
145 | getString("_UI_RefinedQMLProfile_type") + " " + label; |
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(RefinedQMLProfile.class)) { |
160 | case QMLProfilePackage.REFINED_QML_PROFILE__REFINED_BY: |
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 | (QMLProfilePackage.Literals.REFINED_QML_PROFILE__REFINED_BY, |
181 | QMLProfileFactory.eINSTANCE.createUsageScenarioRequirement())); |
182 | |
183 | newChildDescriptors.add |
184 | (createChildParameter |
185 | (QMLProfilePackage.Literals.REFINED_QML_PROFILE__REFINED_BY, |
186 | QMLProfileFactory.eINSTANCE.createEntryLevelSystemCallRequirement())); |
187 | } |
188 | |
189 | } |