/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.wso2.developerstudio.eclipse.gmf.esb.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.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;

import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.MessageBuilder;

/**
 * This is the item provider adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.MessageBuilder} object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class MessageBuilderItemProvider extends EsbNodeItemProvider {
    /**
     * This constructs an instance from a factory and a notifier.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public MessageBuilderItemProvider(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);

            addContentTypePropertyDescriptor(object);
            addBuilderClassPropertyDescriptor(object);
            addFormatterClassPropertyDescriptor(object);
        }
        return itemPropertyDescriptors;
    }

    /**
     * This adds a property descriptor for the Content Type feature.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected void addContentTypePropertyDescriptor(Object object) {
        itemPropertyDescriptors.add
            (createItemPropertyDescriptor
                (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
                 getResourceLocator(),
                 getString("_UI_MessageBuilder_contentType_feature"),
                 getString("_UI_PropertyDescriptor_description", "_UI_MessageBuilder_contentType_feature", "_UI_MessageBuilder_type"),
                 EsbPackage.Literals.MESSAGE_BUILDER__CONTENT_TYPE,
                 true,
                 false,
                 false,
                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
                 null,
                 null));
    }

    /**
     * This adds a property descriptor for the Builder Class feature.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected void addBuilderClassPropertyDescriptor(Object object) {
        itemPropertyDescriptors.add
            (createItemPropertyDescriptor
                (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
                 getResourceLocator(),
                 getString("_UI_MessageBuilder_builderClass_feature"),
                 getString("_UI_PropertyDescriptor_description", "_UI_MessageBuilder_builderClass_feature", "_UI_MessageBuilder_type"),
                 EsbPackage.Literals.MESSAGE_BUILDER__BUILDER_CLASS,
                 true,
                 false,
                 false,
                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
                 null,
                 null));
    }

    /**
     * This adds a property descriptor for the Formatter Class feature.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected void addFormatterClassPropertyDescriptor(Object object) {
        itemPropertyDescriptors.add
            (createItemPropertyDescriptor
                (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
                 getResourceLocator(),
                 getString("_UI_MessageBuilder_formatterClass_feature"),
                 getString("_UI_PropertyDescriptor_description", "_UI_MessageBuilder_formatterClass_feature", "_UI_MessageBuilder_type"),
                 EsbPackage.Literals.MESSAGE_BUILDER__FORMATTER_CLASS,
                 true,
                 false,
                 false,
                 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
                 null,
                 null));
    }

    /**
     * This returns MessageBuilder.gif.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object getImage(Object object) {
        return overlayImage(object, getResourceLocator().getImage("full/obj16/MessageBuilder"));
    }

    /**
     * This returns the label text for the adapted class.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String getText(Object object) {
        String label = ((MessageBuilder)object).getContentType();
        return label == null || label.length() == 0 ?
            getString("_UI_MessageBuilder_type") :
            getString("_UI_MessageBuilder_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(MessageBuilder.class)) {
            case EsbPackage.MESSAGE_BUILDER__CONTENT_TYPE:
            case EsbPackage.MESSAGE_BUILDER__BUILDER_CLASS:
            case EsbPackage.MESSAGE_BUILDER__FORMATTER_CLASS:
                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);
    }

}

@@ -156,16 +156,58 @@
 .List;%0A%0A
+import org.apache.commons.lang.WordUtils;%0A
 import o
@@ -983,16 +983,98 @@
 Builder;
+%0Aimport org.wso2.developerstudio.eclipse.gmf.esb.presentation.EEFPropertyViewUtil;
 %0A%0A/**%0A *
@@ -5398,21 +5398,27 @@
  String 
-label
+contentType
  = ((Mes
@@ -5429,16 +5429,17 @@
 Builder)
+ 
 object).
@@ -5468,20 +5468,197 @@
     
-return label
+String contentTypeLabel = WordUtils.abbreviate(contentType.toString(), 8, 10, %22 ...%22);%0A        String builderClass = ((MessageBuilder) object).getBuilderClass();%0A%0A        return contentType
  == 
@@ -5665,21 +5665,27 @@
 null %7C%7C 
-label
+contentType
 .length(
@@ -5692,28 +5692,16 @@
 ) == 0 ?
-%0A           
  getStri
@@ -5733,11 +5733,12 @@
 pe%22)
- :%0A
+%0A   
     
@@ -5737,32 +5737,67 @@
 %0A               
+ : EEFPropertyViewUtil.spaceFormat(
 getString(%22_UI_M
@@ -5820,22 +5820,157 @@
 pe%22)
- + %22 %22 + label
+)%0A                        + EEFPropertyViewUtil.spaceFormat(contentTypeLabel)%0A                        + EEFPropertyViewUtil.spaceFormat(builderClass)
 ;%0A  

Add Builder mediator key-value details to its property view