directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r556423 - in /directory/studio/trunk: studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/ studio-aciitemeditor/src/main/java/org...
Date Sun, 15 Jul 2007 16:15:40 GMT
Author: seelmann
Date: Sun Jul 15 09:15:39 2007
New Revision: 556423

URL: http://svn.apache.org/viewvc?view=rev&rev=556423
Log:
DIRSTUDIO-151
- Moved modification methods from IValueEditor to the ValueEditorManager
- Removed getRawValue( IConnection connection, Object stringOrBinaryValue )

Modified:
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
    directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java
    directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
    directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java
    directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/dn/DnValueEditor.java
    directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java
    directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordValueEditor.java

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/ACIItemValueEditor.java Sun Jul 15 09:15:39 2007
@@ -133,48 +133,4 @@
         return null;
     }
 
-
-    /**
-     * Returns a ACIItemValueContext with the given
-     * connection, value and null entry.
-     * 
-     * @param value the value
-     * @param connection the connection
-     * 
-     * @return the raw value
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        Object o = super.getRawValue( connection, value );
-        if ( o != null && o instanceof String )
-        {
-            String v = (String) o;
-            return new ACIItemValueWithContext( connection, null, v );
-        }
-
-        return null;
-    }
-
-//
-//    /**
-//     * Returns always the string value.
-//     * 
-//     * Reimplementation, because getRawValue() returns a
-//     * DnValueEditorRawValueWrapper.
-//     * 
-//     * @param value the value
-//     * 
-//     * @return the display value
-//     */
-//    public String getDisplayValue( IValue value )
-//    {
-//        if ( value == null )
-//        {
-//            return "NULL";
-//        }
-//
-//        String displayValue = value.getStringValue();
-//        return displayValue;
-//    }
-    
 }

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/dialogs/MultiValuedDialog.java Sun Jul 15 09:15:39 2007
@@ -282,31 +282,27 @@
      */
     private void addValue()
     {
-        
-        Object oldRawValue;
         try
         {
             IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
             IValue value = new Value( attribute, "" ); //$NON-NLS-1$
-            oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+            Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+            
+            CellEditor cellEditor = valueEditor.getCellEditor();
+            cellEditor.setValue( oldRawValue );
+            cellEditor.activate();
+            Object newRawValue = cellEditor.getValue();
+            
+            if ( newRawValue != null )
+            {
+                String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
+                
+                values.add( newValue );
+                tableViewer.refresh();
+            }
         }
         catch ( ModelModificationException e )
         {
-            oldRawValue = valueEditor.getRawValue( context.getConnection(), "" ); //$NON-NLS-1$
-        }
-        
-
-        CellEditor cellEditor = valueEditor.getCellEditor();
-        cellEditor.setValue( oldRawValue );
-        cellEditor.activate();
-        Object newRawValue = cellEditor.getValue();
-
-        if ( newRawValue != null )
-        {
-            String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
-
-            values.add( newValue );
-            tableViewer.refresh();
         }
     }
 
