1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package edu.kit.ipd.sdq.completionfeaturemodel.provider; |
8 | |
9 | |
10 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
11 | |
12 | import de.uka.ipd.sdq.featuremodel.provider.SimpleItemProvider; |
13 | |
14 | import edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelFactory; |
15 | |
16 | import java.util.Collection; |
17 | import java.util.List; |
18 | |
19 | import org.eclipse.emf.common.notify.AdapterFactory; |
20 | import org.eclipse.emf.common.notify.Notification; |
21 | |
22 | import org.eclipse.emf.common.util.ResourceLocator; |
23 | |
24 | import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; |
25 | import org.eclipse.emf.edit.provider.IItemColorProvider; |
26 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
27 | import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
28 | import org.eclipse.emf.edit.provider.IItemPropertySource; |
29 | import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; |
30 | import org.eclipse.emf.edit.provider.ITreeItemContentProvider; |
31 | |
32 | /** |
33 | * This is the item provider adapter for a {@link edu.kit.ipd.sdq.completionfeaturemodel.CompletionSimple} object. |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @generated |
37 | */ |
38 | public class CompletionSimpleItemProvider |
39 | extends SimpleItemProvider |
40 | implements |
41 | IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, IItemColorProvider { |
42 | /** |
43 | * This constructs an instance from a factory and a notifier. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public CompletionSimpleItemProvider(AdapterFactory adapterFactory) { |
49 | super(adapterFactory); |
50 | } |
51 | |
52 | /** |
53 | * This returns the property descriptors for the adapted class. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | @Override |
59 | public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { |
60 | if (itemPropertyDescriptors == null) { |
61 | super.getPropertyDescriptors(object); |
62 | |
63 | } |
64 | return itemPropertyDescriptors; |
65 | } |
66 | |
67 | /** |
68 | * This returns CompletionSimple.gif. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | @Override |
74 | public Object getImage(Object object) { |
75 | return overlayImage(object, getResourceLocator().getImage("full/obj16/CompletionSimple")); |
76 | } |
77 | |
78 | /** |
79 | * This returns the label text for the adapted class. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | @Override |
85 | public String getText(Object object) { |
86 | return getString("_UI_CompletionSimple_type"); |
87 | } |
88 | |
89 | /** |
90 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
91 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
92 | * <!-- begin-user-doc --> |
93 | * <!-- end-user-doc --> |
94 | * @generated |
95 | */ |
96 | @Override |
97 | public void notifyChanged(Notification notification) { |
98 | updateChildren(notification); |
99 | super.notifyChanged(notification); |
100 | } |
101 | |
102 | /** |
103 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
104 | * that can be created under this object. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | @Override |
110 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
111 | super.collectNewChildDescriptors(newChildDescriptors, object); |
112 | |
113 | newChildDescriptors.add |
114 | (createChildParameter |
115 | (featuremodelPackage.Literals.SIMPLE__OPTIONAL_CHILDREN, |
116 | completionfeaturemodelFactory.eINSTANCE.createCompletionFeature())); |
117 | |
118 | newChildDescriptors.add |
119 | (createChildParameter |
120 | (featuremodelPackage.Literals.SIMPLE__MANDATORY_CHILDREN, |
121 | completionfeaturemodelFactory.eINSTANCE.createCompletionFeature())); |
122 | } |
123 | |
124 | /** |
125 | * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | @Override |
131 | public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { |
132 | Object childFeature = feature; |
133 | Object childObject = child; |
134 | |
135 | boolean qualify = |
136 | childFeature == featuremodelPackage.Literals.SIMPLE__OPTIONAL_CHILDREN || |
137 | childFeature == featuremodelPackage.Literals.SIMPLE__MANDATORY_CHILDREN; |
138 | |
139 | if (qualify) { |
140 | return getString |
141 | ("_UI_CreateChild_text2", |
142 | new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); |
143 | } |
144 | return super.getCreateChildText(owner, feature, child, selection); |
145 | } |
146 | |
147 | /** |
148 | * Return the resource locator for this item provider's resources. |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | @Override |
154 | public ResourceLocator getResourceLocator() { |
155 | return CompletionfeaturemodelEditPlugin.INSTANCE; |
156 | } |
157 | |
158 | } |