/** * <p>Copyright: Copyright (c) 2011</p> * <p>Company: �������ӹɷ����޹�˾</p> */ package com.hundsun.ares.studio.jres.model.metadata.provider; import com.hundsun.ares.studio.jres.metadata.ui.MetadataUI; import com.hundsun.ares.studio.jres.model.metadata.MetadataPackage; import com.hundsun.ares.studio.jres.model.metadata.Operation; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; import org.eclipse.emf.edit.provider.ITreeItemContentProvider; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link com.hundsun.ares.studio.jres.model.metadata.Operation} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class OperationItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OperationItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addTitlePropertyDescriptor(object); addFilePropertyDescriptor(object); addOutPathPropertyDescriptor(object); addFunctionNamePropertyDescriptor(object); addCodePropertyDescriptor(object); addUixmlPropertyDescriptor(object); addAutobuildPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Title feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addTitlePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_title_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_title_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__TITLE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the File feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFilePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_file_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_file_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__FILE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Out Path feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addOutPathPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_outPath_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_outPath_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__OUT_PATH, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Function Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFunctionNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_functionName_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_functionName_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__FUNCTION_NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Code feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addCodePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_code_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_code_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__CODE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Uixml feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addUixmlPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_uixml_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_uixml_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__UIXML, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Autobuild feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addAutobuildPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Operation_autobuild_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Operation_autobuild_feature", "_UI_Operation_type"), MetadataPackage.Literals.OPERATION__AUTOBUILD, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } /** * This returns Operation.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Operation")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Operation)object).getFunctionName(); return label == null || label.length() == 0 ? getString("_UI_Operation_type") : getString("_UI_Operation_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Operation.class)) { case MetadataPackage.OPERATION__TITLE: case MetadataPackage.OPERATION__FILE: case MetadataPackage.OPERATION__OUT_PATH: case MetadataPackage.OPERATION__FUNCTION_NAME: case MetadataPackage.OPERATION__CODE: case MetadataPackage.OPERATION__UIXML: case MetadataPackage.OPERATION__AUTOBUILD: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } /** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { return MetadataUI.INSTANCE; } }