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.NewprocessFactory;
012: import newprocess.NewprocessPackage;
013: import newprocess.SyncActivity;
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.SyncActivity} object.
033: * <!-- begin-user-doc -->
034: * <!-- end-user-doc -->
035: * @generated
036: */
037: public class SyncActivityItemProvider 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 SyncActivityItemProvider(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: addTrialsPropertyDescriptor(object);
062: addRetryDelayPropertyDescriptor(object);
063: addReentrantPropertyDescriptor(object);
064: }
065: return itemPropertyDescriptors;
066: }
067:
068: /**
069: * This adds a property descriptor for the Trials feature.
070: * <!-- begin-user-doc -->
071: * <!-- end-user-doc -->
072: * @generated
073: */
074: protected void addTrialsPropertyDescriptor(Object object) {
075: itemPropertyDescriptors
076: .add(createItemPropertyDescriptor(
077: ((ComposeableAdapterFactory) adapterFactory)
078: .getRootAdapterFactory(),
079: getResourceLocator(),
080: getString("_UI_SyncActivity_trials_feature"),
081: getString("_UI_PropertyDescriptor_description",
082: "_UI_SyncActivity_trials_feature",
083: "_UI_SyncActivity_type"),
084: NewprocessPackage.Literals.SYNC_ACTIVITY__TRIALS,
085: true, false, false,
086: ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
087: null, null));
088: }
089:
090: /**
091: * This adds a property descriptor for the Retry Delay feature.
092: * <!-- begin-user-doc -->
093: * <!-- end-user-doc -->
094: * @generated
095: */
096: protected void addRetryDelayPropertyDescriptor(Object object) {
097: itemPropertyDescriptors
098: .add(createItemPropertyDescriptor(
099: ((ComposeableAdapterFactory) adapterFactory)
100: .getRootAdapterFactory(),
101: getResourceLocator(),
102: getString("_UI_SyncActivity_retryDelay_feature"),
103: getString("_UI_PropertyDescriptor_description",
104: "_UI_SyncActivity_retryDelay_feature",
105: "_UI_SyncActivity_type"),
106: NewprocessPackage.Literals.SYNC_ACTIVITY__RETRY_DELAY,
107: true, false, false,
108: ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
109: null, null));
110: }
111:
112: /**
113: * This adds a property descriptor for the Reentrant feature.
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @generated
117: */
118: protected void addReentrantPropertyDescriptor(Object object) {
119: itemPropertyDescriptors
120: .add(createItemPropertyDescriptor(
121: ((ComposeableAdapterFactory) adapterFactory)
122: .getRootAdapterFactory(),
123: getResourceLocator(),
124: getString("_UI_SyncActivity_reentrant_feature"),
125: getString("_UI_PropertyDescriptor_description",
126: "_UI_SyncActivity_reentrant_feature",
127: "_UI_SyncActivity_type"),
128: NewprocessPackage.Literals.SYNC_ACTIVITY__REENTRANT,
129: true, false, false,
130: ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
131: null, null));
132: }
133:
134: /**
135: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
136: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
137: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
138: * <!-- begin-user-doc -->
139: * <!-- end-user-doc -->
140: * @generated
141: */
142: public Collection getChildrenFeatures(Object object) {
143: if (childrenFeatures == null) {
144: super .getChildrenFeatures(object);
145: childrenFeatures
146: .add(NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_POSTCONDITION);
147: childrenFeatures
148: .add(NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_PRECONDITION);
149: }
150: return childrenFeatures;
151: }
152:
153: /**
154: * <!-- begin-user-doc -->
155: * <!-- end-user-doc -->
156: * @generated
157: */
158: protected EStructuralFeature getChildFeature(Object object,
159: Object child) {
160: // Check the type of the specified child object and return the proper feature to use for
161: // adding (see {@link AddCommand}) it as a child.
162:
163: return super .getChildFeature(object, child);
164: }
165:
166: /**
167: * This returns SyncActivity.gif.
168: * <!-- begin-user-doc -->
169: * <!-- end-user-doc -->
170: * @generated
171: */
172: public Object getImage(Object object) {
173: return overlayImage(object, getResourceLocator().getImage(
174: "full/obj16/SyncActivity"));
175: }
176:
177: /**
178: * This returns the label text for the adapted class.
179: * <!-- begin-user-doc -->
180: * <!-- end-user-doc -->
181: * @generated
182: */
183: public String getText(Object object) {
184: String label = ((SyncActivity) object).getName();
185: return label == null || label.length() == 0 ? getString("_UI_SyncActivity_type")
186: : getString("_UI_SyncActivity_type") + " " + label;
187: }
188:
189: /**
190: * This handles model notifications by calling {@link #updateChildren} to update any cached
191: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
192: * <!-- begin-user-doc -->
193: * <!-- end-user-doc -->
194: * @generated
195: */
196: public void notifyChanged(Notification notification) {
197: updateChildren(notification);
198:
199: switch (notification.getFeatureID(SyncActivity.class)) {
200: case NewprocessPackage.SYNC_ACTIVITY__TRIALS:
201: case NewprocessPackage.SYNC_ACTIVITY__RETRY_DELAY:
202: case NewprocessPackage.SYNC_ACTIVITY__REENTRANT:
203: fireNotifyChanged(new ViewerNotification(notification,
204: notification.getNotifier(), false, true));
205: return;
206: case NewprocessPackage.SYNC_ACTIVITY__HAS_POSTCONDITION:
207: case NewprocessPackage.SYNC_ACTIVITY__HAS_PRECONDITION:
208: fireNotifyChanged(new ViewerNotification(notification,
209: notification.getNotifier(), true, false));
210: return;
211: }
212: super .notifyChanged(notification);
213: }
214:
215: /**
216: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
217: * describing all of the children that can be created under this object.
218: * <!-- begin-user-doc -->
219: * <!-- end-user-doc -->
220: * @generated
221: */
222: protected void collectNewChildDescriptors(
223: Collection newChildDescriptors, Object object) {
224: super .collectNewChildDescriptors(newChildDescriptors, object);
225:
226: newChildDescriptors
227: .add(createChildParameter(
228: NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_POSTCONDITION,
229: NewprocessFactory.eINSTANCE.createExpression()));
230:
231: newChildDescriptors
232: .add(createChildParameter(
233: NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_PRECONDITION,
234: NewprocessFactory.eINSTANCE.createExpression()));
235: }
236:
237: /**
238: * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
239: * <!-- begin-user-doc -->
240: * <!-- end-user-doc -->
241: * @generated
242: */
243: public String getCreateChildText(Object owner, Object feature,
244: Object child, Collection selection) {
245: Object childFeature = feature;
246: Object childObject = child;
247:
248: boolean qualify = childFeature == NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_POSTCONDITION
249: || childFeature == NewprocessPackage.Literals.SYNC_ACTIVITY__HAS_PRECONDITION;
250:
251: if (qualify) {
252: return getString("_UI_CreateChild_text2", new Object[] {
253: getTypeText(childObject),
254: getFeatureText(childFeature), getTypeText(owner) });
255: }
256: return super .getCreateChildText(owner, feature, child,
257: selection);
258: }
259:
260: /**
261: * Return the resource locator for this item provider's resources.
262: * <!-- begin-user-doc -->
263: * <!-- end-user-doc -->
264: * @generated
265: */
266: public ResourceLocator getResourceLocator() {
267: return New_processEditPlugin.INSTANCE;
268: }
269:
270: }
|