1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.DimensionTypeSet; |
11 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.QMLContractTypeFactory; |
12 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.QMLContractTypePackage; |
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.dsexplore.qml.contracttype.QMLContractType.DimensionTypeSet} object. |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | public class DimensionTypeSetItemProvider |
37 | extends DimensionTypeItemProvider |
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 DimensionTypeSetItemProvider(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(QMLContractTypePackage.Literals.DIMENSION_TYPE_SET__ELEMENTS); |
82 | childrenFeatures.add(QMLContractTypePackage.Literals.DIMENSION_TYPE_SET__ORDER); |
83 | } |
84 | return childrenFeatures; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | @Override |
93 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
94 | // Check the type of the specified child object and return the proper feature to use for |
95 | // adding (see {@link AddCommand}) it as a child. |
96 | |
97 | return super.getChildFeature(object, child); |
98 | } |
99 | |
100 | /** |
101 | * This returns DimensionTypeSet.gif. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @generated |
105 | */ |
106 | @Override |
107 | public Object getImage(Object object) { |
108 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DimensionTypeSet")); |
109 | } |
110 | |
111 | /** |
112 | * This returns the label text for the adapted class. |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | @Override |
118 | public String getText(Object object) { |
119 | String label = ((DimensionTypeSet)object).getId(); |
120 | return label == null || label.length() == 0 ? |
121 | getString("_UI_DimensionTypeSet_type") : |
122 | getString("_UI_DimensionTypeSet_type") + " " + label; |
123 | } |
124 | |
125 | /** |
126 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
127 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | @Override |
133 | public void notifyChanged(Notification notification) { |
134 | updateChildren(notification); |
135 | |
136 | switch (notification.getFeatureID(DimensionTypeSet.class)) { |
137 | case QMLContractTypePackage.DIMENSION_TYPE_SET__ELEMENTS: |
138 | case QMLContractTypePackage.DIMENSION_TYPE_SET__ORDER: |
139 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
140 | return; |
141 | } |
142 | super.notifyChanged(notification); |
143 | } |
144 | |
145 | /** |
146 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
147 | * that can be created under this object. |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | @Override |
153 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
154 | super.collectNewChildDescriptors(newChildDescriptors, object); |
155 | |
156 | newChildDescriptors.add |
157 | (createChildParameter |
158 | (QMLContractTypePackage.Literals.DIMENSION_TYPE_SET__ELEMENTS, |
159 | QMLContractTypeFactory.eINSTANCE.createElement())); |
160 | |
161 | newChildDescriptors.add |
162 | (createChildParameter |
163 | (QMLContractTypePackage.Literals.DIMENSION_TYPE_SET__ORDER, |
164 | QMLContractTypeFactory.eINSTANCE.createOrder())); |
165 | } |
166 | |
167 | } |