/**
 * <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.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.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.wso2.developerstudio.eclipse.gmf.esb.LogProperty;

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

        }
        return itemPropertyDescriptors;
    }

    /**
     * This returns LogProperty.gif.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */

    @Override
    public Object getImage(Object object) {
        return overlayImage(object, getResourceLocator().getImage("full/obj16/LogProperty"));
    }

    /**
     * This returns the label text for the adapted class.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */

    @Override
    public String getText(Object object) {
        String label = ((LogProperty)object).getPropertyName();
        return label == null || label.length() == 0 ?
            getString("_UI_LogProperty_type") :
            getString("_UI_LogProperty_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);
        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
@@ -243,32 +243,32 @@
 AdapterFactory;%0A
-
 import org.eclip
@@ -1088,16 +1088,83 @@
 roperty;
+%0Aimport org.wso2.developerstudio.eclipse.gmf.esb.PropertyValueType;
 %0A%0A/**%0A *
@@ -2543,32 +2543,36 @@
     * @generated
+ NOT
 %0A     */%0A%0A    @O
@@ -2641,73 +2641,535 @@
 ing 
-label = ((LogProperty)object).getPropertyName();%0A        return l
+propertyName = ((LogProperty)object).getPropertyName();%0A        String propertyNameLabel = WordUtils.abbreviate(propertyName.toString(), 8, 10, %22 ...%22);%0A        String propertyValueType = ((LogProperty)object).getPropertyValueType().toString();%0A        String propertyValueLabel = ((LogProperty)object).getPropertyValue();%0A        String propertyExpressionLabel = ((LogProperty)object).getPropertyExpression().toString();%0A%0A        if (propertyValueType == PropertyValueType.LITERAL.getName()) %7B%0A            return propertyNameL
 abel
@@ -3180,17 +3180,29 @@
 null %7C%7C 
-l
+propertyNameL
 abel.len
@@ -3214,16 +3214,20 @@
  == 0 ?%0A
+    
         
@@ -3270,32 +3270,61 @@
 ) :%0A            
+        formatPropertyString(
 getString(%22_UI_L
@@ -3344,22 +3344,728 @@
 pe%22)
+)
  + 
-%22 %22 + label
+formatPropertyString(propertyNameLabel) +%0A                    formatPropertyString(propertyValueLabel);%0A        %7D else %7B%0A            return propertyNameLabel == null %7C%7C propertyNameLabel.length() == 0 ?%0A                    getString(%22_UI_LogProperty_type%22) :%0A                        formatPropertyString(getString(%22_UI_LogProperty_type%22)) +%0A                        formatPropertyString(propertyNameLabel) + formatPropertyString(propertyExpressionLabel);%0A        %7D%0A    %7D%0A%0A    public String formatPropertyString(String str) %7B%0A        int maxLength = 30;%0A        int tabSpace = (maxLength - str.length()) / 4;%0A        for (int i = 0; i %3C tabSpace; i++) %7B%0A            str = str.concat(%22%5Ct%22);%0A        %7D%0A        return str
 ;%0A  

Refactor Log mediator properties