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.Event;
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.edit.provider.ComposeableAdapterFactory;
021: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
022: import org.eclipse.emf.edit.provider.IItemLabelProvider;
023: import org.eclipse.emf.edit.provider.IItemPropertySource;
024: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
025: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
026: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
027: import org.eclipse.emf.edit.provider.ViewerNotification;
028:
029: /**
030: * This is the item provider adapter for a {@link newprocess.Event} object.
031: * <!-- begin-user-doc -->
032: * <!-- end-user-doc -->
033: * @generated
034: */
035: public class EventItemProvider extends ElementItemProvider implements
036: IEditingDomainItemProvider, IStructuredItemContentProvider,
037: ITreeItemContentProvider, IItemLabelProvider,
038: IItemPropertySource {
039: /**
040: * This constructs an instance from a factory and a notifier.
041: * <!-- begin-user-doc -->
042: * <!-- end-user-doc -->
043: * @generated
044: */
045: public EventItemProvider(AdapterFactory adapterFactory) {
046: super (adapterFactory);
047: }
048:
049: /**
050: * This returns the property descriptors for the adapted class.
051: * <!-- begin-user-doc -->
052: * <!-- end-user-doc -->
053: * @generated
054: */
055: public List getPropertyDescriptors(Object object) {
056: if (itemPropertyDescriptors == null) {
057: super .getPropertyDescriptors(object);
058:
059: addReentrantPropertyDescriptor(object);
060: }
061: return itemPropertyDescriptors;
062: }
063:
064: /**
065: * This adds a property descriptor for the Reentrant feature.
066: * <!-- begin-user-doc -->
067: * <!-- end-user-doc -->
068: * @generated
069: */
070: protected void addReentrantPropertyDescriptor(Object object) {
071: itemPropertyDescriptors
072: .add(createItemPropertyDescriptor(
073: ((ComposeableAdapterFactory) adapterFactory)
074: .getRootAdapterFactory(),
075: getResourceLocator(),
076: getString("_UI_Event_reentrant_feature"),
077: getString("_UI_PropertyDescriptor_description",
078: "_UI_Event_reentrant_feature",
079: "_UI_Event_type"),
080: NewprocessPackage.Literals.EVENT__REENTRANT,
081: true, false, false,
082: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
083: null, null));
084: }
085:
086: /**
087: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
088: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
089: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
090: * <!-- begin-user-doc -->
091: * <!-- end-user-doc -->
092: * @generated
093: */
094: public Collection getChildrenFeatures(Object object) {
095: if (childrenFeatures == null) {
096: super .getChildrenFeatures(object);
097: childrenFeatures
098: .add(NewprocessPackage.Literals.EVENT__HAS_POSTCONDITION);
099: }
100: return childrenFeatures;
101: }
102:
103: /**
104: * This returns Event.gif.
105: * <!-- begin-user-doc -->
106: * <!-- end-user-doc -->
107: * @generated
108: */
109: public Object getImage(Object object) {
110: return overlayImage(object, getResourceLocator().getImage(
111: "full/obj16/Event"));
112: }
113:
114: /**
115: * This returns the label text for the adapted class.
116: * <!-- begin-user-doc -->
117: * <!-- end-user-doc -->
118: * @generated
119: */
120: public String getText(Object object) {
121: String label = ((Event) object).getName();
122: return label == null || label.length() == 0 ? getString("_UI_Event_type")
123: : getString("_UI_Event_type") + " " + label;
124: }
125:
126: /**
127: * This handles model notifications by calling {@link #updateChildren} to update any cached
128: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
129: * <!-- begin-user-doc -->
130: * <!-- end-user-doc -->
131: * @generated
132: */
133: public void notifyChanged(Notification notification) {
134: updateChildren(notification);
135:
136: switch (notification.getFeatureID(Event.class)) {
137: case NewprocessPackage.EVENT__REENTRANT:
138: fireNotifyChanged(new ViewerNotification(notification,
139: notification.getNotifier(), false, true));
140: return;
141: case NewprocessPackage.EVENT__HAS_POSTCONDITION:
142: fireNotifyChanged(new ViewerNotification(notification,
143: notification.getNotifier(), true, false));
144: return;
145: }
146: super .notifyChanged(notification);
147: }
148:
149: /**
150: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
151: * describing all of the children that can be created under this object.
152: * <!-- begin-user-doc -->
153: * <!-- end-user-doc -->
154: * @generated
155: */
156: protected void collectNewChildDescriptors(
157: Collection newChildDescriptors, Object object) {
158: super .collectNewChildDescriptors(newChildDescriptors, object);
159:
160: newChildDescriptors.add(createChildParameter(
161: NewprocessPackage.Literals.EVENT__HAS_POSTCONDITION,
162: NewprocessFactory.eINSTANCE.createExpression()));
163: }
164:
165: /**
166: * Return the resource locator for this item provider's resources.
167: * <!-- begin-user-doc -->
168: * <!-- end-user-doc -->
169: * @generated
170: */
171: public ResourceLocator getResourceLocator() {
172: return New_processEditPlugin.INSTANCE;
173: }
174:
175: }
|