/** * <copyright> * </copyright> * * $Id$ */ package fr.inria.atlanmod.collaboro.notation.provider; import fr.inria.atlanmod.collaboro.notation.GraphicalElement; import fr.inria.atlanmod.collaboro.notation.NotationPackage; 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.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.ViewerNotification; /** * This is the item provider adapter for a {@link fr.inria.atlanmod.collaboro.notation.GraphicalElement} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class GraphicalElementItemProvider extends NotationElementItemProvider implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public GraphicalElementItemProvider(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); addXPropertyDescriptor(object); addYPropertyDescriptor(object); addHeightPropertyDescriptor(object); addWidthPropertyDescriptor(object); addFillPropertyDescriptor(object); addStrokePropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the X feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addXPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_x_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_x_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__X, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Y feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addYPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_y_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_y_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__Y, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Height feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addHeightPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_height_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_height_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__HEIGHT, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Width feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addWidthPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_width_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_width_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__WIDTH, true, false, false, ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Fill feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addFillPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_fill_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_fill_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__FILL, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Stroke feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addStrokePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_GraphicalElement_stroke_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GraphicalElement_stroke_feature", "_UI_GraphicalElement_type"), NotationPackage.Literals.GRAPHICAL_ELEMENT__STROKE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((GraphicalElement)object).getId(); return label == null || label.length() == 0 ? getString("_UI_GraphicalElement_type") : getString("_UI_GraphicalElement_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(GraphicalElement.class)) { case NotationPackage.GRAPHICAL_ELEMENT__X: case NotationPackage.GRAPHICAL_ELEMENT__Y: case NotationPackage.GRAPHICAL_ELEMENT__HEIGHT: case NotationPackage.GRAPHICAL_ELEMENT__WIDTH: case NotationPackage.GRAPHICAL_ELEMENT__FILL: case NotationPackage.GRAPHICAL_ELEMENT__STROKE: 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); } }