1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.pcm.designdecision.SchedulingPolicyChoice; |
11 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
12 | |
13 | import de.uka.ipd.sdq.pcm.resourceenvironment.SchedulingPolicy; |
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.edit.provider.ComposeableAdapterFactory; |
22 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
23 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
24 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
25 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
26 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
27 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
28 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
29 | import org.eclipse.emf.edit.provider.ViewerNotification; |
30 | |
31 | /** |
32 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.designdecision.SchedulingPolicyChoice} object. |
33 | * <!-- begin-user-doc --> |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class SchedulingPolicyChoiceItemProvider |
38 | extends ChoiceItemProvider |
39 | implements |
40 | IEditingDomainItemProvider, |
41 | IStructuredItemContentProvider, |
42 | ITreeItemContentProvider, |
43 | IItemLabelProvider, |
44 | IItemPropertySource { |
45 | /** |
46 | * This constructs an instance from a factory and a notifier. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | public SchedulingPolicyChoiceItemProvider(AdapterFactory adapterFactory) { |
52 | super(adapterFactory); |
53 | } |
54 | |
55 | /** |
56 | * This returns the property descriptors for the adapted class. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
63 | if (itemPropertyDescriptors == null) { |
64 | super.getPropertyDescriptors(object); |
65 | |
66 | addChosenValuePropertyDescriptor(object); |
67 | } |
68 | return itemPropertyDescriptors; |
69 | } |
70 | |
71 | /** |
72 | * This adds a property descriptor for the Chosen Value feature. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @generated |
76 | */ |
77 | protected void addChosenValuePropertyDescriptor(Object object) { |
78 | itemPropertyDescriptors.add |
79 | (createItemPropertyDescriptor |
80 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
81 | getResourceLocator(), |
82 | getString("_UI_SchedulingPolicyChoice_chosenValue_feature"), |
83 | getString("_UI_PropertyDescriptor_description", "_UI_SchedulingPolicyChoice_chosenValue_feature", "_UI_SchedulingPolicyChoice_type"), |
84 | designdecisionPackage.Literals.SCHEDULING_POLICY_CHOICE__CHOSEN_VALUE, |
85 | true, |
86 | false, |
87 | false, |
88 | ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, |
89 | null, |
90 | null)); |
91 | } |
92 | |
93 | /** |
94 | * This returns SchedulingPolicyChoice.gif. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @generated |
98 | */ |
99 | @Override |
100 | public Object getImage(Object object) { |
101 | return overlayImage(object, getResourceLocator().getImage("full/obj16/SchedulingPolicyChoice")); |
102 | } |
103 | |
104 | /** |
105 | * This returns the label text for the adapted class. |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | public String getText(Object object) { |
112 | SchedulingPolicyChoice schedulingPolicyChoice = (SchedulingPolicyChoice)object; |
113 | return getString("_UI_SchedulingPolicyChoice_type") + " " + schedulingPolicyChoice.isActive(); |
114 | } |
115 | |
116 | /** |
117 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
118 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | @Override |
124 | public void notifyChanged(Notification notification) { |
125 | updateChildren(notification); |
126 | |
127 | switch (notification.getFeatureID(SchedulingPolicyChoice.class)) { |
128 | case designdecisionPackage.SCHEDULING_POLICY_CHOICE__CHOSEN_VALUE: |
129 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
130 | return; |
131 | } |
132 | super.notifyChanged(notification); |
133 | } |
134 | |
135 | /** |
136 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
137 | * that can be created under this object. |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | @Override |
143 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
144 | super.collectNewChildDescriptors(newChildDescriptors, object); |
145 | } |
146 | |
147 | } |