1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.stoex.provider; |
8 | |
9 | |
10 | import java.util.Collection; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.common.notify.AdapterFactory; |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
16 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
17 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
18 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
19 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
20 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
21 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
22 | import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
23 | import org.eclipse.emf.edit.provider.ViewerNotification; |
24 | |
25 | import de.uka.ipd.sdq.stoex.DoubleLiteral; |
26 | import de.uka.ipd.sdq.stoex.StoexPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.stoex.DoubleLiteral} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class DoubleLiteralItemProvider |
35 | extends NumericLiteralItemProvider |
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 DoubleLiteralItemProvider(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 | addValuePropertyDescriptor(object); |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This adds a property descriptor for the Value feature. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | protected void addValuePropertyDescriptor(Object object) { |
82 | itemPropertyDescriptors.add |
83 | (createItemPropertyDescriptor |
84 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
85 | getResourceLocator(), |
86 | getString("_UI_DoubleLiteral_value_feature"), |
87 | getString("_UI_PropertyDescriptor_description", "_UI_DoubleLiteral_value_feature", "_UI_DoubleLiteral_type"), |
88 | StoexPackage.Literals.DOUBLE_LITERAL__VALUE, |
89 | true, |
90 | false, |
91 | false, |
92 | ItemPropertyDescriptor.REAL_VALUE_IMAGE, |
93 | null, |
94 | null)); |
95 | } |
96 | |
97 | /** |
98 | * This returns DoubleLiteral.gif. |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | @Override |
104 | public Object getImage(Object object) { |
105 | return overlayImage(object, getResourceLocator().getImage("full/obj16/DoubleLiteral")); |
106 | } |
107 | |
108 | /** |
109 | * This returns the label text for the adapted class. |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | @Override |
115 | public String getText(Object object) { |
116 | String label = ((DoubleLiteral)object).getUnitSpecification(); |
117 | return label == null || label.length() == 0 ? |
118 | getString("_UI_DoubleLiteral_type") : |
119 | getString("_UI_DoubleLiteral_type") + " " + label; |
120 | } |
121 | |
122 | /** |
123 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
124 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | @Override |
130 | public void notifyChanged(Notification notification) { |
131 | updateChildren(notification); |
132 | |
133 | switch (notification.getFeatureID(DoubleLiteral.class)) { |
134 | case StoexPackage.DOUBLE_LITERAL__VALUE: |
135 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); |
136 | return; |
137 | } |
138 | super.notifyChanged(notification); |
139 | } |
140 | |
141 | /** |
142 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
143 | * that can be created under this object. |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
150 | super.collectNewChildDescriptors(newChildDescriptors, object); |
151 | } |
152 | |
153 | } |