@@ -320,30 +316,28 @@
         String oldValue = getSelectedValue();
         if ( oldValue != null )
         {
-            Object oldRawValue;
             try
             {
                 IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
                 IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
-                oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+                Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+                
+                CellEditor cellEditor = valueEditor.getCellEditor();
+                cellEditor.setValue( oldRawValue );
+                cellEditor.activate();
+                Object newRawValue = cellEditor.getValue();
+                
+                if ( newRawValue != null )
+                {
+                    String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
+                    
+                    values.remove( oldValue );
+                    values.add( newValue );
+                    tableViewer.refresh();
+                }
             }
             catch ( ModelModificationException e )
             {
-                oldRawValue = valueEditor.getRawValue( context.getConnection(), oldValue );
-            }
-
-            CellEditor cellEditor = valueEditor.getCellEditor();
-            cellEditor.setValue( oldRawValue );
-            cellEditor.activate();
-            Object newRawValue = cellEditor.getValue();
-
-            if ( newRawValue != null )
-            {
-                String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
-
-                values.remove( oldValue );
-                values.add( newValue );
-                tableViewer.refresh();
             }
         }
     }

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeAndValueValueEditor.java Sun Jul 15 09:15:39 2007
@@ -77,12 +77,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns an AttributeTypeAndValueValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         Schema schema = null;
         if ( connection != null )

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/AttributeTypeValueEditor.java Sun Jul 15 09:15:39 2007
@@ -75,12 +75,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns a AttributeTypeValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         Schema schema = null;
         if ( connection != null )

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/FilterValueEditor.java Sun Jul 15 09:15:39 2007
@@ -77,12 +77,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns a FilterValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         if ( connection == null || value == null || !( value instanceof String ) )
         {

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/MaxValueCountValueEditor.java Sun Jul 15 09:15:39 2007
@@ -100,12 +100,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns an MaxValueCountValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         Schema schema = null;
         if ( connection != null )

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/RestrictedByValueEditor.java Sun Jul 15 09:15:39 2007
@@ -99,12 +99,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns an RestrictedByValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         Schema schema = null;
         if ( connection != null )

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/valueeditors/SubtreeValueEditor.java Sun Jul 15 09:15:39 2007
@@ -103,20 +103,6 @@
 
 
     /**
-     * @see org.apache.directory.studio.valueeditors.AbstractDialogStringValueEditor#getRawValue(org.apache.directory.studio.ldapbrowser.core.model.IConnection, java.lang.Object)
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        Object o = super.getRawValue( connection, value );
-        if ( o != null && o instanceof String )
-        {
-            return new SubtreeSpecificationValueWrapper( connection, null, ( String ) o );
-        }
-
-        return null;
-    }
-
-    /**
      * The SubtreeSpecificationValueWrapper is used to pass contextual
      * information to the opened SubtreeSpecificationDialog.
      *

Modified: directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java (original)
+++ directory/studio/trunk/studio-aciitemeditor/src/main/java/org/apache/directory/studio/aciitemeditor/widgets/ACIItemProtectedItemsComposite.java Sun Jul 15 09:15:39 2007
@@ -32,6 +32,11 @@
 import org.apache.directory.studio.aciitemeditor.dialogs.MultiValuedDialog;
 import org.apache.directory.studio.aciitemeditor.model.ProtectedItemWrapper;
 import org.apache.directory.studio.aciitemeditor.model.ProtectedItemWrapperFactory;
+import org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute;
+import org.apache.directory.studio.ldapbrowser.core.internal.model.Value;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
 import org.apache.directory.studio.valueeditors.AbstractDialogStringValueEditor;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.CellEditor;
@@ -501,20 +506,29 @@
                 {
                     oldValue = ""; //$NON-NLS-1$
                 }
-                Object oldRawValue = valueEditor.getRawValue( context.getConnection(), oldValue );
+                
+                try
+                {
+                    IAttribute attribute = new Attribute( context.getEntry(), "" ); //$NON-NLS-1$
+                    IValue value = new Value( attribute, oldValue ); //$NON-NLS-1$
+                    Object oldRawValue = valueEditor.getRawValue( value ); //$NON-NLS-1$
+
+                    CellEditor cellEditor = valueEditor.getCellEditor();
+                    cellEditor.setValue( oldRawValue );
+                    cellEditor.activate();
+                    Object newRawValue = cellEditor.getValue();
 
-                CellEditor cellEditor = valueEditor.getCellEditor();
-                cellEditor.setValue( oldRawValue );
-                cellEditor.activate();
-                Object newRawValue = cellEditor.getValue();
+                    if ( newRawValue != null )
+                    {
+                        String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
 
-                if ( newRawValue != null )
+                        values.clear();
+                        values.add( newValue );
+                        tableViewer.refresh();
+                    }
+                }
+                catch ( ModelModificationException e )
                 {
-                    String newValue = ( String ) valueEditor.getStringOrBinaryValue( newRawValue );
-
-                    values.clear();
-                    values.add( newValue );
-                    tableViewer.refresh();
                 }
             }
         }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java Sun Jul 15 09:15:39 2007
@@ -22,12 +22,9 @@
 
 
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.apache.directory.studio.valueeditors.ValueEditorManager;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Item;
 
 
@@ -129,8 +126,6 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * TODO: Remove value modification from value editors 
      */
     public void modify( Object element, String property, Object newRawValue )
     {
@@ -141,20 +136,11 @@
 
         if ( element != null && element instanceof IValue && valueEditorManager != null )
         {
-            IValue attributeValue = ( IValue ) element;
+            IValue oldValue = ( IValue ) element;
 
             if ( EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME.equals( property ) )
             {
-                try
-                {
-                    this.valueEditorManager.getCurrentValueEditor( attributeValue ).modifyValue( attributeValue,
-                        newRawValue );
-                }
-                catch ( ModelModificationException mme )
-                {
-                    MessageDialog.openError( Display.getDefault().getActiveShell(), "Error While Modifying Value", mme
-                        .getMessage() );
-                }
+                valueEditorManager.modifyValue( oldValue, newRawValue );
             }
         }
     }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogBinaryValueEditor.java Sun Jul 15 09:15:39 2007
@@ -21,19 +21,8 @@
 package org.apache.directory.studio.valueeditors;
 
 
-import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
-import org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute;
-import org.apache.directory.studio.ldapbrowser.core.jobs.CreateValuesJob;
-import org.apache.directory.studio.ldapbrowser.core.jobs.DeleteAttributesValueJob;
-import org.apache.directory.studio.ldapbrowser.core.jobs.ModifyValueJob;
-import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
-import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
-import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
 
 
 /**
@@ -173,34 +162,6 @@
     /**
      * {@inheritDoc}
      * 
-     * This implementation returns the value itself if it is
-     * of type byte[] or a byte[] with the UTF-8 encoded string 
-     * value if it is of type String.  
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        if ( value == null )
-        {
-            return null;
-        }
-        else if ( value instanceof String )
-        {
-            return LdifUtils.utf8encode( ( String ) value );
-        }
-        else if ( value instanceof byte[] )
-        {
-            return value;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
      * This implementation always return the binary value
      * as byte[].
      */
@@ -217,110 +178,6 @@
         else
         {
             return null;
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void createValue( IEntry entry, String attributeDescription, Object newRawValue )
-        throws ModelModificationException
-    {
-        if ( entry != null && attributeDescription != null && newRawValue != null && newRawValue instanceof byte[] )
-        {
-            if ( entry.getAttribute( attributeDescription ) != null )
-            {
-                this.modify( entry.getAttribute( attributeDescription ), newRawValue );
-            }
-            else
-            {
-                EventRegistry.suspendEventFireingInCurrentThread();
-                IAttribute attribute = new Attribute( entry, attributeDescription );
-                entry.addAttribute( attribute );
-                EventRegistry.resumeEventFireingInCurrentThread();
-
-                Object newValue;
-                if ( entry.getConnection().getSchema().getAttributeTypeDescription( attributeDescription )
-                    .getSyntaxDescription().isString() )
-                {
-                    newValue = LdifUtils.utf8decode( ( byte[] ) newRawValue );
-                }
-                else
-                {
-                    newValue = ( byte[] ) newRawValue;
-                }
-
-                new CreateValuesJob( attribute, newValue ).execute();
-            }
-        }
-    }
-
-
-    private final void modify( IAttribute attribute, Object newRawValue ) throws ModelModificationException
-    {
-        if ( attribute != null && newRawValue != null && newRawValue instanceof byte[] )
-        {
-            if ( attribute.getValueSize() == 0 )
-            {
-                byte[] newValue = ( byte[] ) newRawValue;
-                new CreateValuesJob( attribute, newValue ).execute();
-            }
-            else if ( attribute.getValueSize() == 1 )
-            {
-                this.modifyValue( attribute.getValues()[0], newRawValue );
-            }
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void modifyValue( IValue oldValue, Object newRawValue ) throws ModelModificationException
-    {
-        if ( oldValue != null && newRawValue != null && newRawValue instanceof byte[] )
-        {
-            byte[] newValue = ( byte[] ) newRawValue;
-            IAttribute attribute = oldValue.getAttribute();
-            if ( !Utils.equals( oldValue.getBinaryValue(), newValue ) )
-            {
-                if ( oldValue.isEmpty() )
-                {
-                    EventRegistry.suspendEventFireingInCurrentThread();
-                    attribute.deleteEmptyValue();
-                    EventRegistry.resumeEventFireingInCurrentThread();
-                    new CreateValuesJob( attribute, newValue ).execute();
-                }
-                else
-                {
-                    new ModifyValueJob( attribute, oldValue, newValue ).execute();
-                }
-            }
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteAttribute( AttributeHierarchy ah ) throws ModelModificationException
-    {
-        if ( ah != null )
-        {
-            new DeleteAttributesValueJob( ah ).execute();
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteValue( IValue oldValue ) throws ModelModificationException
-    {
-        if ( oldValue != null )
-        {
-            new DeleteAttributesValueJob( oldValue ).execute();
         }
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractDialogStringValueEditor.java Sun Jul 15 09:15:39 2007
@@ -21,18 +21,8 @@
 package org.apache.directory.studio.valueeditors;
 
 
-import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
-import org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute;
-import org.apache.directory.studio.ldapbrowser.core.jobs.CreateValuesJob;
-import org.apache.directory.studio.ldapbrowser.core.jobs.DeleteAttributesValueJob;
-import org.apache.directory.studio.ldapbrowser.core.jobs.ModifyValueJob;
-import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
-import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
 
 
 /**
@@ -114,42 +104,6 @@
 
 
     /**
-     * {@inheritDoc}
-     * 
-     * This implementation returns the value itself if it is
-     * of type String. If the value is of type byte[] then the binary
-     * data is converted to a String using UTF-8 encoding.  
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        if ( value == null )
-        {
-            return null;
-        }
-        else if ( value instanceof String )
-        {
-            return value;
-        }
-        else if ( value instanceof byte[] )
-        {
-            String s = LdifUtils.utf8decode( ( byte[] ) value );
-            for ( int i = 0; i < s.length(); i++ )
-            {
-                if ( Character.isISOControl( s.charAt( i ) ) && s.charAt( i ) != '\n' && s.charAt( i ) != '\r' )
-                {
-                    return null;
-                }
-            }
-            return s;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-
-    /**
      * Small helper.
      */
     private boolean isEditable( byte[] b )
@@ -190,111 +144,6 @@
         else
         {
             return null;
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void createValue( IEntry entry, String attributeDescription, Object newRawValue )
-        throws ModelModificationException
-    {
-        if ( entry != null && attributeDescription != null && newRawValue != null && newRawValue instanceof String )
-        {
-            if ( entry.getAttribute( attributeDescription ) != null )
-            {
-                this.modify( entry.getAttribute( attributeDescription ), newRawValue );
-            }
-            else
-            {
-                EventRegistry.suspendEventFireingInCurrentThread();
-                IAttribute attribute = new Attribute( entry, attributeDescription );
-                entry.addAttribute( attribute );
-                EventRegistry.resumeEventFireingInCurrentThread();
-
-                Object newValue;
-                if ( entry.getConnection().getSchema().getAttributeTypeDescription( attributeDescription )
-                    .getSyntaxDescription().isString() )
-                {
-                    newValue = ( String ) newRawValue;
-                }
-                else
-                {
-                    newValue = LdifUtils.utf8encode( ( String ) newRawValue );
-                }
-
-                new CreateValuesJob( attribute, newValue ).execute();
-            }
-        }
-    }
-
-
-    private final void modify( IAttribute attribute, Object newRawValue ) throws ModelModificationException
-    {
-        if ( attribute != null && newRawValue != null && newRawValue instanceof String )
-        {
-            if ( attribute.getValueSize() == 0 )
-            {
-                String newValue = ( String ) newRawValue;
-                new CreateValuesJob( attribute, newValue ).execute();
-            }
-            else if ( attribute.getValueSize() == 1 )
-            {
-                this.modifyValue( attribute.getValues()[0], newRawValue );
-            }
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void modifyValue( IValue oldValue, Object newRawValue ) throws ModelModificationException
-    {
-        if ( oldValue != null && newRawValue != null && newRawValue instanceof String )
-        {
-
-            String newValue = ( String ) newRawValue;
-            IAttribute attribute = oldValue.getAttribute();
-            if ( !oldValue.getStringValue().equals( newValue ) )
-            {
-                if ( oldValue.isEmpty() )
-                {
-                    EventRegistry.suspendEventFireingInCurrentThread();
-                    attribute.deleteEmptyValue();
-                    EventRegistry.resumeEventFireingInCurrentThread();
-                    new CreateValuesJob( attribute, newValue ).execute();
-                }
-                else
-                {
-                    new ModifyValueJob( attribute, oldValue, newValue ).execute();
-                }
-            }
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteAttribute( AttributeHierarchy ah ) throws ModelModificationException
-    {
-        if ( ah != null )
-        {
-            new DeleteAttributesValueJob( ah ).execute();
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteValue( IValue oldValue ) throws ModelModificationException
-    {
-        if ( oldValue != null )
-        {
-            new DeleteAttributesValueJob( oldValue ).execute();
         }
     }
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/AbstractInPlaceStringValueEditor.java Sun Jul 15 09:15:39 2007
@@ -30,11 +30,7 @@
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
-import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.TextCellEditor;
@@ -51,12 +47,6 @@
 public abstract class AbstractInPlaceStringValueEditor extends TextCellEditor implements IValueEditor
 {
 
-    /** 
-     * @deprecated will be removed soon. Just used to delegate
-     *             createValue(), deleteValue() and modifyValue().
-     */
-    private TextValueEditor delegate;
-
     /** The name of this value editor */
     private String name;
 
@@ -70,7 +60,6 @@
     protected AbstractInPlaceStringValueEditor()
     {
         super();
-        this.delegate = new TextValueEditor();
     }
 
 
@@ -219,42 +208,6 @@
     /**
      * {@inheritDoc}
      * 
-     * This implementation returns the value itself if it is
-     * of type byte[] or a byte[] with the UTF-8 encoded string
-     * value if it is of type String.  
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        if ( value == null )
-        {
-            return null;
-        }
-        else if ( value instanceof String )
-        {
-            return value;
-        }
-        else if ( value instanceof byte[] )
-        {
-            String s = LdifUtils.utf8decode( ( byte[] ) value );
-            for ( int i = 0; i < s.length(); i++ )
-            {
-                if ( Character.isISOControl( s.charAt( i ) ) && s.charAt( i ) != '\n' && s.charAt( i ) != '\r' )
-                {
-                    return null;
-                }
-            }
-            return s;
-        }
-        else
-        {
-            return null;
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
      * This implementation always return the string value
      * as String.
      */
@@ -341,41 +294,5 @@
         return imageDescriptor;
     }
 
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void createValue( IEntry entry, String attributeDescription, Object newRawValue )
-        throws ModelModificationException
-    {
-        delegate.createValue( entry, attributeDescription, newRawValue );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteAttribute( AttributeHierarchy ah ) throws ModelModificationException
-    {
-        delegate.deleteAttribute( ah );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void deleteValue( IValue oldValue ) throws ModelModificationException
-    {
-        delegate.deleteValue( oldValue );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public final void modifyValue( IValue oldValue, Object newRawValue ) throws ModelModificationException
-    {
-        delegate.modifyValue( oldValue, newRawValue );
-    }
 
 }

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java Sun Jul 15 09:15:39 2007
@@ -22,9 +22,7 @@
 
 
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.swt.widgets.Composite;
@@ -160,62 +158,6 @@
      * @param imageDescriptor the editors image
      */
     public abstract void setValueEditorImageDescriptor( ImageDescriptor imageDescriptor );
-
-
-    /**
-     * Creates the attribute with the given value at the entry.
-     * 
-     * It is called from a ICellModifier if no attribute of value exists and
-     * the raw value returned by the CellEditor isn't null.
-     * 
-     * @param entry
-     * @param attributeDescription
-     * @param newRawValue
-     * @throws ModelModificationException
-     * @deprecated This functionality will be removed from IValueEditor soon.
-     */
-    public abstract void createValue( IEntry entry, String attributeDescription, Object newRawValue )
-        throws ModelModificationException;
-
-
-    /**
-     * Modifies the value and sets the given raw value
-     * 
-     * It is called from a ICellModfier if the value exists and the raw
-     * value returned by the CellEditor isn't null.
-     * 
-     * @param value
-     * @param newRawValue
-     * @throws ModelModificationException
-     * @deprecated This functionality will be removed from IValueEditor soon.
-     */
-    public abstract void modifyValue( IValue value, Object newRawValue ) throws ModelModificationException;
-
-
-    /**
-     * Deletes the attributes
-     * 
-     * It is called from a ICellModfier if the attribute exists and the raw
-     * value returned by the CellEditor is null.
-     * 
-     * @param attributeHierarchy the attribute hierarchy
-     * @throws ModelModificationException
-     * @deprecated This functionality will be removed from IValueEditor soon.
-     */
-    public abstract void deleteAttribute( AttributeHierarchy attributeHierarchy ) throws ModelModificationException;
-
-
-    /**
-     * Deletes the value
-     * 
-     * It is called from a ICellModfier if the value exists and the raw
-     * value returned by the CellEditor is null.
-     * 
-     * @param oldValue
-     * @throws ModelModificationException
-     * @deprecated This functionality will be removed from IValueEditor soon.
-     */
-    public abstract void deleteValue( IValue oldValue ) throws ModelModificationException;
 
 
     /**

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java Sun Jul 15 09:15:39 2007
@@ -29,10 +29,7 @@
 import org.apache.directory.studio.ldapbrowser.common.dialogs.MultivaluedDialog;
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
-import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
-import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.swt.widgets.Composite;
@@ -218,58 +215,6 @@
     public Object getRawValue( IValue value )
     {
         return null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
-     * It doesn't make sense to use the MultivaluedValueEditor with a single value.
-     * Returns null.
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        return null;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
-     * Modification is performed in the concrete single-ValueEditors.
-     */
-    public void modifyValue( IValue oldValue, Object newRawValue ) throws ModelModificationException
-    {
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
-     * Creationg is performed in the concrete single-ValueEditors.
-     */
-    public void createValue( IEntry entry, String attributeName, Object newRawValue ) throws ModelModificationException
-    {
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
-     * Deletion is performed in the concrete single-ValueEditors.
-     */
-    public void deleteAttribute( AttributeHierarchy ah ) throws ModelModificationException
-    {
-    }
-
-
-    /**
-     * {@inheritDoc}
-     * 
-     * Deletion is performed in the concrete single-ValueEditors.
-     */
-    public void deleteValue( IValue oldValue ) throws ModelModificationException
-    {
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java Sun Jul 15 09:15:39 2007
@@ -32,12 +32,21 @@
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.internal.model.Attribute;
+import org.apache.directory.studio.ldapbrowser.core.jobs.CreateValuesJob;
+import org.apache.directory.studio.ldapbrowser.core.jobs.DeleteAttributesValueJob;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ModifyValueJob;
 import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.ModelModificationException;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.LdapSyntaxDescription;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
+import org.apache.directory.studio.ldapbrowser.core.utils.LdifUtils;
+import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtension;
 import org.eclipse.core.runtime.IExtensionPoint;
@@ -188,7 +197,8 @@
 
         // check attribute preferences
         AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
-        Map attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getAttributeValueEditorMap();
+        Map attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+            .getAttributeValueEditorMap();
         if ( atd.getNumericOID() != null && attributeValueEditorMap.containsKey( atd.getNumericOID().toLowerCase() ) )
         {
             return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( atd.getNumericOID()
@@ -206,7 +216,8 @@
 
         // check syntax preferences
         LdapSyntaxDescription lsd = atd.getSyntaxDescription();
-        Map syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getSyntaxValueEditorMap();
+        Map syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
+            .getSyntaxValueEditorMap();
         if ( lsd.getNumericOID() != null && syntaxValueEditorMap.containsKey( lsd.getNumericOID().toLowerCase() ) )
         {
             return ( IValueEditor ) this.class2ValueEditors.get( syntaxValueEditorMap.get( lsd.getNumericOID()
@@ -359,7 +370,8 @@
 
         alternativeList.remove( getCurrentValueEditor( schema, attributeName ) );
 
-        return (org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList.toArray( new IValueEditor[alternativeList.size()] );
+        return ( org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList
+            .toArray( new IValueEditor[alternativeList.size()] );
     }
 
 
@@ -391,7 +403,8 @@
 
         alternativeList.remove( getCurrentValueEditor( value ) );
 
-        return (org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList.toArray( new IValueEditor[alternativeList.size()] );
+        return ( org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList
+            .toArray( new IValueEditor[alternativeList.size()] );
     }
 
 
@@ -494,6 +507,140 @@
 
 
     /**
+     * Creates the attribute with the given value at the entry.
+     * 
+     * It is called from a ICellModifier if no attribute of value exists and
+     * the raw value returned by the CellEditor isn't null.
+     * 
+     * @param newRawValue the new raw value
+     * @param entry the entry
+     * @param attributeDescription the attribute description
+     * 
+     * @throws ModelModificationException the model modification exception
+     */
+    public void createValue( IEntry entry, String attributeDescription, Object newRawValue )
+        throws ModelModificationException
+    {
+        if ( entry != null && attributeDescription != null && newRawValue != null
+            && ( newRawValue instanceof byte[] || newRawValue instanceof String ) )
+        {
+            if ( entry.getAttribute( attributeDescription ) != null )
+            {
+                IAttribute attribute = entry.getAttribute( attributeDescription );
+                if ( attribute != null )
+                {
+                    if ( attribute.getValueSize() == 0 )
+                    {
+                        new CreateValuesJob( attribute, newRawValue ).execute();
+                    }
+                    else if ( attribute.getValueSize() == 1 )
+                    {
+                        this.modifyValue( attribute.getValues()[0], newRawValue );
+                    }
+                }
+            }
+            else
+            {
+                EventRegistry.suspendEventFireingInCurrentThread();
+                IAttribute attribute = new Attribute( entry, attributeDescription );
+                entry.addAttribute( attribute );
+                EventRegistry.resumeEventFireingInCurrentThread();
+
+                Object newValue;
+                if ( entry.getConnection().getSchema().getAttributeTypeDescription( attributeDescription )
+                    .getSyntaxDescription().isString() )
+                {
+                    if ( newRawValue instanceof String )
+                    {
+                        newValue = ( String ) newRawValue;
+                    }
+                    else
+                    {
+                        newValue = LdifUtils.utf8decode( ( byte[] ) newRawValue );
+                    }
+                }
+                else
+                {
+                    if ( newRawValue instanceof String )
+                    {
+                        newValue = LdifUtils.utf8encode( ( String ) newRawValue );
+                    }
+                    else
+                    {
+                        newValue = ( byte[] ) newRawValue;
+                    }
+                }
+
+                new CreateValuesJob( attribute, newValue ).execute();
+            }
+        }
+    }
+
+
+    /**
+     * Modifies the value and sets the given raw value
+     * 
+     * It is called from a ICellModfier if the value exists and the raw
+     * value returned by the CellEditor isn't null.
+     * 
+     * @param oldValue the old value
+     * @param newRawValue the new raw value
+     */
+    public void modifyValue( IValue oldValue, Object newRawValue )
+    {
+        IAttribute attribute = oldValue.getAttribute();
+
+        boolean modify = false;
+        if ( oldValue != null && newRawValue != null && newRawValue instanceof byte[] )
+        {
+            byte[] newValue = ( byte[] ) newRawValue;
+            if ( !Utils.equals( oldValue.getBinaryValue(), newValue ) )
+            {
+                modify = true;
+            }
+        }
+        else if ( oldValue != null && newRawValue != null && newRawValue instanceof String )
+        {
+
+            String newValue = ( String ) newRawValue;
+            if ( !oldValue.getStringValue().equals( newValue ) )
+            {
+                modify = true;
+            }
+        }
+
+        if ( modify )
+        {
+            if ( oldValue.isEmpty() )
+            {
+                EventRegistry.suspendEventFireingInCurrentThread();
+                attribute.deleteEmptyValue();
+                EventRegistry.resumeEventFireingInCurrentThread();
+                new CreateValuesJob( attribute, newRawValue ).execute();
+            }
+            else
+            {
+                new ModifyValueJob( attribute, oldValue, newRawValue ).execute();
+            }
+        }
+    }
+
+
+    /**
+     * Deletes the attributes.
+     * 
+     * It is called from a ICellModfier if the attribute exists and the raw
+     * value returned by the CellEditor is null.
+     * 
+     * @param ah the attribute hierarchy
+     */
+    public void deleteAttribute( AttributeHierarchy ah )
+    {
+        new DeleteAttributesValueJob( ah ).execute();
+    }
+
+
+    /**
      * Creates and returns the value editors specified by value editors extensions.
      *
      * @param parent the parent composite
@@ -588,19 +735,19 @@
      */
     public static class ValueEditorExtension
     {
-        
+
         /** The name. */
         public String name = null;
-        
+
         /** The icon. */
         public ImageDescriptor icon = null;
-        
+
         /** The class name. */
         public String className = null;
-        
+
         /** The syntax oids. */
         public Collection<String> syntaxOids = new ArrayList<String>( 3 );
-        
+
         /** The attribute types. */
         public Collection<String> attributeTypes = new ArrayList<String>( 3 );
 

Modified: directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorCellModifier.java Sun Jul 15 09:15:39 2007
@@ -168,7 +168,6 @@
 
     public void modify( Object element, String property, Object newRawValue )
     {
-
         if ( element != null && element instanceof Item )
         {
             element = ( ( Item ) element ).getData();
@@ -176,25 +175,23 @@
 
         if ( element != null && element instanceof ISearchResult && property != null )
         {
-            ISearchResult result = ( ISearchResult ) element;
-            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
-
             try
             {
+                ISearchResult result = ( ISearchResult ) element;
+                AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
+
                 // switch operation:
                 if ( ah == null && newRawValue != null )
                 {
-                    this.valueEditorManager.getCurrentValueEditor( result.getEntry(), property ).createValue(
-                        result.getEntry(), property, newRawValue );
+                    this.valueEditorManager.createValue( result.getEntry(), property, newRawValue );
                 }
                 else if ( ah != null && newRawValue == null )
                 {
-                    this.valueEditorManager.getCurrentValueEditor( ah ).deleteAttribute( ah );
+                    this.valueEditorManager.deleteAttribute( ah );
                 }
                 else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
                 {
-                    this.valueEditorManager.getCurrentValueEditor( ah ).modifyValue( ah.getAttribute().getValues()[0],
-                        newRawValue );
+                    this.valueEditorManager.modifyValue( ah.getAttribute().getValues()[0], newRawValue );
                 }
             }
             catch ( ModelModificationException mme )

Modified: directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/dn/DnValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/dn/DnValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/dn/DnValueEditor.java (original)
+++ directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/dn/DnValueEditor.java Sun Jul 15 09:15:39 2007
@@ -126,23 +126,6 @@
 
 
     /**
-     * {@inheritDoc}
-     *
-     * Returns a DnValueEditorRawValueWrapper with the given
-     * connection and a DN build from the given value.
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        Object o = super.getRawValue( connection, value );
-        if ( o != null && o instanceof String )
-        {
-            return new DnValueEditorRawValueWrapper( connection, ( String ) o );
-        }
-
-        return null;
-    }
-
-    /**
      * The DnValueEditorRawValueWrapper is used to pass contextual
      * information to the opened DnDialog.
      *

Modified: directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java (original)
+++ directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/objectclass/ObjectClassValueEditor.java Sun Jul 15 09:15:39 2007
@@ -133,12 +133,7 @@
     }
 
 
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns a ObjectClassValueEditorRawValueWrapper.
-     */
-    public Object getRawValue( IConnection connection, Object value )
+    private Object getRawValue( IConnection connection, Object value )
     {
         Schema schema = null;
         if ( connection != null )

Modified: directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordValueEditor.java?view=diff&rev=556423&r1=556422&r2=556423
==============================================================================
--- directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordValueEditor.java (original)
+++ directory/studio/trunk/studio-valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordValueEditor.java Sun Jul 15 09:15:39 2007
@@ -23,7 +23,6 @@
 
 import org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
-import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
 import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.valueeditors.AbstractDialogBinaryValueEditor;
@@ -136,18 +135,6 @@
         return new PasswordValueEditorRawValueWrapper( password, value.getAttribute().getEntry() );
     }
 
-
-    /**
-     * {@inheritDoc}
-     * 
-     * Returns a PasswordValueEditorRawValueWrapper with 
-     * null entry.
-     */
-    public Object getRawValue( IConnection connection, Object value )
-    {
-        Object password = super.getRawValue( connection, value );
-        return new PasswordValueEditorRawValueWrapper( password, null );
-    }
 
     /**
      * The PasswordValueEditorRawValueWrapper is used to pass contextual 



Mime
View raw message