1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.probespec.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider; |
11 | |
12 | import de.uka.ipd.sdq.probespec.Calculator; |
13 | import de.uka.ipd.sdq.probespec.probespecPackage; |
14 | |
15 | import java.util.Collection; |
16 | import java.util.List; |
17 | |
18 | import org.eclipse.emf.common.notify.AdapterFactory; |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.ResourceLocator; |
22 | |
23 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
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.ItemPropertyDescriptor; |
31 | import org.eclipse.emf.edit.provider.ViewerNotification; |
32 | |
33 | /** |
34 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.probespec.Calculator} object. |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public class CalculatorItemProvider |
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 CalculatorItemProvider(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 | addActivePropertyDescriptor(object); |
69 | addPipeElementPropertyDescriptor(object); |
70 | } |
71 | return itemPropertyDescriptors; |
72 | } |
73 | |
74 | /** |
75 | * This adds a property descriptor for the Active feature. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | protected void addActivePropertyDescriptor(Object object) { |
81 | itemPropertyDescriptors.add |
82 | (createItemPropertyDescriptor |
83 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
84 | getResourceLocator(), |
85 | getString("_UI_Calculator_active_feature"), |
86 | getString("_UI_PropertyDescriptor_description", "_UI_Calculator_active_feature", "_UI_Calculator_type"), |
87 | probespecPackage.Literals.CALCULATOR__ACTIVE, |
88 | true, |
89 | false, |
90 | false, |
91 | ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, |
92 | null, |
93 | null)); |
94 | } |
95 | |
96 | /** |
97 | * This adds a property descriptor for the Pipe Element feature. |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | protected void addPipeElementPropertyDescriptor(Object object) { |
103 | itemPropertyDescriptors.add |
104 | (createItemPropertyDescriptor |
105 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
106 | getResourceLocator(), |
107 | getString("_UI_Calculator_pipeElement_feature"), |
108 | getString("_UI_PropertyDescriptor_description", "_UI_Calculator_pipeElement_feature", "_UI_Calculator_type"), |
109 | probespecPackage.Literals.CALCULATOR__PIPE_ELEMENT, |
110 | true, |
111 | false, |
112 | true, |
113 | null, |
114 | null, |
115 | null)); |
116 | } |
117 | |
118 | /** |
119 | * This returns the label text for the adapted class. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | @Override |
125 | public String getText(Object object) { |
126 | String label = ((Calculator)object).getId(); |
127 | return label == null || label.length() == 0 ? |
128 | getString("_UI_Calculator_type") : |
129 | getString("_UI_Calculator_type") + " " + label; |
130 | } |
131 | |
132 | /** |
133 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
134 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @generated |
138 | */ |
139 | @Override |
140 | public void notifyChanged(Notification notification) { |
141 | updateChildren(notification); |
142 | |
143 | switch (notification.getFeatureID(Calculator.class)) { |
144 | case probespecPackage.CALCULATOR__ACTIVE: |
145 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
146 | return; |
147 | } |
148 | super.notifyChanged(notification); |
149 | } |
150 | |
151 | /** |
152 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
153 | * that can be created under this object. |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | @Override |
159 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
160 | super.collectNewChildDescriptors(newChildDescriptors, object); |
161 | } |
162 | |
163 | /** |
164 | * Return the resource locator for this item provider's resources. |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | @Override |
170 | public ResourceLocator getResourceLocator() { |
171 | return ProbeSpecificationEditPlugin.INSTANCE; |
172 | } |
173 | |
174 | } |