/** * <copyright> * </copyright> * * $Id: PersonItemProvider.java,v 1.4 2011/01/02 14:10:47 glefur Exp $ */ package org.eclipse.emf.samples.conference.provider; 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; import org.eclipse.emf.samples.conference.ConferencePackage; import org.eclipse.emf.samples.conference.Person; /** * This is the item provider adapter for a {@link org.eclipse.emf.samples.conference.Person} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class PersonItemProvider 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 PersonItemProvider(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); addFirstnamePropertyDescriptor(object); addLastnamePropertyDescriptor(object); addAgePropertyDescriptor(object); addEclipseCommiterPropertyDescriptor(object); addAssistsPropertyDescriptor(object); addGenderPropertyDescriptor(object); addIsRegisteredPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Firstname feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFirstnamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_firstname_feature"), getString("_UI_Person_firstname_description"), ConferencePackage.Literals.PERSON__FIRSTNAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Lastname feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addLastnamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_lastname_feature"), getString("_UI_Person_lastname_description"), ConferencePackage.Literals.PERSON__LASTNAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Age feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addAgePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_age_feature"), getString("_UI_Person_age_description"), ConferencePackage.Literals.PERSON__AGE, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Eclipse Commiter feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addEclipseCommiterPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_eclipseCommiter_feature"), getString("_UI_Person_eclipseCommiter_description"), ConferencePackage.Literals.PERSON__ECLIPSE_COMMITER, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Assists feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addAssistsPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_assists_feature"), getString("_UI_Person_assists_description"), ConferencePackage.Literals.PERSON__ASSISTS, true, false, true, null, null, null)); } /** * This adds a property descriptor for the Gender feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addGenderPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_gender_feature"), getString("_UI_Person_gender_description"), ConferencePackage.Literals.PERSON__GENDER, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Is Registered feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addIsRegisteredPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Person_isRegistered_feature"), getString("_UI_Person_isRegistered_description"), ConferencePackage.Literals.PERSON__IS_REGISTERED, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } /** * This returns Person.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Person")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((Person)object).getFirstname(); return label == null || label.length() == 0 ? getString("_UI_Person_type") : getString("_UI_Person_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(Person.class)) { case ConferencePackage.PERSON__FIRSTNAME: case ConferencePackage.PERSON__LASTNAME: case ConferencePackage.PERSON__AGE: case ConferencePackage.PERSON__ECLIPSE_COMMITER: case ConferencePackage.PERSON__GENDER: case ConferencePackage.PERSON__IS_REGISTERED: 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 ConferenceEditPlugin.INSTANCE; } }