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.EnvEntry;
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.ItemProviderAdapter;
027: import org.eclipse.emf.edit.provider.ViewerNotification;
028:
029: /**
030: * This is the item provider adapter for a {@link newprocess.EnvEntry} object.
031: * <!-- begin-user-doc -->
032: * <!-- end-user-doc -->
033: * @generated
034: */
035: public class EnvEntryItemProvider extends ItemProviderAdapter 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 EnvEntryItemProvider(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: addNamePropertyDescriptor(object);
060: addTypePropertyDescriptor(object);
061: addValuePropertyDescriptor(object);
062: }
063: return itemPropertyDescriptors;
064: }
065:
066: /**
067: * This adds a property descriptor for the Name feature.
068: * <!-- begin-user-doc -->
069: * <!-- end-user-doc -->
070: * @generated
071: */
072: protected void addNamePropertyDescriptor(Object object) {
073: itemPropertyDescriptors
074: .add(createItemPropertyDescriptor(
075: ((ComposeableAdapterFactory) adapterFactory)
076: .getRootAdapterFactory(),
077: getResourceLocator(),
078: getString("_UI_EnvEntry_name_feature"),
079: getString("_UI_PropertyDescriptor_description",
080: "_UI_EnvEntry_name_feature",
081: "_UI_EnvEntry_type"),
082: NewprocessPackage.Literals.ENV_ENTRY__NAME,
083: true, false, false,
084: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
085: null, null));
086: }
087:
088: /**
089: * This adds a property descriptor for the Type feature.
090: * <!-- begin-user-doc -->
091: * <!-- end-user-doc -->
092: * @generated
093: */
094: protected void addTypePropertyDescriptor(Object object) {
095: itemPropertyDescriptors
096: .add(createItemPropertyDescriptor(
097: ((ComposeableAdapterFactory) adapterFactory)
098: .getRootAdapterFactory(),
099: getResourceLocator(),
100: getString("_UI_EnvEntry_type_feature"),
101: getString("_UI_PropertyDescriptor_description",
102: "_UI_EnvEntry_type_feature",
103: "_UI_EnvEntry_type"),
104: NewprocessPackage.Literals.ENV_ENTRY__TYPE,
105: true, false, false,
106: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
107: null, null));
108: }
109:
110: /**
111: * This adds a property descriptor for the Value feature.
112: * <!-- begin-user-doc -->
113: * <!-- end-user-doc -->
114: * @generated
115: */
116: protected void addValuePropertyDescriptor(Object object) {
117: itemPropertyDescriptors
118: .add(createItemPropertyDescriptor(
119: ((ComposeableAdapterFactory) adapterFactory)
120: .getRootAdapterFactory(),
121: getResourceLocator(),
122: getString("_UI_EnvEntry_value_feature"),
123: getString("_UI_PropertyDescriptor_description",
124: "_UI_EnvEntry_value_feature",
125: "_UI_EnvEntry_type"),
126: NewprocessPackage.Literals.ENV_ENTRY__VALUE,
127: true, false, false,
128: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
129: null, null));
130: }
131:
132: /**
133: * This returns EnvEntry.gif.
134: * <!-- begin-user-doc -->
135: * <!-- end-user-doc -->
136: * @generated
137: */
138: public Object getImage(Object object) {
139: return overlayImage(object, getResourceLocator().getImage(
140: "full/obj16/EnvEntry"));
141: }
142:
143: /**
144: * This returns the label text for the adapted class.
145: * <!-- begin-user-doc -->
146: * <!-- end-user-doc -->
147: * @generated
148: */
149: public String getText(Object object) {
150: String label = ((EnvEntry) object).getName();
151: return label == null || label.length() == 0 ? getString("_UI_EnvEntry_type")
152: : getString("_UI_EnvEntry_type") + " " + label;
153: }
154:
155: /**
156: * This handles model notifications by calling {@link #updateChildren} to update any cached
157: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
158: * <!-- begin-user-doc -->
159: * <!-- end-user-doc -->
160: * @generated
161: */
162: public void notifyChanged(Notification notification) {
163: updateChildren(notification);
164:
165: switch (notification.getFeatureID(EnvEntry.class)) {
166: case NewprocessPackage.ENV_ENTRY__NAME:
167: case NewprocessPackage.ENV_ENTRY__TYPE:
168: case NewprocessPackage.ENV_ENTRY__VALUE:
169: fireNotifyChanged(new ViewerNotification(notification,
170: notification.getNotifier(), false, true));
171: return;
172: }
173: super .notifyChanged(notification);
174: }
175:
176: /**
177: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
178: * describing all of the children that can be created under this object.
179: * <!-- begin-user-doc -->
180: * <!-- end-user-doc -->
181: * @generated
182: */
183: protected void collectNewChildDescriptors(
184: Collection newChildDescriptors, Object object) {
185: super .collectNewChildDescriptors(newChildDescriptors, object);
186: }
187:
188: /**
189: * Return the resource locator for this item provider's resources.
190: * <!-- begin-user-doc -->
191: * <!-- end-user-doc -->
192: * @generated
193: */
194: public ResourceLocator getResourceLocator() {
195: return New_processEditPlugin.INSTANCE;
196: }
197:
198: }
|