001: /**
002: * <copyright>
003: * </copyright>
004: *
005: * $Id$
006: */package newprocess.provider;
007:
008: import java.util.Collection;
009: import java.util.List;
010:
011: import newprocess.AsyncActivity;
012: import newprocess.NewprocessFactory;
013: import newprocess.NewprocessPackage;
014:
015: import org.eclipse.emf.common.notify.AdapterFactory;
016: import org.eclipse.emf.common.notify.Notification;
017:
018: import org.eclipse.emf.common.util.ResourceLocator;
019:
020: import org.eclipse.emf.ecore.EStructuralFeature;
021:
022: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
023: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
024: import org.eclipse.emf.edit.provider.IItemLabelProvider;
025: import org.eclipse.emf.edit.provider.IItemPropertySource;
026: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
027: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
028: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
029: import org.eclipse.emf.edit.provider.ViewerNotification;
030:
031: /**
032: * This is the item provider adapter for a {@link newprocess.AsyncActivity} object.
033: * <!-- begin-user-doc -->
034: * <!-- end-user-doc -->
035: * @generated
036: */
037: public class AsyncActivityItemProvider extends ElementItemProvider
038: implements IEditingDomainItemProvider,
039: IStructuredItemContentProvider, ITreeItemContentProvider,
040: IItemLabelProvider, IItemPropertySource {
041: /**
042: * This constructs an instance from a factory and a notifier.
043: * <!-- begin-user-doc -->
044: * <!-- end-user-doc -->
045: * @generated
046: */
047: public AsyncActivityItemProvider(AdapterFactory adapterFactory) {
048: super (adapterFactory);
049: }
050:
051: /**
052: * This returns the property descriptors for the adapted class.
053: * <!-- begin-user-doc -->
054: * <!-- end-user-doc -->
055: * @generated
056: */
057: public List getPropertyDescriptors(Object object) {
058: if (itemPropertyDescriptors == null) {
059: super .getPropertyDescriptors(object);
060:
061: addOptionalPropertyDescriptor(object);
062: addTimeoutPropertyDescriptor(object);
063: addActorPropertyDescriptor(object);
064: addReentrantPropertyDescriptor(object);
065: }
066: return itemPropertyDescriptors;
067: }
068:
069: /**
070: * This adds a property descriptor for the Optional feature.
071: * <!-- begin-user-doc -->
072: * <!-- end-user-doc -->
073: * @generated
074: */
075: protected void addOptionalPropertyDescriptor(Object object) {
076: itemPropertyDescriptors
077: .add(createItemPropertyDescriptor(
078: ((ComposeableAdapterFactory) adapterFactory)
079: .getRootAdapterFactory(),
080: getResourceLocator(),
081: getString("_UI_AsyncActivity_optional_feature"),
082: getString("_UI_PropertyDescriptor_description",
083: "_UI_AsyncActivity_optional_feature",
084: "_UI_AsyncActivity_type"),
085: NewprocessPackage.Literals.ASYNC_ACTIVITY__OPTIONAL,
086: true, false, false,
087: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
088: null, null));
089: }
090:
091: /**
092: * This adds a property descriptor for the Timeout feature.
093: * <!-- begin-user-doc -->
094: * <!-- end-user-doc -->
095: * @generated
096: */
097: protected void addTimeoutPropertyDescriptor(Object object) {
098: itemPropertyDescriptors
099: .add(createItemPropertyDescriptor(
100: ((ComposeableAdapterFactory) adapterFactory)
101: .getRootAdapterFactory(),
102: getResourceLocator(),
103: getString("_UI_AsyncActivity_timeout_feature"),
104: getString("_UI_PropertyDescriptor_description",
105: "_UI_AsyncActivity_timeout_feature",
106: "_UI_AsyncActivity_type"),
107: NewprocessPackage.Literals.ASYNC_ACTIVITY__TIMEOUT,
108: true, false, false,
109: ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
110: null, null));
111: }
112:
113: /**
114: * This adds a property descriptor for the Actor feature.
115: * <!-- begin-user-doc -->
116: * <!-- end-user-doc -->
117: * @generated
118: */
119: protected void addActorPropertyDescriptor(Object object) {
120: itemPropertyDescriptors.add(createItemPropertyDescriptor(
121: ((ComposeableAdapterFactory) adapterFactory)
122: .getRootAdapterFactory(), getResourceLocator(),
123: getString("_UI_AsyncActivity_actor_feature"),
124: getString("_UI_PropertyDescriptor_description",
125: "_UI_AsyncActivity_actor_feature",
126: "_UI_AsyncActivity_type"),
127: NewprocessPackage.Literals.ASYNC_ACTIVITY__ACTOR,
128: false, false, true, null, null, null));
129: }
130:
131: /**
132: * This adds a property descriptor for the Reentrant feature.
133: * <!-- begin-user-doc -->
134: * <!-- end-user-doc -->
135: * @generated
136: */
137: protected void addReentrantPropertyDescriptor(Object object) {
138: itemPropertyDescriptors
139: .add(createItemPropertyDescriptor(
140: ((ComposeableAdapterFactory) adapterFactory)
141: .getRootAdapterFactory(),
142: getResourceLocator(),
143: getString("_UI_AsyncActivity_reentrant_feature"),
144: getString("_UI_PropertyDescriptor_description",
145: "_UI_AsyncActivity_reentrant_feature",
146: "_UI_AsyncActivity_type"),
147: NewprocessPackage.Literals.ASYNC_ACTIVITY__REENTRANT,
148: true, false, false,
149: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
150: null, null));
151: }
152:
153: /**
154: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
155: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
156: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
157: * <!-- begin-user-doc -->
158: * <!-- end-user-doc -->
159: * @generated
160: */
161: public Collection getChildrenFeatures(Object object) {
162: if (childrenFeatures == null) {
163: super .getChildrenFeatures(object);
164: childrenFeatures
165: .add(NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_POSTCONDITION);
166: childrenFeatures
167: .add(NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_PRECONDITION);
168: }
169: return childrenFeatures;
170: }
171:
172: /**
173: * <!-- begin-user-doc -->
174: * <!-- end-user-doc -->
175: * @generated
176: */
177: protected EStructuralFeature getChildFeature(Object object,
178: Object child) {
179: // Check the type of the specified child object and return the proper feature to use for
180: // adding (see {@link AddCommand}) it as a child.
181:
182: return super .getChildFeature(object, child);
183: }
184:
185: /**
186: * This returns AsyncActivity.gif.
187: * <!-- begin-user-doc -->
188: * <!-- end-user-doc -->
189: * @generated
190: */
191: public Object getImage(Object object) {
192: return overlayImage(object, getResourceLocator().getImage(
193: "full/obj16/AsyncActivity"));
194: }
195:
196: /**
197: * This returns the label text for the adapted class.
198: * <!-- begin-user-doc -->
199: * <!-- end-user-doc -->
200: * @generated
201: */
202: public String getText(Object object) {
203: String label = ((AsyncActivity) object).getName();
204: return label == null || label.length() == 0 ? getString("_UI_AsyncActivity_type")
205: : getString("_UI_AsyncActivity_type") + " " + label;
206: }
207:
208: /**
209: * This handles model notifications by calling {@link #updateChildren} to update any cached
210: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
211: * <!-- begin-user-doc -->
212: * <!-- end-user-doc -->
213: * @generated
214: */
215: public void notifyChanged(Notification notification) {
216: updateChildren(notification);
217:
218: switch (notification.getFeatureID(AsyncActivity.class)) {
219: case NewprocessPackage.ASYNC_ACTIVITY__OPTIONAL:
220: case NewprocessPackage.ASYNC_ACTIVITY__TIMEOUT:
221: case NewprocessPackage.ASYNC_ACTIVITY__REENTRANT:
222: fireNotifyChanged(new ViewerNotification(notification,
223: notification.getNotifier(), false, true));
224: return;
225: case NewprocessPackage.ASYNC_ACTIVITY__HAS_POSTCONDITION:
226: case NewprocessPackage.ASYNC_ACTIVITY__HAS_PRECONDITION:
227: fireNotifyChanged(new ViewerNotification(notification,
228: notification.getNotifier(), true, false));
229: return;
230: }
231: super .notifyChanged(notification);
232: }
233:
234: /**
235: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
236: * describing all of the children that can be created under this object.
237: * <!-- begin-user-doc -->
238: * <!-- end-user-doc -->
239: * @generated
240: */
241: protected void collectNewChildDescriptors(
242: Collection newChildDescriptors, Object object) {
243: super .collectNewChildDescriptors(newChildDescriptors, object);
244:
245: newChildDescriptors
246: .add(createChildParameter(
247: NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_POSTCONDITION,
248: NewprocessFactory.eINSTANCE.createExpression()));
249:
250: newChildDescriptors
251: .add(createChildParameter(
252: NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_PRECONDITION,
253: NewprocessFactory.eINSTANCE.createExpression()));
254: }
255:
256: /**
257: * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
258: * <!-- begin-user-doc -->
259: * <!-- end-user-doc -->
260: * @generated
261: */
262: public String getCreateChildText(Object owner, Object feature,
263: Object child, Collection selection) {
264: Object childFeature = feature;
265: Object childObject = child;
266:
267: boolean qualify = childFeature == NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_POSTCONDITION
268: || childFeature == NewprocessPackage.Literals.ASYNC_ACTIVITY__HAS_PRECONDITION;
269:
270: if (qualify) {
271: return getString("_UI_CreateChild_text2", new Object[] {
272: getTypeText(childObject),
273: getFeatureText(childFeature), getTypeText(owner) });
274: }
275: return super .getCreateChildText(owner, feature, child,
276: selection);
277: }
278:
279: /**
280: * Return the resource locator for this item provider's resources.
281: * <!-- begin-user-doc -->
282: * <!-- end-user-doc -->
283: * @generated
284: */
285: public ResourceLocator getResourceLocator() {
286: return New_processEditPlugin.INSTANCE;
287: }
288:
289: }
|