/** * CertWare Project * Copyright (c) 2010 National Aeronautics and Space Administration. All rights reserved. */ package net.certware.verification.checklist.provider; import java.util.Collection; import java.util.List; import net.certware.verification.checklist.ChecklistPackage; import net.certware.verification.checklist.Item; import net.certware.verification.checklist.edit.provider.ChecklistEditPlugin; 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.IItemColorProvider; 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.ITableItemColorProvider; import org.eclipse.emf.edit.provider.ITableItemLabelProvider; 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 net.certware.verification.checklist.Item} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class ItemItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource, ITableItemLabelProvider, ITableItemColorProvider, IItemColorProvider { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String copyright = "Copyright (c) 2010 National Aeronautics and Space Administration"; //$NON-NLS-1$ /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ItemItemProvider(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); addIdentifierPropertyDescriptor(object); addDescriptionPropertyDescriptor(object); addReferencePropertyDescriptor(object); addResultPropertyDescriptor(object); addCommentPropertyDescriptor(object); } return itemPropertyDescriptors; } /** * This adds a property descriptor for the Identifier feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addIdentifierPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Item_identifier_feature"), //$NON-NLS-1$ getString("_UI_Item_identifier_description"), //$NON-NLS-1$ ChecklistPackage.Literals.ITEM__IDENTIFIER, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_FixedPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Description feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addDescriptionPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Item_description_feature"), //$NON-NLS-1$ getString("_UI_Item_description_description"), //$NON-NLS-1$ ChecklistPackage.Literals.ITEM__DESCRIPTION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_FixedPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addReferencePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Item_reference_feature"), //$NON-NLS-1$ getString("_UI_Item_reference_description"), //$NON-NLS-1$ ChecklistPackage.Literals.ITEM__REFERENCE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_FixedPropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Result feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addResultPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Item_result_feature"), //$NON-NLS-1$ getString("_UI_Item_result_description"), //$NON-NLS-1$ ChecklistPackage.Literals.ITEM__RESULT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_BasePropertyCategory"), //$NON-NLS-1$ null)); } /** * This adds a property descriptor for the Comment feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void addCommentPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Item_comment_feature"), //$NON-NLS-1$ getString("_UI_Item_comment_description"), //$NON-NLS-1$ ChecklistPackage.Literals.ITEM__COMMENT, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_SupportPropertyCategory"), //$NON-NLS-1$ null)); } /** * This returns Item.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/Item")); //$NON-NLS-1$ } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * Modified to return the item identifier plus description. * <!-- end-user-doc --> * @generated NOT */ @Override public String getText(Object object) { Item item = (Item)object; String label = item.getDescription(); return label == null || label.length() == 0 ? getString("_UI_Item_type") : //$NON-NLS-1$ // getString("_UI_Item_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ item.getIdentifier() + ' ' + 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(Item.class)) { case ChecklistPackage.ITEM__IDENTIFIER: case ChecklistPackage.ITEM__DESCRIPTION: case ChecklistPackage.ITEM__REFERENCE: case ChecklistPackage.ITEM__RESULT: case ChecklistPackage.ITEM__COMMENT: 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 ChecklistEditPlugin.INSTANCE; } }