1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.repository.provider; |
7 | |
8 | |
9 | import java.util.Collection; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.common.notify.AdapterFactory; |
13 | import org.eclipse.emf.common.notify.Notification; |
14 | import org.eclipse.emf.ecore.EStructuralFeature; |
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.ViewerNotification; |
23 | |
24 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
25 | import de.uka.ipd.sdq.pcm.repository.RepositoryFactory; |
26 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
27 | |
28 | /** |
29 | * This is the item provider adapter for a {@link de.uka.ipd.sdq.pcm.repository.OperationSignature} object. |
30 | * <!-- begin-user-doc --> |
31 | * <!-- end-user-doc --> |
32 | * @generated |
33 | */ |
34 | public class OperationSignatureItemProvider |
35 | extends SignatureItemProvider |
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 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
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 OperationSignatureItemProvider(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 | addReturnType__OperationSignaturePropertyDescriptor(object); |
71 | } |
72 | return itemPropertyDescriptors; |
73 | } |
74 | |
75 | /** |
76 | * This adds a property descriptor for the Return Type Operation Signature feature. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | protected void addReturnType__OperationSignaturePropertyDescriptor(Object object) { |
82 | itemPropertyDescriptors.add |
83 | (createItemPropertyDescriptor |
84 | (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), |
85 | getResourceLocator(), |
86 | getString("_UI_OperationSignature_returnType__OperationSignature_feature"), |
87 | getString("_UI_PropertyDescriptor_description", "_UI_OperationSignature_returnType__OperationSignature_feature", "_UI_OperationSignature_type"), |
88 | RepositoryPackage.Literals.OPERATION_SIGNATURE__RETURN_TYPE_OPERATION_SIGNATURE, |
89 | true, |
90 | false, |
91 | true, |
92 | null, |
93 | null, |
94 | null)); |
95 | } |
96 | |
97 | /** |
98 | * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an |
99 | * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or |
100 | * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { |
107 | if (childrenFeatures == null) { |
108 | super.getChildrenFeatures(object); |
109 | childrenFeatures.add(RepositoryPackage.Literals.OPERATION_SIGNATURE__PARAMETERS_OPERATION_SIGNATURE); |
110 | } |
111 | return childrenFeatures; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | @Override |
120 | protected EStructuralFeature getChildFeature(Object object, Object child) { |
121 | // Check the type of the specified child object and return the proper feature to use for |
122 | // adding (see {@link AddCommand}) it as a child. |
123 | |
124 | return super.getChildFeature(object, child); |
125 | } |
126 | |
127 | /** |
128 | * This returns OperationSignature.gif. |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | @Override |
134 | public Object getImage(Object object) { |
135 | return overlayImage(object, getResourceLocator().getImage("full/obj16/OperationSignature")); |
136 | } |
137 | |
138 | /** |
139 | * This returns the label text for the adapted class. |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | @Override |
145 | public String getText(Object object) { |
146 | String label = ((OperationSignature)object).getId(); |
147 | return label == null || label.length() == 0 ? |
148 | getString("_UI_OperationSignature_type") : |
149 | getString("_UI_OperationSignature_type") + " " + label; |
150 | } |
151 | |
152 | /** |
153 | * This handles model notifications by calling {@link #updateChildren} to update any cached |
154 | * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @generated |
158 | */ |
159 | @Override |
160 | public void notifyChanged(Notification notification) { |
161 | updateChildren(notification); |
162 | |
163 | switch (notification.getFeatureID(OperationSignature.class)) { |
164 | case RepositoryPackage.OPERATION_SIGNATURE__PARAMETERS_OPERATION_SIGNATURE: |
165 | fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); |
166 | return; |
167 | } |
168 | super.notifyChanged(notification); |
169 | } |
170 | |
171 | /** |
172 | * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children |
173 | * that can be created under this object. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { |
180 | super.collectNewChildDescriptors(newChildDescriptors, object); |
181 | |
182 | newChildDescriptors.add |
183 | (createChildParameter |
184 | (RepositoryPackage.Literals.OPERATION_SIGNATURE__PARAMETERS_OPERATION_SIGNATURE, |
185 | RepositoryFactory.eINSTANCE.createParameter())); |
186 | } |
187 | |
188 | } |