1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.computed_usage.provider; |
7 | |
8 | |
9 | import de.uka.ipd.sdq.context.computed_usage.BranchProbability; |
10 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
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.common.util.ResourceLocator; |
19 | |
20 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
21 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
22 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
23 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
24 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
25 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
26 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
27 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
28 | import org.eclipse.emf.edit.provider.ItemProviderAdapter; |
29 | import org.eclipse.emf.edit.provider.ViewerNotification; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.context.computed_usage.BranchProbability} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class BranchProbabilityItemProvider |
38 | extends ItemProviderAdapter |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @generated |
49 | */ |
50 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
51 | |
52 | /** |
53 | * This constructs an instance from a factory and a notifier. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public BranchProbabilityItemProvider(AdapterFactory adapterFactory) { |
59 | super(adapterFactory); |
60 | } |
61 | |
62 | /** |
63 | * This returns the property descriptors for the adapted class. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | @Override |
69 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
70 | if (itemPropertyDescriptors == null) { |
71 | super.getPropertyDescriptors(object); |
72 | |
73 | addProbabilityPropertyDescriptor(object); |
74 | addBranchtransition_BranchProbabilityPropertyDescriptor(object); |
75 | } |
76 | return itemPropertyDescriptors; |
77 | } |
78 | |
79 | /** |
80 | * This adds a property descriptor for the Probability feature. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | protected void addProbabilityPropertyDescriptor(Object object) { |
86 | itemPropertyDescriptors.add |
87 | (createItemPropertyDescriptor |
88 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
89 | getResourceLocator(), |
90 | getString("_UI_BranchProbability_probability_feature"), |
91 | getString("_UI_PropertyDescriptor_description", "_UI_BranchProbability_probability_feature", "_UI_BranchProbability_type"), |
92 | ComputedUsagePackage.Literals.BRANCH_PROBABILITY__PROBABILITY, |
93 | true, |
94 | false, |
95 | false, |
96 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
97 | null, |
98 | null)); |
99 | } |
100 | |
101 | /** |
102 | * This adds a property descriptor for the Branchtransition Branch Probability feature. |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | protected void addBranchtransition_BranchProbabilityPropertyDescriptor(Object object) { |
108 | itemPropertyDescriptors.add |
109 | (createItemPropertyDescriptor |
110 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
111 | getResourceLocator(), |
112 | getString("_UI_BranchProbability_branchtransition_BranchProbability_feature"), |
113 | getString("_UI_PropertyDescriptor_description", "_UI_BranchProbability_branchtransition_BranchProbability_feature", "_UI_BranchProbability_type"), |
114 | ComputedUsagePackage.Literals.BRANCH_PROBABILITY__BRANCHTRANSITION_BRANCH_PROBABILITY, |
115 | true, |
116 | false, |
117 | true, |
118 | null, |
119 | null, |
120 | null)); |
121 | } |
122 | |
123 | /** |
124 | * This returns BranchProbability.gif. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | @Override |
130 | public Object getImage(Object object) { |
131 | return overlayImage(object, getResourceLocator().getImage("full/obj16/BranchProbability")); |
132 | } |
133 | |
134 | /** |
135 | * This returns the label text for the adapted class. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public String getText(Object object) { |
142 | BranchProbability branchProbability = (BranchProbability)object; |
143 | return getString("_UI_BranchProbability_type") + " " + branchProbability.getProbability(); |
144 | } |
145 | |
146 | /** |
147 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
148 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public void notifyChanged(Notification notification) { |
155 | updateChildren(notification); |
156 | |
157 | switch (notification.getFeatureID(BranchProbability.class)) { |
158 | case ComputedUsagePackage.BRANCH_PROBABILITY__PROBABILITY: |
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 | /** |
178 | * Return the resource locator for this item provider's resources. |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public ResourceLocator getResourceLocator() { |
185 | return ContextEditPlugin.INSTANCE; |
186 | } |
187 | |
188 | } |