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:
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.ecore.EStructuralFeature;
020:
021: import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
022: import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
023: import org.eclipse.emf.edit.provider.IItemLabelProvider;
024: import org.eclipse.emf.edit.provider.IItemPropertySource;
025: import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
026: import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
027: import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
028: import org.eclipse.emf.edit.provider.ViewerNotification;
029:
030: /**
031: * This is the item provider adapter for a {@link newprocess.Process} object.
032: * <!-- begin-user-doc -->
033: * <!-- end-user-doc -->
034: * @generated
035: */
036: public class ProcessItemProvider extends ElementItemProvider 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 ProcessItemProvider(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: addSubjectPropertyDescriptor(object);
061: addNamespacePropertyDescriptor(object);
062: }
063: return itemPropertyDescriptors;
064: }
065:
066: /**
067: * This adds a property descriptor for the Subject feature.
068: * <!-- begin-user-doc -->
069: * <!-- end-user-doc -->
070: * @generated
071: */
072: protected void addSubjectPropertyDescriptor(Object object) {
073: itemPropertyDescriptors
074: .add(createItemPropertyDescriptor(
075: ((ComposeableAdapterFactory) adapterFactory)
076: .getRootAdapterFactory(),
077: getResourceLocator(),
078: getString("_UI_Process_subject_feature"),
079: getString("_UI_PropertyDescriptor_description",
080: "_UI_Process_subject_feature",
081: "_UI_Process_type"),
082: NewprocessPackage.Literals.PROCESS__SUBJECT,
083: true, false, false,
084: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
085: null, null));
086: }
087:
088: /**
089: * This adds a property descriptor for the Namespace feature.
090: * <!-- begin-user-doc -->
091: * <!-- end-user-doc -->
092: * @generated
093: */
094: protected void addNamespacePropertyDescriptor(Object object) {
095: itemPropertyDescriptors
096: .add(createItemPropertyDescriptor(
097: ((ComposeableAdapterFactory) adapterFactory)
098: .getRootAdapterFactory(),
099: getResourceLocator(),
100: getString("_UI_Process_namespace_feature"),
101: getString("_UI_PropertyDescriptor_description",
102: "_UI_Process_namespace_feature",
103: "_UI_Process_type"),
104: NewprocessPackage.Literals.PROCESS__NAMESPACE,
105: true, false, false,
106: ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
107: null, null));
108: }
109:
110: /**
111: * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
112: * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
113: * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
114: * <!-- begin-user-doc -->
115: * <!-- end-user-doc -->
116: * @generated
117: */
118: public Collection getChildrenFeatures(Object object) {
119: if (childrenFeatures == null) {
120: super .getChildrenFeatures(object);
121: childrenFeatures
122: .add(NewprocessPackage.Literals.PROCESS__HAS_SYNC_ACTIVITIES);
123: childrenFeatures
124: .add(NewprocessPackage.Literals.PROCESS__HAS_ASYNC_ACTIVITIES);
125: childrenFeatures
126: .add(NewprocessPackage.Literals.PROCESS__HAS_EVENTS);
127: childrenFeatures
128: .add(NewprocessPackage.Literals.PROCESS__HAS_LISTENERS);
129: childrenFeatures
130: .add(NewprocessPackage.Literals.PROCESS__HAS_ACTORS);
131: childrenFeatures
132: .add(NewprocessPackage.Literals.PROCESS__HAS_MESSAGES);
133: childrenFeatures
134: .add(NewprocessPackage.Literals.PROCESS__HAS_CONCLUSIONS);
135: childrenFeatures
136: .add(NewprocessPackage.Literals.PROCESS__HAS_EXPANSIONS);
137: childrenFeatures
138: .add(NewprocessPackage.Literals.PROCESS__HAS_CONDITION_PROXY);
139: childrenFeatures
140: .add(NewprocessPackage.Literals.PROCESS__HAS_GLOBALS);
141: }
142: return childrenFeatures;
143: }
144:
145: /**
146: * <!-- begin-user-doc -->
147: * <!-- end-user-doc -->
148: * @generated
149: */
150: protected EStructuralFeature getChildFeature(Object object,
151: Object child) {
152: // Check the type of the specified child object and return the proper feature to use for
153: // adding (see {@link AddCommand}) it as a child.
154:
155: return super .getChildFeature(object, child);
156: }
157:
158: /**
159: * This returns Process.gif.
160: * <!-- begin-user-doc -->
161: * <!-- end-user-doc -->
162: * @generated
163: */
164: public Object getImage(Object object) {
165: return overlayImage(object, getResourceLocator().getImage(
166: "full/obj16/Process"));
167: }
168:
169: /**
170: * This returns the label text for the adapted class.
171: * <!-- begin-user-doc -->
172: * <!-- end-user-doc -->
173: * @generated
174: */
175: public String getText(Object object) {
176: String label = ((newprocess.Process) object).getName();
177: return label == null || label.length() == 0 ? getString("_UI_Process_type")
178: : getString("_UI_Process_type") + " " + label;
179: }
180:
181: /**
182: * This handles model notifications by calling {@link #updateChildren} to update any cached
183: * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
184: * <!-- begin-user-doc -->
185: * <!-- end-user-doc -->
186: * @generated
187: */
188: public void notifyChanged(Notification notification) {
189: updateChildren(notification);
190:
191: switch (notification.getFeatureID(newprocess.Process.class)) {
192: case NewprocessPackage.PROCESS__SUBJECT:
193: case NewprocessPackage.PROCESS__NAMESPACE:
194: fireNotifyChanged(new ViewerNotification(notification,
195: notification.getNotifier(), false, true));
196: return;
197: case NewprocessPackage.PROCESS__HAS_SYNC_ACTIVITIES:
198: case NewprocessPackage.PROCESS__HAS_ASYNC_ACTIVITIES:
199: case NewprocessPackage.PROCESS__HAS_EVENTS:
200: case NewprocessPackage.PROCESS__HAS_LISTENERS:
201: case NewprocessPackage.PROCESS__HAS_ACTORS:
202: case NewprocessPackage.PROCESS__HAS_MESSAGES:
203: case NewprocessPackage.PROCESS__HAS_CONCLUSIONS:
204: case NewprocessPackage.PROCESS__HAS_EXPANSIONS:
205: case NewprocessPackage.PROCESS__HAS_CONDITION_PROXY:
206: case NewprocessPackage.PROCESS__HAS_GLOBALS:
207: fireNotifyChanged(new ViewerNotification(notification,
208: notification.getNotifier(), true, false));
209: return;
210: }
211: super .notifyChanged(notification);
212: }
213:
214: /**
215: * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s
216: * describing all of the children that can be created under this object.
217: * <!-- begin-user-doc -->
218: * <!-- end-user-doc -->
219: * @generated
220: */
221: protected void collectNewChildDescriptors(
222: Collection newChildDescriptors, Object object) {
223: super .collectNewChildDescriptors(newChildDescriptors, object);
224:
225: newChildDescriptors
226: .add(createChildParameter(
227: NewprocessPackage.Literals.PROCESS__HAS_SYNC_ACTIVITIES,
228: NewprocessFactory.eINSTANCE
229: .createSyncActivity()));
230:
231: newChildDescriptors
232: .add(createChildParameter(
233: NewprocessPackage.Literals.PROCESS__HAS_ASYNC_ACTIVITIES,
234: NewprocessFactory.eINSTANCE
235: .createAsyncActivity()));
236:
237: newChildDescriptors.add(createChildParameter(
238: NewprocessPackage.Literals.PROCESS__HAS_EVENTS,
239: NewprocessFactory.eINSTANCE.createEvent()));
240:
241: newChildDescriptors.add(createChildParameter(
242: NewprocessPackage.Literals.PROCESS__HAS_LISTENERS,
243: NewprocessFactory.eINSTANCE.createListener()));
244:
245: newChildDescriptors.add(createChildParameter(
246: NewprocessPackage.Literals.PROCESS__HAS_ACTORS,
247: NewprocessFactory.eINSTANCE.createActor()));
248:
249: newChildDescriptors.add(createChildParameter(
250: NewprocessPackage.Literals.PROCESS__HAS_MESSAGES,
251: NewprocessFactory.eINSTANCE.createMessage()));
252:
253: newChildDescriptors.add(createChildParameter(
254: NewprocessPackage.Literals.PROCESS__HAS_CONCLUSIONS,
255: NewprocessFactory.eINSTANCE.createConclusion()));
256:
257: newChildDescriptors.add(createChildParameter(
258: NewprocessPackage.Literals.PROCESS__HAS_EXPANSIONS,
259: NewprocessFactory.eINSTANCE.createExpansion()));
260:
261: newChildDescriptors
262: .add(createChildParameter(
263: NewprocessPackage.Literals.PROCESS__HAS_CONDITION_PROXY,
264: NewprocessFactory.eINSTANCE
265: .createConditionProxy()));
266:
267: newChildDescriptors.add(createChildParameter(
268: NewprocessPackage.Literals.PROCESS__HAS_GLOBALS,
269: NewprocessFactory.eINSTANCE.createGlobals()));
270: }
271:
272: /**
273: * Return the resource locator for this item provider's resources.
274: * <!-- begin-user-doc -->
275: * <!-- end-user-doc -->
276: * @generated
277: */
278: public ResourceLocator getResourceLocator() {
279: return New_processEditPlugin.INSTANCE;
280: }
281:
282: }
|