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.Element;
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.ItemPropertyDescriptor;
027: import org.eclipse.emf.edit.provider.ItemProviderAdapter;
028: import org.eclipse.emf.edit.provider.ViewerNotification;
029:
030: /**
031: * This is the item provider adapter for a {@link newprocess.Element} object.
032: * <!-- begin-user-doc -->
033: * <!-- end-user-doc -->
034: * @generated
035: */
036: public class ElementItemProvider extends ItemProviderAdapter implements
037: IEditingDomainItemProvider, IStructuredItemContentProvider,
038: ITreeItemContentProvider, IItemLabelProvider,
039: IItemPropertySource {
040: /**
041: * This constructs an instance from a factory and a notifier.
042: * <!-- begin-user-doc -->
043: * <!-- end-user-doc -->
044: * @generated
045: */
046: public ElementItemProvider(AdapterFactory adapterFactory) {
047: super (adapterFactory);
048: }
049:
050: /**
051: * This returns the property descriptors for the adapted class.
052: * <!-- begin-user-doc -->
053: * <!-- end-user-doc -->
054: * @generated
055: */
056: public List getPropertyDescriptors(Object object) {
057: if (itemPropertyDescriptors == null) {
058: super .getPropertyDescriptors(object);
059:
060: addNamePropertyDescriptor(object);
061: addDescriptionPropertyDescriptor(object);
062: addImplementationPropertyDescriptor(object);
063: addUrlPropertyDescriptor(object);
064: }
065: return itemPropertyDescriptors;
066: }
067:
068: /**
069: * This adds a property descriptor for the Name feature.
070: * <!-- begin-user-doc -->
071: * <!-- end-user-doc -->
072: * @generated
073: */
074: protected void addNamePropertyDescriptor(Object object) {
075: itemPropertyDescriptors
076: .add(createItemPropertyDescriptor(
077: ((ComposeableAdapterFactory) adapterFactory)
078: .getRootAdapterFactory(),
079: getResourceLocator(),
080: getString("_UI_Element_name_feature"),
081: getString("_UI_PropertyDescriptor_description",
082: "_UI_Element_name_feature",
083: "_UI_Element_type"),
084: NewprocessPackage.Literals.ELEMENT__NAME, true,
085: false, false,
086: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
087: null, null));
088: }
089:
090: /**
091: * This adds a property descriptor for the Description feature.
092: * <!-- begin-user-doc -->
093: * <!-- end-user-doc -->
094: * @generated
095: */
096: protected void addDescriptionPropertyDescriptor(Object object) {
097: itemPropertyDescriptors
098: .add(createItemPropertyDescriptor(
099: ((ComposeableAdapterFactory) adapterFactory)
100: .getRootAdapterFactory(),
101: getResourceLocator(),
102: getString("_UI_Element_description_feature"),
103: getString("_UI_PropertyDescriptor_description",
104: "_UI_Element_description_feature",
105: "_UI_Element_type"),
106: NewprocessPackage.Literals.ELEMENT__DESCRIPTION,
107: true, false, false,
108: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
109: null, null));
110: }
111:
112: /**
113: * This adds a property descriptor for the Implementation feature.
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @generated
117: */
118: protected void addImplementationPropertyDescriptor(Object object) {
119: itemPropertyDescriptors
120: .add(createItemPropertyDescriptor(
121: ((ComposeableAdapterFactory) adapterFactory)
122: .getRootAdapterFactory(),
123: getResourceLocator(),
124: getString("_UI_Element_implementation_feature"),
125: getString("_UI_PropertyDescriptor_description",
126: "_UI_Element_implementation_feature",
127: "_UI_Element_type"),
128: NewprocessPackage.Literals.ELEMENT__IMPLEMENTATION,
129: true, false, false,
130: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
131: null, null));
132: }
133:
134: /**
135: * This adds a property descriptor for the Url feature.
136: * <!-- begin-user-doc -->
137: * <!-- end-user-doc -->
138: * @generated
139: */
140: protected void addUrlPropertyDescriptor(Object object) {
141: itemPropertyDescriptors.add(createItemPropertyDescriptor(
142: ((ComposeableAdapterFactory) adapterFactory)
143: .getRootAdapterFactory(), getResourceLocator(),
144: getString("_UI_Element_url_feature"), getString(
145: "_UI_PropertyDescriptor_description",
146: "_UI_Element_url_feature", "_UI_Element_type"),
147: NewprocessPackage.Literals.ELEMENT__URL, true, false,
148: false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
149: null, null));
150: }
151:
152: /**
153: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
154: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
155: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
156: * <!-- begin-user-doc -->
157: * <!-- end-user-doc -->
158: * @generated
159: */
160: public Collection getChildrenFeatures(Object object) {
161: if (childrenFeatures == null) {
162: super .getChildrenFeatures(object);
163: childrenFeatures
164: .add(NewprocessPackage.Literals.ELEMENT__HAS_ENV_ENTRIES);
165: }
166: return childrenFeatures;
167: }
168:
169: /**
170: * This returns Element.gif.
171: * <!-- begin-user-doc -->
172: * <!-- end-user-doc -->
173: * @generated
174: */
175: public Object getImage(Object object) {
176: return overlayImage(object, getResourceLocator().getImage(
177: "full/obj16/Element"));
178: }
179:
180: /**
181: * This returns the label text for the adapted class.
182: * <!-- begin-user-doc -->
183: * <!-- end-user-doc -->
184: * @generated
185: */
186: public String getText(Object object) {
187: String label = ((Element) object).getName();
188: return label == null || label.length() == 0 ? getString("_UI_Element_type")
189: : getString("_UI_Element_type") + " " + label;
190: }
191:
192: /**
193: * This handles model notifications by calling {@link #updateChildren} to update any cached
194: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
195: * <!-- begin-user-doc -->
196: * <!-- end-user-doc -->
197: * @generated
198: */
199: public void notifyChanged(Notification notification) {
200: updateChildren(notification);
201:
202: switch (notification.getFeatureID(Element.class)) {
203: case NewprocessPackage.ELEMENT__NAME:
204: case NewprocessPackage.ELEMENT__DESCRIPTION:
205: case NewprocessPackage.ELEMENT__IMPLEMENTATION:
206: case NewprocessPackage.ELEMENT__URL:
207: case NewprocessPackage.ELEMENT__ID:
208: fireNotifyChanged(new ViewerNotification(notification,
209: notification.getNotifier(), false, true));
210: return;
211: case NewprocessPackage.ELEMENT__HAS_ENV_ENTRIES:
212: fireNotifyChanged(new ViewerNotification(notification,
213: notification.getNotifier(), true, false));
214: return;
215: }
216: super .notifyChanged(notification);
217: }
218:
219: /**
220: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
221: * describing all of the children that can be created under this object.
222: * <!-- begin-user-doc -->
223: * <!-- end-user-doc -->
224: * @generated
225: */
226: protected void collectNewChildDescriptors(
227: Collection newChildDescriptors, Object object) {
228: super .collectNewChildDescriptors(newChildDescriptors, object);
229:
230: newChildDescriptors.add(createChildParameter(
231: NewprocessPackage.Literals.ELEMENT__HAS_ENV_ENTRIES,
232: NewprocessFactory.eINSTANCE.createEnvEntry()));
233: }
234:
235: /**
236: * Return the resource locator for this item provider's resources.
237: * <!-- begin-user-doc -->
238: * <!-- end-user-doc -->
239: * @generated
240: */
241: public ResourceLocator getResourceLocator() {
242: return New_processEditPlugin.INSTANCE;
243: }
244:
245: }
|