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.Condition;
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.Condition} object.
030: * <!-- begin-user-doc -->
031: * <!-- end-user-doc -->
032: * @generated
033: */
034: public class ConditionItemProvider extends ElementItemProvider
035: implements IEditingDomainItemProvider,
036: IStructuredItemContentProvider, ITreeItemContentProvider,
037: IItemLabelProvider, 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 ConditionItemProvider(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: addTemporalPropertyDescriptor(object);
059: addTaggedPropertyDescriptor(object);
060: }
061: return itemPropertyDescriptors;
062: }
063:
064: /**
065: * This adds a property descriptor for the Temporal feature.
066: * <!-- begin-user-doc -->
067: * <!-- end-user-doc -->
068: * @generated
069: */
070: protected void addTemporalPropertyDescriptor(Object object) {
071: itemPropertyDescriptors
072: .add(createItemPropertyDescriptor(
073: ((ComposeableAdapterFactory) adapterFactory)
074: .getRootAdapterFactory(),
075: getResourceLocator(),
076: getString("_UI_Condition_temporal_feature"),
077: getString("_UI_PropertyDescriptor_description",
078: "_UI_Condition_temporal_feature",
079: "_UI_Condition_type"),
080: NewprocessPackage.Literals.CONDITION__TEMPORAL,
081: true, false, false,
082: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
083: null, null));
084: }
085:
086: /**
087: * This adds a property descriptor for the Tagged feature.
088: * <!-- begin-user-doc -->
089: * <!-- end-user-doc -->
090: * @generated
091: */
092: protected void addTaggedPropertyDescriptor(Object object) {
093: itemPropertyDescriptors
094: .add(createItemPropertyDescriptor(
095: ((ComposeableAdapterFactory) adapterFactory)
096: .getRootAdapterFactory(),
097: getResourceLocator(),
098: getString("_UI_Condition_tagged_feature"),
099: getString("_UI_PropertyDescriptor_description",
100: "_UI_Condition_tagged_feature",
101: "_UI_Condition_type"),
102: NewprocessPackage.Literals.CONDITION__TAGGED,
103: true, false, false,
104: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
105: null, null));
106: }
107:
108: /**
109: * This returns Condition.gif.
110: * <!-- begin-user-doc -->
111: * <!-- end-user-doc -->
112: * @generated
113: */
114: public Object getImage(Object object) {
115: return overlayImage(object, getResourceLocator().getImage(
116: "full/obj16/Condition"));
117: }
118:
119: /**
120: * This returns the label text for the adapted class.
121: * <!-- begin-user-doc -->
122: * <!-- end-user-doc -->
123: * @generated
124: */
125: public String getText(Object object) {
126: String label = ((Condition) object).getName();
127: return label == null || label.length() == 0 ? getString("_UI_Condition_type")
128: : getString("_UI_Condition_type") + " " + label;
129: }
130:
131: /**
132: * This handles model notifications by calling {@link #updateChildren} to update any cached
133: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
134: * <!-- begin-user-doc -->
135: * <!-- end-user-doc -->
136: * @generated
137: */
138: public void notifyChanged(Notification notification) {
139: updateChildren(notification);
140:
141: switch (notification.getFeatureID(Condition.class)) {
142: case NewprocessPackage.CONDITION__TEMPORAL:
143: case NewprocessPackage.CONDITION__TAGGED:
144: fireNotifyChanged(new ViewerNotification(notification,
145: notification.getNotifier(), false, true));
146: return;
147: }
148: super .notifyChanged(notification);
149: }
150:
151: /**
152: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
153: * describing all of the children that can be created under this object.
154: * <!-- begin-user-doc -->
155: * <!-- end-user-doc -->
156: * @generated
157: */
158: protected void collectNewChildDescriptors(
159: Collection newChildDescriptors, Object object) {
160: super .collectNewChildDescriptors(newChildDescriptors, object);
161: }
162:
163: /**
164: * Return the resource locator for this item provider's resources.
165: * <!-- begin-user-doc -->
166: * <!-- end-user-doc -->
167: * @generated
168: */
169: public ResourceLocator getResourceLocator() {
170: return New_processEditPlugin.INSTANCE;
171: }
172:
173: }
|