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.Message;
012: import newprocess.NewprocessPackage;
013:
014: import org.eclipse.emf.common.notify.AdapterFactory;
015: import org.eclipse.emf.common.notify.Notification;
016:
017: import org.eclipse.emf.common.util.ResourceLocator;
018:
019: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
020: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
021: import org.eclipse.emf.edit.provider.IItemLabelProvider;
022: import org.eclipse.emf.edit.provider.IItemPropertySource;
023: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
024: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
025: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
026: import org.eclipse.emf.edit.provider.ViewerNotification;
027:
028: /**
029: * This is the item provider adapter for a {@link newprocess.Message} object.
030: * <!-- begin-user-doc -->
031: * <!-- end-user-doc -->
032: * @generated
033: */
034: public class MessageItemProvider extends ElementItemProvider implements
035: IEditingDomainItemProvider, IStructuredItemContentProvider,
036: ITreeItemContentProvider, IItemLabelProvider,
037: IItemPropertySource {
038: /**
039: * This constructs an instance from a factory and a notifier.
040: * <!-- begin-user-doc -->
041: * <!-- end-user-doc -->
042: * @generated
043: */
044: public MessageItemProvider(AdapterFactory adapterFactory) {
045: super (adapterFactory);
046: }
047:
048: /**
049: * This returns the property descriptors for the adapted class.
050: * <!-- begin-user-doc -->
051: * <!-- end-user-doc -->
052: * @generated
053: */
054: public List getPropertyDescriptors(Object object) {
055: if (itemPropertyDescriptors == null) {
056: super .getPropertyDescriptors(object);
057:
058: addDirectionPropertyDescriptor(object);
059: }
060: return itemPropertyDescriptors;
061: }
062:
063: /**
064: * This adds a property descriptor for the Direction feature.
065: * <!-- begin-user-doc -->
066: * <!-- end-user-doc -->
067: * @generated
068: */
069: protected void addDirectionPropertyDescriptor(Object object) {
070: itemPropertyDescriptors
071: .add(createItemPropertyDescriptor(
072: ((ComposeableAdapterFactory) adapterFactory)
073: .getRootAdapterFactory(),
074: getResourceLocator(),
075: getString("_UI_Message_direction_feature"),
076: getString("_UI_PropertyDescriptor_description",
077: "_UI_Message_direction_feature",
078: "_UI_Message_type"),
079: NewprocessPackage.Literals.MESSAGE__DIRECTION,
080: true, false, false,
081: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
082: null, null));
083: }
084:
085: /**
086: * This returns Message.gif.
087: * <!-- begin-user-doc -->
088: * <!-- end-user-doc -->
089: * @generated
090: */
091: public Object getImage(Object object) {
092: return overlayImage(object, getResourceLocator().getImage(
093: "full/obj16/Message"));
094: }
095:
096: /**
097: * This returns the label text for the adapted class.
098: * <!-- begin-user-doc -->
099: * <!-- end-user-doc -->
100: * @generated
101: */
102: public String getText(Object object) {
103: String label = ((Message) object).getName();
104: return label == null || label.length() == 0 ? getString("_UI_Message_type")
105: : getString("_UI_Message_type") + " " + label;
106: }
107:
108: /**
109: * This handles model notifications by calling {@link #updateChildren} to update any cached
110: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
111: * <!-- begin-user-doc -->
112: * <!-- end-user-doc -->
113: * @generated
114: */
115: public void notifyChanged(Notification notification) {
116: updateChildren(notification);
117:
118: switch (notification.getFeatureID(Message.class)) {
119: case NewprocessPackage.MESSAGE__DIRECTION:
120: fireNotifyChanged(new ViewerNotification(notification,
121: notification.getNotifier(), false, true));
122: return;
123: }
124: super .notifyChanged(notification);
125: }
126:
127: /**
128: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
129: * describing all of the children that can be created under this object.
130: * <!-- begin-user-doc -->
131: * <!-- end-user-doc -->
132: * @generated
133: */
134: protected void collectNewChildDescriptors(
135: Collection newChildDescriptors, Object object) {
136: super .collectNewChildDescriptors(newChildDescriptors, object);
137: }
138:
139: /**
140: * Return the resource locator for this item provider's resources.
141: * <!-- begin-user-doc -->
142: * <!-- end-user-doc -->
143: * @generated
144: */
145: public ResourceLocator getResourceLocator() {
146: return New_processEditPlugin.INSTANCE;
147: }
148:
149: }
|