1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.provider; |
8 | |
9 | |
10 | import EssentialOCL.EssentialOCLPackage; |
11 | import EssentialOCL.IteratorExp; |
12 | |
13 | import java.util.Collection; |
14 | import java.util.List; |
15 | |
16 | import org.eclipse.emf.common.notify.AdapterFactory; |
17 | import org.eclipse.emf.common.notify.Notification; |
18 | |
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 | |
26 | /** |
27 | * This is the item provider adapter for a {@link EssentialOCL.IteratorExp} object. |
28 | * <!-- begin-user-doc --> |
29 | * <!-- end-user-doc --> |
30 | * @generated |
31 | */ |
32 | public class IteratorExpItemProvider |
33 | extends LoopExpItemProvider |
34 | implements |
35 | IEditingDomainItemProvider, |
36 | IStructuredItemContentProvider, |
37 | ITreeItemContentProvider, |
38 | IItemLabelProvider, |
39 | IItemPropertySource { |
40 | /** |
41 | * This constructs an instance from a factory and a notifier. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public IteratorExpItemProvider(AdapterFactory adapterFactory) { |
47 | super(adapterFactory); |
48 | } |
49 | |
50 | /** |
51 | * This returns the property descriptors for the adapted class. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @generated |
55 | */ |
56 | @Override |
57 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
58 | if (itemPropertyDescriptors == null) { |
59 | super.getPropertyDescriptors(object); |
60 | |
61 | } |
62 | return itemPropertyDescriptors; |
63 | } |
64 | |
65 | /** |
66 | * This returns IteratorExp.gif. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | @Override |
72 | public Object getImage(Object object) { |
73 | return overlayImage(object, getResourceLocator().getImage("full/obj16/IteratorExp")); |
74 | } |
75 | |
76 | /** |
77 | * This returns the label text for the adapted class. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | public String getText(Object object) { |
84 | String label = ((IteratorExp)object).getName(); |
85 | return label == null || label.length() == 0 ? |
86 | getString("_UI_IteratorExp_type") : |
87 | getString("_UI_IteratorExp_type") + " " + label; |
88 | } |
89 | |
90 | /** |
91 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
92 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | public void notifyChanged(Notification notification) { |
99 | updateChildren(notification); |
100 | super.notifyChanged(notification); |
101 | } |
102 | |
103 | /** |
104 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
105 | * that can be created under this object. |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
112 | super.collectNewChildDescriptors(newChildDescriptors, object); |
113 | } |
114 | |
115 | /** |
116 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
117 | * <!-- begin-user-doc --> |
118 | * <!-- end-user-doc --> |
119 | * @generated |
120 | */ |
121 | @Override |
122 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
123 | Object childFeature = feature; |
124 | Object childObject = child; |
125 | |
126 | boolean qualify = |
127 | childFeature == EssentialOCLPackage.Literals.CALL_EXP__SOURCE || |
128 | childFeature == EssentialOCLPackage.Literals.LOOP_EXP__BODY; |
129 | |
130 | if (qualify) { |
131 | return getString |
132 | ("_UI_CreateChild_text2", |
133 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
134 | } |
135 | return super.getCreateChildText(owner, feature, child, selection); |
136 | } |
137 | |
138 | } |