1 | /** |
2 | * Copyright 2007-2009, SDQ, IPD, U Karlsruhe |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.probfunction.provider; |
7 | |
8 | |
9 | import java.util.Collection; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.notify.AdapterFactory; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
15 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
16 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
17 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
18 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
19 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
20 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
22 | import org.eclipse.emf.edit.provider.ViewerNotification; |
23 | |
24 | import de.uka.ipd.sdq.probfunction.NormalDistribution; |
25 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
26 | |
27 | /** |
28 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.probfunction.NormalDistribution} object. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public class NormalDistributionItemProvider |
34 | extends ContinuousPDFItemProvider |
35 | implements |
36 | IEditingDomainItemProvider, |
37 | IStructuredItemContentProvider, |
38 | ITreeItemContentProvider, |
39 | IItemLabelProvider, |
40 | IItemPropertySource { |
41 | /** |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
47 | |
48 | /** |
49 | * This constructs an instance from a factory and a notifier. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public NormalDistributionItemProvider(AdapterFactory adapterFactory) { |
55 | super(adapterFactory); |
56 | } |
57 | |
58 | /** |
59 | * This returns the property descriptors for the adapted class. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @generated |
63 | */ |
64 | @Override |
65 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
66 | if (itemPropertyDescriptors == null) { |
67 | super.getPropertyDescriptors(object); |
68 | |
69 | addMuPropertyDescriptor(object); |
70 | addSigmaPropertyDescriptor(object); |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This adds a property descriptor for the Mu feature. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | protected void addMuPropertyDescriptor(Object object) { |
82 | itemPropertyDescriptors.add |
83 | (createItemPropertyDescriptor |
84 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
85 | getResourceLocator(), |
86 | getString("_UI_NormalDistribution_mu_feature"), |
87 | getString("_UI_PropertyDescriptor_description", "_UI_NormalDistribution_mu_feature", "_UI_NormalDistribution_type"), |
88 | ProbfunctionPackage.Literals.NORMAL_DISTRIBUTION__MU, |
89 | true, |
90 | false, |
91 | false, |
92 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
93 | null, |
94 | null)); |
95 | } |
96 | |
97 | /** |
98 | * This adds a property descriptor for the Sigma feature. |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | protected void addSigmaPropertyDescriptor(Object object) { |
104 | itemPropertyDescriptors.add |
105 | (createItemPropertyDescriptor |
106 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
107 | getResourceLocator(), |
108 | getString("_UI_NormalDistribution_sigma_feature"), |
109 | getString("_UI_PropertyDescriptor_description", "_UI_NormalDistribution_sigma_feature", "_UI_NormalDistribution_type"), |
110 | ProbfunctionPackage.Literals.NORMAL_DISTRIBUTION__SIGMA, |
111 | true, |
112 | false, |
113 | false, |
114 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
115 | null, |
116 | null)); |
117 | } |
118 | |
119 | /** |
120 | * This returns NormalDistribution.gif. |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | @Override |
126 | public Object getImage(Object object) { |
127 | return overlayImage(object, getResourceLocator().getImage("full/obj16/NormalDistribution")); |
128 | } |
129 | |
130 | /** |
131 | * This returns the label text for the adapted class. |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | public String getText(Object object) { |
138 | String label = ((NormalDistribution)object).getUnitSpecification(); |
139 | return label == null || label.length() == 0 ? |
140 | getString("_UI_NormalDistribution_type") : |
141 | getString("_UI_NormalDistribution_type") + " " + label; |
142 | } |
143 | |
144 | /** |
145 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
146 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | @Override |
152 | public void notifyChanged(Notification notification) { |
153 | updateChildren(notification); |
154 | |
155 | switch (notification.getFeatureID(NormalDistribution.class)) { |
156 | case ProbfunctionPackage.NORMAL_DISTRIBUTION__MU: |
157 | case ProbfunctionPackage.NORMAL_DISTRIBUTION__SIGMA: |
158 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
159 | return; |
160 | } |
161 | super.notifyChanged(notification); |
162 | } |
163 | |
164 | /** |
165 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
166 | * that can be created under this object. |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | @Override |
172 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
173 | super.collectNewChildDescriptors(newChildDescriptors, object); |
174 | } |
175 | |
176 | } |