You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/04/09 11:49:57 UTC

svn commit: r526693 [17/17] - in /directory/ldapstudio/trunk/ldapstudio-browser-common: ./ META-INF/ resources/ resources/icons/ resources/templates/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/di...

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/IValueEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/IValueEditor.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/IValueEditor.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/IValueEditor.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,266 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.valueeditors;
+
+
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * A ValueEditor knows how to display and edit values of a LDAP attribute.
+ * ValueEditors are used from the entry editor or search result editor 
+ * to display and edit values in a user-friendly way.  
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IValueEditor
+{
+
+    /**
+     * Returns the string representation of the given attribute hierarchy 
+     * presented to the user.
+     * <p>
+     * This method is called from the search result editor. A attribute hierarchy may
+     * contain multiple attributes each with multiple values. It is common that
+     * a ValueEditor returns a comma-separated list.
+     * 
+     * @param attributeHierarchy the attribute hierarchy
+     * @return the string representation of the attribute hierarchy
+     */
+    public abstract String getDisplayValue( AttributeHierarchy attributeHierarchy );
+
+
+    /**
+     * Returns the string representation of the given value 
+     * presented to the user.
+     * <p>
+     * This method is called from the entry editor.
+     * 
+     * @param value the value
+     * @return the string representation of the value
+     */
+    public abstract String getDisplayValue( IValue value );
+
+
+    /**
+     * Returns the raw value if this value editor can handle the given 
+     * attribute hierarchy. The returned value is used as input for 
+     * the CellEditor returned by getCellEditor().
+     * <p>
+     * If this value editor can't handle the given attribute hierarchy
+     * it must return null. 
+     * <p>
+     * Note: It is also possilbe that the attribute hierarchy doesn't contain
+     * a value. This means the value is up to be created.
+     * <p>
+     * This method is called from the search result editor. It is common
+     * to return null if the attribute hierarchy contains more than 
+     * one value.
+     * 
+     * @param attributeHierarchy the attribute hierarchy
+     * @return the raw value of the attribute hierarchy or null
+     */
+    public abstract Object getRawValue( AttributeHierarchy attributeHierarchy );
+
+
+    /**
+     * Returns the raw value if this value editor can handle the given 
+     * value. The returned value is used as input for the CellEditor 
+     * returned by getCellEditor().
+     * <p>
+     * If this value editor can't handle the given value it must 
+     * return null. 
+     * <p>
+     * Note: It is also possible that the value is empty!
+     * <p>
+     * This method is called from the entry editor. 
+     * 
+     * @param value the value
+     * @return the raw value of the value or null
+     */
+    public abstract Object getRawValue( IValue value );
+
+
+    /**
+     * Returns the raw value if this value editor can handle the given 
+     * value. The returned value is used as input for the CellEditor 
+     * returned by getCellEditor().
+     * <p>
+     * If this value editor can't handle the given value it must 
+     * return null. 
+     * <p>
+     * This method is called from the LDIF editor. The connection object
+     * could be used for editors handling connection-dependent values. 
+     * 
+     * @param connection the connection
+     * @param stringOrBinaryValue the value either String or byte[]
+     * @return the raw value of the value or null
+     */
+    public abstract Object getRawValue( IConnection connection, Object stringOrBinaryValue );
+
+
+    /**
+     * Returns the String or binary byte[] value of the given raw value. 
+     * The return value is used to create,  modify or delete the value
+     * in directory.
+     * <p>
+     * This method is called after editing has been finished. The 
+     * given rawValue is the one returned by the CellEditor. 
+     * 
+     * @param rawValue the raw value return from cell editor
+     * @return the String or byte[] value
+     */
+    public abstract Object getStringOrBinaryValue( Object rawValue );
+
+
+    /**
+     * Returns the editors name, previously set with
+     * setValueEditorName().
+     * 
+     * @return the editors name
+     */
+    public abstract String getValueEditorName();
+
+
+    /**
+     * Sets the editors name. 
+     * 
+     * This method is called during initialization of the 
+     * value editor, the name specified in value editor
+     * extension is assigned. 
+     *
+     * @param name the editors name
+     */
+    public abstract void setValueEditorName( String name );
+
+
+    /**
+     * Returns the editors image, previously set with
+     * setValueEditorImageDescriptor().
+     * 
+     * @return the editors image
+     */
+    public abstract ImageDescriptor getValueEditorImageDescriptor();
+
+
+    /**
+     * Sets the editors image.
+     * 
+     * This method is called during initialization of the 
+     * value editor, the icon specified in value editor
+     * extension is assigned. 
+     *
+     * @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;
+
+
+    /**
+     * Creates the control for this value editor under the given parent control.
+     * 
+     * @param parent the parent control
+     */
+    public abstract void create( Composite parent );
+
+
+    /**
+     * Disposes of this value editor and frees any associated SWT resources.
+     */
+    public abstract void dispose();
+
+
+    /**
+     * Returns the JFace CellEditor that is able to handle values returned by
+     * one of the getRawValue() or the getEmptyRawValue() methods.
+     * 
+     * The object returned by the CellEditor's getValue() method is
+     * then sent to the getStringOrBinary() method to get the 
+     * directory value.
+     * 
+     * @return the JFace CellEditor
+     * 
+     */
+    public abstract CellEditor getCellEditor();
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/InPlaceTextValueEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/InPlaceTextValueEditor.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/InPlaceTextValueEditor.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/InPlaceTextValueEditor.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.valueeditors;
+
+
+
+
+/**
+ * The default editor for string values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class InPlaceTextValueEditor extends AbstractInPlaceStringValueEditor
+{
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/MultivaluedValueEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/MultivaluedValueEditor.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/MultivaluedValueEditor.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/MultivaluedValueEditor.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,323 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.valueeditors;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.ldapstudio.browser.common.dialogs.MultivaluedDialog;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy;
+import org.apache.directory.ldapstudio.browser.core.model.IAttribute;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.ModelModificationException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Special ValueEditor to handle attributes with multiple values in a dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MultivaluedValueEditor extends CellEditor implements IValueEditor
+{
+
+    /** The value to handle */
+    private Object value;
+
+    /** The parent composite, used to instanciate a new control */
+    private Composite parent;
+
+    /** The name of this value editor */
+    private String name;
+
+    /** The image of this value editor */
+    private ImageDescriptor imageDescriptor;
+
+    /** The value editor manager, used to get proper value editors */
+    protected ValueEditorManager valueEditorManager;
+
+
+    /**
+     * Creates a new instance of MultivaluedValueEditor.
+     *
+     * @param parent the parent composite
+     * @param valueEditorManager the value editor manager, used to get
+     *                           proper value editors
+     */
+    public MultivaluedValueEditor( Composite parent, ValueEditorManager valueEditorManager )
+    {
+        super( parent );
+        this.parent = parent;
+        this.valueEditorManager = valueEditorManager;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This is a dialog editor, it doesn't create a control. 
+     */
+    protected Control createControl( Composite parent )
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Returns the value object stored in a member.
+     */
+    protected final Object doGetValue()
+    {
+        return this.value;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This is a dialog editor, doesn't set focus. 
+     */
+    protected void doSetFocus()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Stores the value object in a member.
+     */
+    protected void doSetValue( Object value )
+    {
+        this.value = value;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Opens the MulitvaluedDialog. Expects that an AttributeHierarchy
+     * object is in value member. 
+     */
+    public void activate()
+    {
+        if ( this.getValue() != null && this.getValue() instanceof AttributeHierarchy )
+        {
+            AttributeHierarchy ah = ( AttributeHierarchy ) this.getValue();
+            if ( ah != null )
+            {
+                MultivaluedDialog dialog = new MultivaluedDialog( this.parent.getShell(), ah );
+                dialog.open();
+            }
+        }
+
+        fireCancelEditor();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Returns this.
+     */
+    public CellEditor getCellEditor()
+    {
+        return this;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation of getDisplayValue() returns a 
+     * comma-separated list of all values. 
+     */
+    public String getDisplayValue( AttributeHierarchy attributeHierarchy )
+    {
+
+        List<IValue> valueList = new ArrayList<IValue>();
+        for ( Iterator it = attributeHierarchy.iterator(); it.hasNext(); )
+        {
+            IAttribute attribute = ( IAttribute ) it.next();
+            valueList.addAll( Arrays.asList( attribute.getValues() ) );
+        }
+
+        StringBuffer sb = new StringBuffer();
+        if ( valueList.size() > 1 )
+            sb.append( valueList.size() + " values: " );
+        for ( Iterator it = valueList.iterator(); it.hasNext(); )
+        {
+            IValue value = ( IValue ) it.next();
+            IValueEditor vp = this.valueEditorManager.getCurrentValueEditor( value );
+            sb.append( vp.getDisplayValue( value ) );
+            if ( it.hasNext() )
+                sb.append( ", " );
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * It doesn't make sense to use the MultivaluedValueEditor with a single value.
+     * Returns an empty string.
+     */
+    public String getDisplayValue( IValue value )
+    {
+        return "";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Returns the attributeHierarchy.
+     */
+    public Object getRawValue( AttributeHierarchy attributeHierarchy )
+    {
+        return attributeHierarchy;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * It doesn't make sense to use the MultivaluedValueEditor with a single value.
+     * Returns null.
+     */
+    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
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Modification is performed in the concrete single-ValueEditors. No need 
+     * to return a value.
+     */
+    public Object getStringOrBinaryValue( Object rawValue )
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setValueEditorName( String name )
+    {
+        this.name = name;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getValueEditorName()
+    {
+        return name;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setValueEditorImageDescriptor( ImageDescriptor imageDescriptor )
+    {
+        this.imageDescriptor = imageDescriptor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getValueEditorImageDescriptor()
+    {
+        return imageDescriptor;
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/TextValueEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/TextValueEditor.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/TextValueEditor.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/TextValueEditor.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.valueeditors;
+
+
+import org.apache.directory.ldapstudio.browser.common.dialogs.TextDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * The default editor for string values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class TextValueEditor extends AbstractDialogStringValueEditor
+{
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation opens the TextDialog.
+     */
+    public boolean openDialog( Shell shell )
+    {
+        Object value = getValue();
+        if ( value != null && value instanceof String )
+        {
+            TextDialog dialog = new TextDialog( shell, ( String ) value );
+            if ( dialog.open() == TextDialog.OK && !"".equals( dialog.getText() ) )
+            {
+                setValue( dialog.getText() );
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorManager.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorManager.java?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorManager.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/java/org/apache/directory/ldapstudio/valueeditors/ValueEditorManager.java Mon Apr  9 02:49:48 2007
@@ -0,0 +1,605 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+
+package org.apache.directory.ldapstudio.valueeditors;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator;
+import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants;
+import org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy;
+import org.apache.directory.ldapstudio.browser.core.model.IEntry;
+import org.apache.directory.ldapstudio.browser.core.model.IValue;
+import org.apache.directory.ldapstudio.browser.core.model.schema.AttributeTypeDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.LdapSyntaxDescription;
+import org.apache.directory.ldapstudio.browser.core.model.schema.Schema;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * A ValueEditorManager is used to manage value editors. It provides methods to get
+ * the best or alternative value editors for a given attribute or value. It takes
+ * user preferences into account when determine the best value editor. At least
+ * it provides default text and binary value editors. 
+ * 
+ * The available value editors are specified by the extension point
+ * <code>org.apache.directory.ldapstudio.valueeditors</code>. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueEditorManager
+{
+    /** The extension point ID for value editors */
+    private static final String EXTENSION_POINT = "org.apache.directory.ldapstudio.valueeditors";
+
+    /** The composite used to create the value editors **/
+    private Composite parent;
+
+    /** 
+     * The value editor explicitly selected by the user. If this
+     * member is not null it is always returned as current value editor.
+     */
+    private IValueEditor userSelectedValueEditor;
+
+    /** The special value editor for multi-valued attributes */
+    private MultivaluedValueEditor multiValuedValueEditor;
+
+    /** The default string editor for single-line values */
+    private IValueEditor defaultStringSingleLineValueEditor;
+
+    /** The default string editor for multi-line values */
+    private IValueEditor defaultStringMultiLineValueEditor;
+
+    /** The default binary editor */
+    private IValueEditor defaultBinaryValueEditor;
+
+    /** A Map wich all available value editors. */
+    private Map<String, IValueEditor> class2ValueEditors;
+
+
+    /**
+     * Creates a new instance of ValueEditorManager.
+     *
+     * @param parent the composite used to create the value editors
+     */
+    public ValueEditorManager( Composite parent )
+    {
+        this.parent = parent;
+        userSelectedValueEditor = null;
+
+        // init value editor map
+        class2ValueEditors = new HashMap<String, IValueEditor>();
+        Collection<IValueEditor> valueEditors = createValueEditors( parent );
+        for ( IValueEditor valueEditor : valueEditors )
+        {
+            class2ValueEditors.put( valueEditor.getClass().getName(), valueEditor );
+        }
+
+        // special case: multivalued editor
+        multiValuedValueEditor = new MultivaluedValueEditor( this.parent, this );
+        multiValuedValueEditor.setValueEditorName( "Mulitvalued Editor" );
+        multiValuedValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_MULTIVALUEDEDITOR ) );
+
+        // get default editors from value editor map
+        defaultStringSingleLineValueEditor = class2ValueEditors.get( InPlaceTextValueEditor.class.getName() );
+        defaultStringMultiLineValueEditor = class2ValueEditors.get( TextValueEditor.class.getName() );
+        defaultBinaryValueEditor = class2ValueEditors.get( HexValueEditor.class.getName() );
+    }
+
+
+    /**
+     * Disposes all value editors.
+     */
+    public void dispose()
+    {
+        if ( this.parent != null )
+        {
+            this.userSelectedValueEditor = null;
+            this.multiValuedValueEditor.dispose();
+            this.defaultStringSingleLineValueEditor.dispose();
+            this.defaultStringMultiLineValueEditor.dispose();
+            this.defaultBinaryValueEditor.dispose();
+
+            for ( Iterator it = this.class2ValueEditors.values().iterator(); it.hasNext(); )
+            {
+                IValueEditor vp = ( IValueEditor ) it.next();
+                vp.dispose();
+            }
+
+            this.parent = null;
+        }
+    }
+
+
+    /**
+     * Sets the value editor explicitly selected by the user. Set 
+     * userSelectedValueEditor to null to remove the selection.
+     *
+     * @param userSelectedValueEditor the user selected value editor, may be null.
+     */
+    public void setUserSelectedValueEditor( IValueEditor userSelectedValueEditor )
+    {
+        this.userSelectedValueEditor = userSelectedValueEditor;
+    }
+
+
+    /**
+     * Returns the current (best) value editor for the given attribute.
+     * 
+     * <ol>
+     *  <li>If a user selected value editor is selected, this is returned.
+     *  <li>If a specific value editor is defined for the attribute type this 
+     *      value editor is returned. See preferences. 
+     *  <li>If a specific value editor is defined for the attribute's syntax this 
+     *      value editor is returned. See preferences. 
+     *  <li>Otherwise a default value editor is returned. If the attribute is 
+     *      binary the default Hex Editor is returned. Otherwise the default 
+     *      Text Editor is returned.
+     * </ol>
+     *
+     * @param schema the schema
+     * @param attributeType the attribute type
+     * @return the current value editor
+     */
+    public IValueEditor getCurrentValueEditor( Schema schema, String attributeType )
+    {
+
+        // check user-selected (forced) value editor
+        if ( this.userSelectedValueEditor != null )
+        {
+            return this.userSelectedValueEditor;
+        }
+
+        // check attribute preferences
+        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
+        Map attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getAttributeValueEditorMap();
+        if ( atd.getNumericOID() != null && attributeValueEditorMap.containsKey( atd.getNumericOID().toLowerCase() ) )
+        {
+            return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( atd.getNumericOID()
+                .toLowerCase() ) );
+        }
+        String[] names = atd.getNames();
+        for ( int i = 0; i < names.length; i++ )
+        {
+            if ( attributeValueEditorMap.containsKey( names[i].toLowerCase() ) )
+            {
+                return ( IValueEditor ) this.class2ValueEditors.get( attributeValueEditorMap.get( names[i]
+                    .toLowerCase() ) );
+            }
+        }
+
+        // check syntax preferences
+        LdapSyntaxDescription lsd = atd.getSyntaxDescription();
+        Map syntaxValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences().getSyntaxValueEditorMap();
+        if ( lsd.getNumericOID() != null && syntaxValueEditorMap.containsKey( lsd.getNumericOID().toLowerCase() ) )
+        {
+            return ( IValueEditor ) this.class2ValueEditors.get( syntaxValueEditorMap.get( lsd.getNumericOID()
+                .toLowerCase() ) );
+        }
+
+        // return default
+        if ( lsd.isBinary() )
+        {
+            return this.defaultBinaryValueEditor;
+        }
+        else
+        {
+            return this.defaultStringSingleLineValueEditor;
+        }
+
+    }
+
+
+    /**
+     * Returns the current (best) value editor for the given attribute.
+     * 
+     * @param entry the entry
+     * @param attributeType the attributge type
+     * @return the current value editor
+     * @see #getCurrentValueEditor( Schema, String )
+     */
+    public IValueEditor getCurrentValueEditor( IEntry entry, String attributeType )
+    {
+        return getCurrentValueEditor( entry.getConnection().getSchema(), attributeType );
+    }
+
+
+    /**
+     * Returns the current (best) value editor for the given value.
+     * 
+     * @param value the value
+     * @return the current value editor
+     * @see #getCurrentValueEditor( Schema, String )
+     */
+    public IValueEditor getCurrentValueEditor( IValue value )
+    {
+
+        IValueEditor ve = this.getCurrentValueEditor( value.getAttribute().getEntry(), value.getAttribute()
+            .getDescription() );
+
+        // here the value is known, we can check for single-line or multi-line
+        if ( ve == this.defaultStringSingleLineValueEditor )
+        {
+            if ( value.getStringValue().indexOf( '\n' ) == -1 && value.getStringValue().indexOf( '\r' ) == -1 )
+            {
+                ve = this.defaultStringSingleLineValueEditor;
+            }
+            else
+            {
+                ve = this.defaultStringMultiLineValueEditor;
+            }
+        }
+
+        return ve;
+    }
+
+
+    /**
+     * Returns the current (best) value editor for the given attribute.
+     * 
+     * @param attributeHierarchy the attribute hierarchy
+     * @return the current value editor
+     * @see #getCurrentValueEditor( Schema, String )
+     */
+    public IValueEditor getCurrentValueEditor( AttributeHierarchy attributeHierarchy )
+    {
+        if ( attributeHierarchy == null )
+        {
+            return null;
+        }
+        else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 )
+        {
+            return this.getCurrentValueEditor( attributeHierarchy.getAttribute().getEntry(), attributeHierarchy
+                .getAttribute().getDescription() );
+        }
+        else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 1 )
+        {
+            // special case objectClass and RDN: always return MV-editor
+            // perhaps this should be moved somewhere else
+            if ( attributeHierarchy.getAttribute().isObjectClassAttribute() )
+            {
+                return this.multiValuedValueEditor;
+            }
+            if ( attributeHierarchy.getAttribute().getValues()[0].isRdnPart() )
+            {
+                return this.multiValuedValueEditor;
+            }
+
+            return this.getCurrentValueEditor( attributeHierarchy.getAttribute().getValues()[0] );
+        }
+        else
+        {
+            return this.multiValuedValueEditor;
+        }
+    }
+
+
+    /**
+     * Returns alternative value editors for the given attribute. For now these
+     * are the three default editors.
+     *
+     * @param entry the entry
+     * @param attributeName the attribute
+     * @return alternative value editors
+     */
+    public IValueEditor[] getAlternativeValueEditors( IEntry entry, String attributeName )
+    {
+        Schema schema = entry.getConnection().getSchema();
+        return getAlternativeValueEditors( schema, attributeName );
+    }
+
+
+    /**
+     * Returns alternative value editors for the given attribute. For now these
+     * are the three default editors.
+     * 
+     * @param schema the schema
+     * @param attributeName the attribute
+     * @return alternative value editors
+     */
+    public IValueEditor[] getAlternativeValueEditors( Schema schema, String attributeName )
+    {
+        List<IValueEditor> alternativeList = new ArrayList<IValueEditor>();
+
+        AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeName );
+
+        if ( atd.getSyntaxDescription().isBinary() )
+        {
+            alternativeList.add( this.defaultBinaryValueEditor );
+            alternativeList.add( this.defaultStringSingleLineValueEditor );
+            alternativeList.add( this.defaultStringMultiLineValueEditor );
+        }
+        else if ( atd.getSyntaxDescription().isString() )
+        {
+            alternativeList.add( this.defaultStringSingleLineValueEditor );
+            alternativeList.add( this.defaultStringMultiLineValueEditor );
+            alternativeList.add( this.defaultBinaryValueEditor );
+        }
+
+        alternativeList.add( this.multiValuedValueEditor );
+
+        alternativeList.remove( getCurrentValueEditor( schema, attributeName ) );
+
+        return (org.apache.directory.ldapstudio.valueeditors.IValueEditor[] ) alternativeList.toArray( new IValueEditor[alternativeList.size()] );
+    }
+
+
+    /**
+     * Returns alternative value editors for the given value. For now these
+     * are the three default editors.
+     *
+     * @param value the value
+     * @return lternative value editors
+     */
+    public IValueEditor[] getAlternativeValueEditors( IValue value )
+    {
+        List<IValueEditor> alternativeList = new ArrayList<IValueEditor>();
+
+        if ( value.isBinary() )
+        {
+            alternativeList.add( this.defaultBinaryValueEditor );
+            alternativeList.add( this.defaultStringSingleLineValueEditor );
+            alternativeList.add( this.defaultStringMultiLineValueEditor );
+        }
+        else if ( value.isString() )
+        {
+            alternativeList.add( this.defaultStringSingleLineValueEditor );
+            alternativeList.add( this.defaultStringMultiLineValueEditor );
+            alternativeList.add( this.defaultBinaryValueEditor );
+        }
+
+        alternativeList.add( this.multiValuedValueEditor );
+
+        alternativeList.remove( getCurrentValueEditor( value ) );
+
+        return (org.apache.directory.ldapstudio.valueeditors.IValueEditor[] ) alternativeList.toArray( new IValueEditor[alternativeList.size()] );
+    }
+
+
+    /**
+     * Returns alternative value editors for the given value. For now these
+     * are the three default editors.
+     * 
+     * @param ah the attribute hierarchy
+     * @return alternative value editors
+     */
+    public IValueEditor[] getAlternativeValueEditors( AttributeHierarchy ah )
+    {
+        if ( ah == null )
+        {
+            return new IValueEditor[0];
+        }
+        else if ( ah.size() == 1 && ah.getAttribute().getValueSize() == 0 )
+        {
+            return this.getAlternativeValueEditors( ah.getAttribute().getEntry(), ah.getAttribute().getDescription() );
+        }
+        else if ( ah.size() == 1 && ah.getAttribute().getValueSize() == 1 )
+        {
+
+            // special case objectClass and RDN: no alternative to the MV-Editor
+            // perhaps this should be moved somewhere else
+            if ( ah.getAttribute().isObjectClassAttribute() )
+            {
+                return new IValueEditor[0];
+            }
+            if ( ah.getAttribute().getValues()[0].isRdnPart() )
+            {
+                return new IValueEditor[0];
+            }
+
+            return this.getAlternativeValueEditors( ah.getAttribute().getValues()[0] );
+        }
+        else
+        /* if(attribute.getValueSize() > 1) */{
+            return new IValueEditor[0];
+        }
+    }
+
+
+    /**
+     * Returns all available value editors.
+     *
+     * @return all available value editors
+     */
+    public IValueEditor[] getAllValueEditors()
+    {
+        // use a set to avoid double entries
+        Set<IValueEditor> list = new LinkedHashSet<IValueEditor>();
+
+        list.add( this.defaultStringSingleLineValueEditor );
+        list.add( this.defaultStringMultiLineValueEditor );
+        list.add( defaultBinaryValueEditor );
+
+        list.addAll( this.class2ValueEditors.values() );
+
+        list.add( this.multiValuedValueEditor );
+
+        return list.toArray( new IValueEditor[list.size()] );
+    }
+
+
+    /**
+     * Returns the default binary editor (a HexEditor).
+     *
+     * @return the default binary editor
+     */
+    public IValueEditor getDefaultBinaryValueEditor()
+    {
+        return defaultBinaryValueEditor;
+    }
+
+
+    /**
+     * Returns the default string editor (a TextEditor).
+     *
+     * @return the default string editor
+     */
+    public IValueEditor getDefaultStringValueEditor()
+    {
+        return defaultStringMultiLineValueEditor;
+    }
+
+
+    /**
+     * Returns the multi-valued editor.
+     *
+     * @return the multi-valued editor
+     */
+    public MultivaluedValueEditor getMultiValuedValueEditor()
+    {
+        return multiValuedValueEditor;
+    }
+
+
+    /**
+     * Creates and returns the value editors specified by value editors extensions.
+     *
+     * @param parent the parent composite
+     * @return the value editors
+     */
+    private Collection<IValueEditor> createValueEditors( Composite parent )
+    {
+        Collection<IValueEditor> valueEditors = new ArrayList<IValueEditor>();
+
+        Collection<ValueEditorExtension> valueEditorProxys = getValueEditorProxys();
+        for ( ValueEditorExtension proxy : valueEditorProxys )
+        {
+            try
+            {
+                IValueEditor valueEditor = ( IValueEditor ) proxy.member.createExecutableExtension( "class" );
+                valueEditor.create( parent );
+                valueEditor.setValueEditorName( proxy.name );
+                valueEditor.setValueEditorImageDescriptor( proxy.icon );
+                valueEditors.add( valueEditor );
+            }
+            catch ( Exception e )
+            {
+                BrowserCommonActivator.getDefault().getLog().log(
+                    new Status( IStatus.ERROR, BrowserCommonActivator.PLUGIN_ID, 1, "Unable to create ValueEditor "
+                        + proxy.className, e ) );
+            }
+        }
+
+        return valueEditors;
+    }
+
+
+    /**
+     * Returns all value editor proxies specified by value editor extensions.
+     *
+     * @return the value editor proxies
+     */
+    public static Collection<ValueEditorExtension> getValueEditorProxys()
+    {
+        Collection<ValueEditorExtension> valueEditorProxies = new ArrayList<ValueEditorExtension>();
+
+        IExtensionRegistry registry = Platform.getExtensionRegistry();
+        IExtensionPoint extensionPoint = registry.getExtensionPoint( EXTENSION_POINT );
+        IConfigurationElement[] members = extensionPoint.getConfigurationElements();
+
+        // For each extension:
+        for ( int m = 0; m < members.length; m++ )
+        {
+            ValueEditorExtension proxy = new ValueEditorExtension();
+            valueEditorProxies.add( proxy );
+
+            IConfigurationElement member = members[m];
+            IExtension extension = member.getDeclaringExtension();
+            String extendingPluginId = extension.getNamespaceIdentifier();
+
+            proxy.member = member;
+            proxy.name = member.getAttribute( "name" );
+            String iconPath = member.getAttribute( "icon" );
+            proxy.icon = AbstractUIPlugin.imageDescriptorFromPlugin( extendingPluginId, iconPath );
+            if ( proxy.icon == null )
+            {
+                proxy.icon = ImageDescriptor.getMissingImageDescriptor();
+            }
+            proxy.className = member.getAttribute( "class" );
+
+            IConfigurationElement[] children = member.getChildren();
+            for ( int c = 0; c < children.length; c++ )
+            {
+                IConfigurationElement element = children[c];
+                String type = element.getName();
+                if ( "syntax".equals( type ) )
+                {
+                    String syntaxOID = element.getAttribute( "syntaxOID" );
+                    proxy.syntaxOids.add( syntaxOID );
+                }
+                else if ( "attribute".equals( type ) )
+                {
+                    String attributeType = element.getAttribute( "attributeType" );
+                    proxy.attributeTypes.add( attributeType );
+                }
+            }
+        }
+
+        return valueEditorProxies;
+    }
+
+    /**
+     * This class is a bean to hold the data defined in value editor extension 
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
+    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 );
+
+        /** The configuration element. */
+        private IConfigurationElement member = null;
+    }
+
+}

Added: directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/resources/valueEditors.exsd
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/resources/valueEditors.exsd?view=auto&rev=526693
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/resources/valueEditors.exsd (added)
+++ directory/ldapstudio/trunk/ldapstudio-browser-common/src/main/resources/valueEditors.exsd Mon Apr  9 02:49:48 2007
@@ -0,0 +1,191 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.directory.ldapstudio.valueeditors">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.apache.directory.ldapstudio.valueeditors" id="valueEditors" name="Value Editors"/>
+      </appInfo>
+      <documentation>
+         A ValueEditor knows how to display and edit values of an LDAP attribute .ValueEditors are used from the entry editor or search result editor to display values to edit values in a user-friendly way.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <complexType>
+         <sequence>
+            <element ref="valueEditor" minOccurs="1" maxOccurs="unbounded"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The extension-point of this extension.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  Extension identifier.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  Name of this extension.
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="valueEditor">
+      <annotation>
+         <appInfo>
+            <meta.element labelAttribute="name" icon="icon"/>
+         </appInfo>
+      </annotation>
+      <complexType>
+         <sequence minOccurs="1" maxOccurs="unbounded">
+            <choice>
+               <element ref="syntax"/>
+               <element ref="attribute"/>
+            </choice>
+         </sequence>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The name of the function.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="icon" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="resource"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The specific class implementing the function.
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn="org.apache.directory.ldapstudio.valueeditors.IValueEditor"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="syntax">
+      <annotation>
+         <appInfo>
+            <meta.element labelAttribute="syntaxOID"/>
+         </appInfo>
+      </annotation>
+      <complexType>
+         <attribute name="syntaxOID" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="attribute">
+      <annotation>
+         <appInfo>
+            <meta.element labelAttribute="attributeType"/>
+         </appInfo>
+      </annotation>
+      <complexType>
+         <attribute name="attributeType" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="since"/>
+      </appInfo>
+      <documentation>
+         0.6.0
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="examples"/>
+      </appInfo>
+      <documentation>
+         &lt;p&gt;
+&lt;pre&gt;
+   &lt;extension
+       point=&quot;org.apache.directory.ldapstudio.valueeditors&quot;&gt;
+
+    &lt;valueEditor
+          name=&quot;Text Editor&quot;
+          icon=&quot;resources/icons/texteditor.gif&quot;
+          class=&quot;oorg.apache.directory.ldapstudio.valueeditors.TextValueEditor&quot;
+          /&gt;
+   &lt;/extension&gt;         
+&lt;/pre&gt;
+&lt;p&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="apiInfo"/>
+      </appInfo>
+      <documentation>
+         Extension callback objects implement the org.apache.directory.ldapstudio.valueeditors.IValueEditor interface. There are also abstract base classes in org.apache.directory.ldapstudio.valueeditors package.
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="implementation"/>
+      </appInfo>
+      <documentation>
+         
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  &quot;License&quot;); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+      </documentation>
+   </annotation>
+
+</schema>