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.Expansion;
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.ViewerNotification;
027:
028: /**
029: * This is the item provider adapter for a {@link newprocess.Expansion} object.
030: * <!-- begin-user-doc -->
031: * <!-- end-user-doc -->
032: * @generated
033: */
034: public class ExpansionItemProvider 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 ExpansionItemProvider(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: addExpansionProxyPropertyDescriptor(object);
059: }
060: return itemPropertyDescriptors;
061: }
062:
063: /**
064: * This adds a property descriptor for the Expansion Proxy feature.
065: * <!-- begin-user-doc -->
066: * <!-- end-user-doc -->
067: * @generated
068: */
069: protected void addExpansionProxyPropertyDescriptor(Object object) {
070: itemPropertyDescriptors.add(createItemPropertyDescriptor(
071: ((ComposeableAdapterFactory) adapterFactory)
072: .getRootAdapterFactory(), getResourceLocator(),
073: getString("_UI_Expansion_expansionProxy_feature"),
074: getString("_UI_PropertyDescriptor_description",
075: "_UI_Expansion_expansionProxy_feature",
076: "_UI_Expansion_type"),
077: NewprocessPackage.Literals.EXPANSION__EXPANSION_PROXY,
078: false, false, true, null, null, null));
079: }
080:
081: /**
082: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
083: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
084: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
085: * <!-- begin-user-doc -->
086: * <!-- end-user-doc -->
087: * @generated
088: */
089: public Collection getChildrenFeatures(Object object) {
090: if (childrenFeatures == null) {
091: super .getChildrenFeatures(object);
092: childrenFeatures
093: .add(NewprocessPackage.Literals.EXPANSION__HAS_POSTCONDITION);
094: }
095: return childrenFeatures;
096: }
097:
098: /**
099: * This returns Expansion.gif.
100: * <!-- begin-user-doc -->
101: * <!-- end-user-doc -->
102: * @generated
103: */
104: public Object getImage(Object object) {
105: return overlayImage(object, getResourceLocator().getImage(
106: "full/obj16/Expansion"));
107: }
108:
109: /**
110: * This returns the label text for the adapted class.
111: * <!-- begin-user-doc -->
112: * <!-- end-user-doc -->
113: * @generated
114: */
115: public String getText(Object object) {
116: String label = ((Expansion) object).getName();
117: return label == null || label.length() == 0 ? getString("_UI_Expansion_type")
118: : getString("_UI_Expansion_type") + " " + label;
119: }
120:
121: /**
122: * This handles model notifications by calling {@link #updateChildren} to update any cached
123: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
124: * <!-- begin-user-doc -->
125: * <!-- end-user-doc -->
126: * @generated
127: */
128: public void notifyChanged(Notification notification) {
129: updateChildren(notification);
130:
131: switch (notification.getFeatureID(Expansion.class)) {
132: case NewprocessPackage.EXPANSION__HAS_POSTCONDITION:
133: fireNotifyChanged(new ViewerNotification(notification,
134: notification.getNotifier(), true, false));
135: return;
136: }
137: super .notifyChanged(notification);
138: }
139:
140: /**
141: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
142: * describing all of the children that can be created under this object.
143: * <!-- begin-user-doc -->
144: * <!-- end-user-doc -->
145: * @generated
146: */
147: protected void collectNewChildDescriptors(
148: Collection newChildDescriptors, Object object) {
149: super .collectNewChildDescriptors(newChildDescriptors, object);
150:
151: newChildDescriptors
152: .add(createChildParameter(
153: NewprocessPackage.Literals.EXPANSION__HAS_POSTCONDITION,
154: NewprocessFactory.eINSTANCE.createExpression()));
155: }
156:
157: /**
158: * Return the resource locator for this item provider's resources.
159: * <!-- begin-user-doc -->
160: * <!-- end-user-doc -->
161: * @generated
162: */
163: public ResourceLocator getResourceLocator() {
164: return New_processEditPlugin.INSTANCE;
165: }
166:
167: }
|