/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.buckminster.model.common.provider; import java.util.Collection; import java.util.List; import java.util.Map; import org.eclipse.buckminster.model.common.CommonPackage; import org.eclipse.buckminster.model.common.Constant; 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.IChildCreationExtender; 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 java.util.Map.Entry} object. * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public class PropertyConstantItemProvider 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 PropertyConstantItemProvider(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); addKeyPropertyDescriptor(object); addValuePropertyDescriptor(object); addMutablePropertyDescriptor(object); addStringValuePropertyDescriptor(object); } return itemPropertyDescriptors; } /** * Return the resource locator for this item provider's resources. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public ResourceLocator getResourceLocator() { return ((IChildCreationExtender) adapterFactory).getResourceLocator(); } /** * This returns the label text for the adapted class. <!-- begin-user-doc * --> <!-- end-user-doc --> * * @generated NOT */ @Override public String getText(Object object) { @SuppressWarnings("unchecked") Map.Entry<String, Constant> propertyConstant = (Map.Entry<String, Constant>) object; Constant v = propertyConstant.getValue(); return "" + propertyConstant.getKey() + " -> " + (v == null ? "null" : v.getValue()); } /** * 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(Map.Entry.class)) { case CommonPackage.PROPERTY_CONSTANT__KEY: case CommonPackage.PROPERTY_CONSTANT__MUTABLE: case CommonPackage.PROPERTY_CONSTANT__STRING_VALUE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } /** * This adds a property descriptor for the Key feature. <!-- begin-user-doc * --> <!-- end-user-doc --> * * @generated */ protected void addKeyPropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_PropertyConstant_key_feature"), getString("_UI_PropertyDescriptor_description", "_UI_PropertyConstant_key_feature", "_UI_PropertyConstant_type"), CommonPackage.Literals.PROPERTY_CONSTANT__KEY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Mutable feature. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected void addMutablePropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_PropertyConstant_mutable_feature"), getString("_UI_PropertyDescriptor_description", "_UI_PropertyConstant_mutable_feature", "_UI_PropertyConstant_type"), CommonPackage.Literals.PROPERTY_CONSTANT__MUTABLE, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the String Value feature. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected void addStringValuePropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_PropertyConstant_stringValue_feature"), getString("_UI_PropertyDescriptor_description", "_UI_PropertyConstant_stringValue_feature", "_UI_PropertyConstant_type"), CommonPackage.Literals.PROPERTY_CONSTANT__STRING_VALUE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Value feature. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected void addValuePropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_PropertyConstant_value_feature"), getString("_UI_PropertyDescriptor_description", "_UI_PropertyConstant_value_feature", "_UI_PropertyConstant_type"), CommonPackage.Literals.PROPERTY_CONSTANT__VALUE, true, false, false, null, null, null)); } /** * 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); } }