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.Order; |
11 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.QMLContractTypePackage; |
12 | |
13 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.provider.QMLProfileEditPlugin; |
14 | |
15 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
16 | |
17 | import java.util.Collection; |
18 | import java.util.List; |
19 | |
20 | import org.eclipse.emf.common.notify.AdapterFactory; |
21 | import org.eclipse.emf.common.notify.Notification; |
22 | |
23 | import org.eclipse.emf.common.util.ResourceLocator; |
24 | |
25 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
26 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
27 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
28 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
29 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
30 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
31 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
32 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.Order} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class OrderItemProvider |
40 | extends IdentifierItemProvider |
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 OrderItemProvider(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 | addBiggerElementPropertyDescriptor(object); |
69 | addSmallerElementPropertyDescriptor(object); |
70 | } |
71 | return itemPropertyDescriptors; |
72 | } |
73 | |
74 | /** |
75 | * This adds a property descriptor for the Bigger Element feature. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | protected void addBiggerElementPropertyDescriptor(Object object) { |
81 | itemPropertyDescriptors.add |
82 | (createItemPropertyDescriptor |
83 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
84 | getResourceLocator(), |
85 | getString("_UI_Order_biggerElement_feature"), |
86 | getString("_UI_PropertyDescriptor_description", "_UI_Order_biggerElement_feature", "_UI_Order_type"), |
87 | QMLContractTypePackage.Literals.ORDER__BIGGER_ELEMENT, |
88 | true, |
89 | false, |
90 | true, |
91 | null, |
92 | null, |
93 | null)); |
94 | } |
95 | |
96 | /** |
97 | * This adds a property descriptor for the Smaller Element feature. |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | protected void addSmallerElementPropertyDescriptor(Object object) { |
103 | itemPropertyDescriptors.add |
104 | (createItemPropertyDescriptor |
105 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
106 | getResourceLocator(), |
107 | getString("_UI_Order_smallerElement_feature"), |
108 | getString("_UI_PropertyDescriptor_description", "_UI_Order_smallerElement_feature", "_UI_Order_type"), |
109 | QMLContractTypePackage.Literals.ORDER__SMALLER_ELEMENT, |
110 | true, |
111 | false, |
112 | true, |
113 | null, |
114 | null, |
115 | null)); |
116 | } |
117 | |
118 | /** |
119 | * This returns Order.gif. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public Object getImage(Object object) { |
126 | return overlayImage(object, getResourceLocator().getImage("full/obj16/Order")); |
127 | } |
128 | |
129 | /** |
130 | * This returns the label text for the adapted class. |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | @Override |
136 | public String getText(Object object) { |
137 | String label = ((Order)object).getId(); |
138 | return label == null || label.length() == 0 ? |
139 | getString("_UI_Order_type") : |
140 | getString("_UI_Order_type") + " " + label; |
141 | } |
142 | |
143 | /** |
144 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
145 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
146 | * <!-- begin-user-doc --> |
147 | * <!-- end-user-doc --> |
148 | * @generated |
149 | */ |
150 | @Override |
151 | public void notifyChanged(Notification notification) { |
152 | updateChildren(notification); |
153 | super.notifyChanged(notification); |
154 | } |
155 | |
156 | /** |
157 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
158 | * that can be created under this object. |
159 | * <!-- begin-user-doc --> |
160 | * <!-- end-user-doc --> |
161 | * @generated |
162 | */ |
163 | @Override |
164 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
165 | super.collectNewChildDescriptors(newChildDescriptors, object); |
166 | } |
167 | |
168 | /** |
169 | * Return the resource locator for this item provider's resources. |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | @Override |
175 | public ResourceLocator getResourceLocator() { |
176 | return QMLProfileEditPlugin.INSTANCE; |
177 | } |
178 | |
179 | } |