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