directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r592079 [12/17] - in /directory/sandbox/felixk/studio-ldapbrowser-common: ./ META-INF/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/directory/ src/main/java/org/apache/directory/studio/...
Date Mon, 05 Nov 2007 16:48:54 GMT
Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,417 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.connection;
+
+
+import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.ConnectionParameter;
+import org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage;
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.common.jobs.RunnableContextJobAdapter;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.AliasesDereferencingWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.LimitWidget;
+import org.apache.directory.studio.ldapbrowser.common.widgets.search.ReferralsHandlingWidget;
+import org.apache.directory.studio.ldapbrowser.core.jobs.FetchBaseDNsJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.AliasDereferencingMethod;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection.ReferralHandlingMethod;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.BrowserConnection;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+
+
+/**
+ * The BrowserParameterPage is used the edit the browser specific parameters of a
+ * connection.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BrowserParameterPage extends AbstractConnectionParameterPage
+{
+
+    /** The checkbox to fetch the base DN's from namingContexts whenever opening the connection */
+    private Button autoFetchBaseDnsButton;
+
+    /** The button to fetch the base DN's from namingContexts attribute */
+    private Button fetchBaseDnsButton;
+
+    /** The combo that displays the fetched base DN's */
+    private Combo baseDNCombo;
+
+    /** The widget with the count and time limits */
+    private LimitWidget limitWidget;
+
+    /** The widget to select the alias dereferencing method */
+    private AliasesDereferencingWidget aliasesDereferencingWidget;
+
+    /** The widget to select the referrals handling method */
+    private ReferralsHandlingWidget referralsHandlingWidget;
+
+
+    /**
+     * Creates a new instance of BrowserParameterPage.
+     */
+    public BrowserParameterPage()
+    {
+    }
+
+
+    /**
+     * Returns true if base DN's should be fetched 
+     * whenever opening the connection.
+     * 
+     * @return true, if base DN's should be fetched
+     */
+    private boolean isAutoFetchBaseDns()
+    {
+        return autoFetchBaseDnsButton.getSelection();
+    }
+
+
+    /**
+     * Gets the base DN.
+     * 
+     * @return the base DN
+     */
+    private String getBaseDN()
+    {
+        return isAutoFetchBaseDns() ? null : baseDNCombo.getText();
+    }
+
+
+    /**
+     * Gets the count limit.
+     * 
+     * @return the count limit
+     */
+    private int getCountLimit()
+    {
+        return limitWidget.getCountLimit();
+    }
+
+
+    /**
+     * Gets the time limit.
+     * 
+     * @return the time limit
+     */
+    private int getTimeLimit()
+    {
+        return limitWidget.getTimeLimit();
+    }
+
+
+    /**
+     * Gets the aliases dereferencing method.
+     * 
+     * @return the aliases dereferencing method
+     */
+    private AliasDereferencingMethod getAliasesDereferencingMethod()
+    {
+        return aliasesDereferencingWidget.getAliasesDereferencingMethod();
+    }
+
+
+    /**
+     * Gets the referrals handling method.
+     * 
+     * @return the referrals handling method
+     */
+    private ReferralHandlingMethod getReferralsHandlingMethod()
+    {
+        return referralsHandlingWidget.getReferralsHandlingMethod();
+    }
+
+
+    /**
+     * Gets a temporary connection with all conection parameter 
+     * entered in this page. 
+     *
+     * @return a test connection
+     */
+    private Connection getTestConnection()
+    {
+        ConnectionParameter cp = connectionParameterPageModifyListener.getTestConnectionParameters();
+        Connection conn = new Connection( cp );
+        return conn;
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     */
+    public void createComposite( Composite parent )
+    {
+        addBaseDNInput( parent );
+        addLimitInput( parent );
+        validate();
+    }
+
+
+    /**
+     * Adds the base DN input.
+     * 
+     * @param parent the parent
+     */
+    private void addBaseDNInput( Composite parent )
+    {
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
+
+        Group group = BaseWidgetUtils.createGroup( composite, "Base DN", 1 );
+        Composite groupComposite = BaseWidgetUtils.createColumnContainer( group, 3, 1 );
+        GridData gd;
+
+        autoFetchBaseDnsButton = BaseWidgetUtils.createCheckbox( groupComposite, "Get base DNs from Root DSE", 2 );
+        autoFetchBaseDnsButton.setSelection( true );
+        autoFetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent arg0 )
+            {
+                connectionPageModified();
+            }
+        } );
+
+        fetchBaseDnsButton = new Button( groupComposite, SWT.PUSH );
+        fetchBaseDnsButton.setText( "Fetch Base DNs" );
+        fetchBaseDnsButton.setEnabled( true );
+        gd = new GridData();
+        gd.horizontalAlignment = SWT.RIGHT;
+        fetchBaseDnsButton.setLayoutData( gd );
+        fetchBaseDnsButton.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent e )
+            {
+                Connection connection = getTestConnection();
+                IBrowserConnection browserConnection = new BrowserConnection( connection );
+
+                FetchBaseDNsJob job = new FetchBaseDNsJob( browserConnection );
+                RunnableContextJobAdapter.execute( job, runnableContext );
+                if ( job.getExternalResult().isOK() )
+                {
+                    if ( job.getBaseDNs().length > 0 )
+                    {
+                        String[] baseDNs = job.getBaseDNs();
+                        baseDNCombo.setItems( baseDNs );
+                        baseDNCombo.select( 0 );
+
+                        String msg = "The server returned the following base DNs:";
+                        for ( int i = 0; i < baseDNs.length; i++ )
+                        {
+                            msg += "\n  - " + baseDNs[i];
+                        }
+                        MessageDialog.openInformation( Display.getDefault().getActiveShell(), "Fetch Base DNs", msg );
+                    }
+                    else
+                    {
+                        MessageDialog.openWarning( Display.getDefault().getActiveShell(), "Fetch Base DNs",
+                            "No base DN returned from server. Please enter the base DN manually." );
+                        autoFetchBaseDnsButton.setSelection( false );
+                    }
+                }
+            }
+        } );
+
+        BaseWidgetUtils.createLabel( groupComposite, "Base DN:", 1 );
+        baseDNCombo = BaseWidgetUtils.createCombo( groupComposite, new String[0], 0, 2 );
+        baseDNCombo.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent event )
+            {
+                connectionPageModified();
+            }
+        } );
+    }
+
+
+    /**
+     * Adds the limit input.
+     * 
+     * @param parent the parent
+     */
+    public void addLimitInput( Composite parent )
+    {
+        Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+
+        limitWidget = new LimitWidget();
+        limitWidget.createWidget( composite );
+
+        aliasesDereferencingWidget = new AliasesDereferencingWidget();
+        aliasesDereferencingWidget.createWidget( composite );
+
+        referralsHandlingWidget = new ReferralsHandlingWidget();
+        referralsHandlingWidget.createWidget( composite );
+    }
+
+
+    /**
+     * Called when an input field was modified.
+     */
+    private void connectionPageModified()
+    {
+        validate();
+        fireConnectionPageModified();
+    }
+
+
+    /**
+     * Validates the input fields after each modification.
+     */
+    private void validate()
+    {
+        // set enabled/disabled state of fields and buttons
+        baseDNCombo.setEnabled( !isAutoFetchBaseDns() );
+
+        // validate input fields
+        message = null;
+        errorMessage = null;
+        if ( !isAutoFetchBaseDns() )
+        {
+            if( !LdapDN.isValid( getBaseDN() ) )
+            {
+                message = "Please enter a valid base DN.";
+            }
+        }
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     */
+    public void loadParameters( ConnectionParameter parameter )
+    {
+        this.connectionParameter = parameter;
+
+        boolean fetchBaseDns = parameter
+            .getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_BASE_DNS );
+        autoFetchBaseDnsButton.setSelection( fetchBaseDns );
+        String baseDn = parameter.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_BASE_DN );
+        baseDNCombo.setText( baseDn != null ? baseDn : "" );
+
+        int countLimit = parameter.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_COUNT_LIMIT );
+        limitWidget.setCountLimit( countLimit );
+        int timeLimit = parameter.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_TIME_LIMIT );
+        limitWidget.setTimeLimit( timeLimit );
+
+        int referralsHandlingMethodOrdinal = parameter
+            .getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
+        ReferralHandlingMethod referralsHandlingMethod = ReferralHandlingMethod
+            .getByOrdinal( referralsHandlingMethodOrdinal );
+        referralsHandlingWidget.setReferralsHandlingMethod( referralsHandlingMethod );
+
+        int aliasesDereferencingMethodOrdinal = parameter
+            .getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD );
+        AliasDereferencingMethod aliasesDereferencingMethod = AliasDereferencingMethod
+            .getByOrdinal( aliasesDereferencingMethodOrdinal );
+        aliasesDereferencingWidget.setAliasesDereferencingMethod( aliasesDereferencingMethod );
+
+        connectionPageModified();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#saveParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     */
+    public void saveParameters( ConnectionParameter parameter )
+    {
+        parameter
+            .setExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_BASE_DNS, isAutoFetchBaseDns() );
+        parameter.setExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_BASE_DN, getBaseDN() );
+        parameter.setExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_COUNT_LIMIT, getCountLimit() );
+        parameter.setExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_TIME_LIMIT, getTimeLimit() );
+        parameter.setExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD,
+            getReferralsHandlingMethod().getOrdinal() );
+        parameter.setExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD,
+            getAliasesDereferencingMethod().getOrdinal() );
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#saveDialogSettings()
+     */
+    public void saveDialogSettings()
+    {
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#setFocus()
+     */
+    public void setFocus()
+    {
+        baseDNCombo.setFocus();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#areParametersModifed()
+     */
+    public boolean areParametersModifed()
+    {
+        int countLimit = connectionParameter
+            .getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_COUNT_LIMIT );
+        int timeLimit = connectionParameter.getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_TIME_LIMIT );
+        int referralsHandlingMethodOrdinal = connectionParameter
+            .getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_REFERRALS_HANDLING_METHOD );
+        ReferralHandlingMethod referralsHandlingMethod = ReferralHandlingMethod
+            .getByOrdinal( referralsHandlingMethodOrdinal );
+        int aliasesDereferencingMethodOrdinal = connectionParameter
+            .getExtendedIntProperty( IBrowserConnection.CONNECTION_PARAMETER_ALIASES_DEREFERENCING_METHOD );
+        AliasDereferencingMethod aliasesDereferencingMethod = AliasDereferencingMethod
+            .getByOrdinal( aliasesDereferencingMethodOrdinal );
+        aliasesDereferencingWidget.setAliasesDereferencingMethod( aliasesDereferencingMethod );
+
+        return isReconnectionRequired() || countLimit != getCountLimit() || timeLimit != getTimeLimit()
+            || referralsHandlingMethod != getReferralsHandlingMethod()
+            || aliasesDereferencingMethod != getAliasesDereferencingMethod();
+    }
+
+
+    /**
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#isReconnectionRequired()
+     */
+    public boolean isReconnectionRequired()
+    {
+        if ( connectionParameter == null )
+        {
+            return true;
+        }
+
+        boolean fetchBaseDns = connectionParameter
+            .getExtendedBoolProperty( IBrowserConnection.CONNECTION_PARAMETER_FETCH_BASE_DNS );
+        String baseDn = connectionParameter.getExtendedProperty( IBrowserConnection.CONNECTION_PARAMETER_BASE_DN );
+        return fetchBaseDns != isAutoFetchBaseDns() || ( baseDn == null && getBaseDN() != null )
+            || ( baseDn != null && getBaseDN() == null )
+            || ( baseDn != getBaseDN() && !( baseDn.equals( getBaseDN() ) ) );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/BrowserParameterPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ConnectionUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ConnectionUniversalListener.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ConnectionUniversalListener.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ConnectionUniversalListener.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,137 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.connection;
+
+
+
+
+/**
+ * The ConnectionUniversalListener manages all events for the connection widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ConnectionUniversalListener{private ConnectionUniversalListener(){}}
+//implements ConnectionUpdateListener, EntryUpdateListener,
+//    SearchUpdateListener, BookmarkUpdateListener
+//{
+//
+//    /** The table viewer */
+//    protected TableViewer viewer;
+//
+//
+//    /**
+//     * Creates a new instance of ConnectionUniversalListener.
+//     *
+//     * @param viewer the table viewer
+//     */
+//    public ConnectionUniversalListener( TableViewer viewer )
+//    {
+//        this.viewer = viewer;
+//
+//        EventRegistry.addConnectionUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+//        EventRegistry.addEntryUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+//        EventRegistry.addSearchUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+//        EventRegistry.addBookmarkUpdateListener( this, BrowserCommonActivator.getDefault().getEventRunner() );
+//    }
+//
+//
+//    /**
+//     * Disposes this universal listener.
+//     */
+//    public void dispose()
+//    {
+//        if ( viewer != null )
+//        {
+//            EventRegistry.removeConnectionUpdateListener( this );
+//            EventRegistry.removeEntryUpdateListener( this );
+//            EventRegistry.removeSearchUpdateListener( this );
+//            EventRegistry.removeBookmarkUpdateListener( this );
+//            viewer = null;
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     *
+//     * This implementation refreshes the viewer. If a new connection was added
+//     * this connection is selected.
+//     */
+//    public void connectionUpdated( ConnectionUpdateEvent connectionUpdateEvent )
+//    {
+//        if ( viewer != null )
+//        {
+//            viewer.refresh();
+//            if ( connectionUpdateEvent.getDetail() == ConnectionUpdateEvent.EventDetail.CONNECTION_ADDED )
+//            {
+//                viewer.setSelection( new StructuredSelection( connectionUpdateEvent.getConnection() ) );
+//            }
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     *
+//     * This implementation refreshes the viewer.
+//     */
+//    public void entryUpdated( EntryModificationEvent event )
+//    {
+//        if ( viewer != null )
+//        {
+//            viewer.refresh();
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     *
+//     * This implementation refreshes the viewer.
+//     */
+//    public void searchUpdated( SearchUpdateEvent searchUpdateEvent )
+//    {
+//        if ( viewer != null )
+//        {
+//            viewer.refresh();
+//
+//            // select the right connection
+//            ISearch search = searchUpdateEvent.getSearch();
+//            viewer.setSelection( new StructuredSelection( search.getConnection() ), true );
+//        }
+//    }
+//
+//
+//    /**
+//     * {@inheritDoc}
+//     *
+//     * This implementation refreshes the viewer.
+//     */
+//    public void bookmarkUpdated( BookmarkUpdateEvent bookmarkUpdateEvent )
+//    {
+//        if ( viewer != null )
+//        {
+//            viewer.refresh();
+//        }
+//    }
+//
+//}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/connection/ConnectionUniversalListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/AbstractOpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/AbstractOpenEditorAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/AbstractOpenEditorAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/AbstractOpenEditorAction.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,200 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+
+
+/**
+ * The base class for all value editor actions of the entry editor widget.
+ * It manages activation and closing of value editors. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractOpenEditorAction extends BrowserAction implements FocusListener, KeyListener
+{
+
+    /** The value editor manager. */
+    protected ValueEditorManager valueEditorManager;
+
+    /** The viewer. */
+    protected TreeViewer viewer;
+
+    /** The cell editor. */
+    protected CellEditor cellEditor;
+
+
+    /**
+     * Creates a new instance of AbstractOpenEditorAction.
+     * 
+     * @param viewer the viewer
+     * @param valueEditorManager the value editor manager
+     */
+    protected AbstractOpenEditorAction( TreeViewer viewer, ValueEditorManager valueEditorManager )
+    {
+        this.viewer = viewer;
+        this.valueEditorManager = valueEditorManager;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        valueEditorManager = null;
+        viewer = null;
+        cellEditor = null;
+        super.dispose();
+    }
+
+
+    /**
+     * Gets the cell editor.
+     * 
+     * @return the cell editor
+     */
+    public CellEditor getCellEditor()
+    {
+        return cellEditor;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        activateEditor();
+    }
+
+
+    /**
+     * Activates the editor.
+     */
+    private void activateEditor()
+    {
+
+        if ( !viewer.isCellEditorActive()
+            && getSelectedValues().length == 1
+            && getSelectedAttributes().length == 0
+            && viewer.getCellModifier().canModify( getSelectedValues()[0],
+                EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME ) )
+        {
+
+            // set cell editor to viewer
+            viewer.getCellEditors()[EntryEditorWidgetTableMetadata.VALUE_COLUMN_INDEX] = cellEditor;
+
+            // add listener for end of editing
+            if ( cellEditor.getControl() != null )
+            {
+                cellEditor.getControl().addFocusListener( this );
+                cellEditor.getControl().addKeyListener( this );
+            }
+
+            // start editing
+            viewer.editElement( getSelectedValues()[0], EntryEditorWidgetTableMetadata.VALUE_COLUMN_INDEX );
+
+            if ( !viewer.isCellEditorActive() )
+            {
+                editorClosed();
+            }
+        }
+        else
+        {
+            valueEditorManager.setUserSelectedValueEditor( null );
+        }
+    }
+
+
+    /**
+     * Editor closed.
+     */
+    private void editorClosed()
+    {
+
+        // remove cell editors from viewer to prevend auto-editing
+        for ( int i = 0; i < viewer.getCellEditors().length; i++ )
+        {
+            viewer.getCellEditors()[i] = null;
+        }
+
+        // remove listener
+        if ( cellEditor.getControl() != null )
+        {
+            cellEditor.getControl().removeFocusListener( this );
+            cellEditor.getControl().removeKeyListener( this );
+        }
+
+        // reset custom value editor and set selection to notify all
+        // openeditoractions to update their enabled state.
+        valueEditorManager.setUserSelectedValueEditor( null );
+        viewer.setSelection( viewer.getSelection() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void focusGained( FocusEvent e )
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void focusLost( FocusEvent e )
+    {
+        editorClosed();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void keyPressed( KeyEvent e )
+    {
+        if ( e.character == SWT.ESC && e.stateMask == SWT.NONE )
+        {
+            e.doit = false;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void keyReleased( KeyEvent e )
+    {
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/AbstractOpenEditorAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EditAttributeDescriptionAction.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EditAttributeDescriptionAction.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EditAttributeDescriptionAction.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EditAttributeDescriptionAction.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,142 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.apache.directory.studio.ldapbrowser.common.wizards.AttributeWizard;
+import org.apache.directory.studio.ldapbrowser.core.jobs.RenameValuesJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * This Action is used to edit an attribute description within the entry edtitor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EditAttributeDescriptionAction extends BrowserAction
+{
+
+    /** To avoid duplicate implementations of the isEnabled() code we use a delete action */
+    private EntryEditorActionProxy deleteActionProxy;
+
+
+    /**
+     * Creates a new instance of EditAttributeDescriptionAction.
+     * 
+     * @param viewer the viewer
+     */
+    public EditAttributeDescriptionAction( Viewer viewer )
+    {
+        deleteActionProxy = new EntryEditorActionProxy( viewer, null, new DeleteAction() );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getCommandId()
+    {
+        return BrowserCommonConstants.ACTION_ID_EDIT_ATTRIBUTE_DESCRIPTION;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getText()
+    {
+        return "Edit Attribute Description";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean isEnabled()
+    {
+        return deleteActionProxy.getAction().isEnabled();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void run()
+    {
+        if ( getSelectedAttributes().length == 1 )
+        {
+            renameValues( getSelectedAttributes()[0].getValues() );
+        }
+        else if ( getSelectedValues().length > 0 )
+        {
+            renameValues( getSelectedValues() );
+        }
+    }
+
+
+    /**
+     * Rename the given values.
+     * 
+     * @param values the values
+     */
+    private void renameValues( final IValue[] values )
+    {
+        AttributeWizard wizard = new AttributeWizard( "Edit Attribute Description", true, false, values[0]
+            .getAttribute().getDescription(), values[0].getAttribute().getEntry() );
+        WizardDialog dialog = new WizardDialog( Display.getDefault().getActiveShell(), wizard );
+        dialog.setBlockOnOpen( true );
+        dialog.create();
+        if ( dialog.open() == Dialog.OK )
+        {
+            String newAttributeName = wizard.getAttributeDescription();
+            if ( newAttributeName != null && !"".equals( newAttributeName )
+                && !newAttributeName.equals( values[0].getAttribute().getDescription() ) )
+            {
+                new RenameValuesJob( values[0].getAttribute().getEntry(), values, newAttributeName ).execute();
+            }
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EditAttributeDescriptionAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidget.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidget.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidget.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidget.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,211 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.widgets.ViewFormWidget;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+
+/**
+ * The EntryEditorWidget is a reusable widget to display and edit the attributes of an entry.
+ * It is used by 
+ * {@link org.apache.directory.studio.ldapbrowser.ui.editors.entry.EntryEditor}, 
+ * {@link org.apache.directory.studio.ldapbrowser.common.dialogs.MultivaluedDialog}, 
+ * {@link org.apache.directory.studio.ldapbrowser.common.dialogs.LdifEntryEditorDialog} and 
+ * {@link org.apache.directory.studio.ldapbrowser.common.wizards.NewEntryAttributesWizardPage}. 
+ * 
+ * It provides a context menu and a local toolbar with actions to
+ * manage attributes. Further there is an instant search feature to filter 
+ * the visible attributes.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidget extends ViewFormWidget
+{
+
+    /** The configuration. */
+    private EntryEditorWidgetConfiguration configuration;
+
+    /** The quick filter widget. */
+    private EntryEditorWidgetQuickFilterWidget quickFilterWidget;
+
+    /** The tree. */
+    private Tree tree;
+
+    /** The viewer. */
+    private TreeViewer viewer;
+
+
+    /**
+     * Creates a new instance of EntryEditorWidget.
+     * 
+     * @param configuration the configuration
+     */
+    public EntryEditorWidget( EntryEditorWidgetConfiguration configuration )
+    {
+        this.configuration = configuration;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected Control createContent( Composite parent )
+    {
+        quickFilterWidget = new EntryEditorWidgetQuickFilterWidget( configuration.getFilter(), this );
+        quickFilterWidget.createComposite( parent );
+
+        // create tree widget and viewer
+        tree = new Tree( parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION
+            | SWT.HIDE_SELECTION );
+        GridData data = new GridData( GridData.FILL_BOTH );
+        data.widthHint = 450;
+        data.heightHint = 250;
+        tree.setLayoutData( data );
+        tree.setHeaderVisible( true );
+        tree.setLinesVisible( true );
+        viewer = new TreeViewer( tree );
+        viewer.setUseHashlookup( true );
+
+        // set tree columns
+        for ( int i = 0; i < EntryEditorWidgetTableMetadata.COLUM_NAMES.length; i++ )
+        {
+            TreeColumn column = new TreeColumn( tree, SWT.LEFT, i );
+            column.setText( EntryEditorWidgetTableMetadata.COLUM_NAMES[i] );
+            column.setWidth( 200 );
+            column.setResizable( true );
+
+        }
+        viewer.setColumnProperties( EntryEditorWidgetTableMetadata.COLUM_NAMES );
+        tree.addControlListener( new ControlAdapter()
+        {
+            public void controlResized( ControlEvent e )
+            {
+                if ( tree.getClientArea().width > 0 )
+                {
+                    int width = tree.getClientArea().width - 2 * tree.getBorderWidth();
+                    if ( tree.getVerticalBar().isVisible() )
+                    {
+                        width -= tree.getVerticalBar().getSize().x;
+                    }
+                    tree.getColumn( EntryEditorWidgetTableMetadata.VALUE_COLUMN_INDEX ).setWidth(
+                        width - tree.getColumn( EntryEditorWidgetTableMetadata.KEY_COLUMN_INDEX ).getWidth() );
+                }
+            }
+        } );
+
+        // setup sorter, filter and layout
+        configuration.getSorter().connect( viewer );
+        configuration.getFilter().connect( viewer );
+        configuration.getPreferences().connect( viewer );
+
+        // setup providers
+        viewer.setContentProvider( configuration.getContentProvider( this ) );
+        viewer.setLabelProvider( configuration.getLabelProvider( viewer ) );
+
+        // set table cell editors
+        viewer.setCellModifier( configuration.getCellModifier( viewer ) );
+        CellEditor[] editors = new CellEditor[EntryEditorWidgetTableMetadata.COLUM_NAMES.length];
+        viewer.setCellEditors( editors );
+
+        return tree;
+
+    }
+
+
+    /**
+     * Sets the focus to the tree viewer.
+     */
+    public void setFocus()
+    {
+        viewer.getTree().setFocus();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose()
+    {
+        if ( viewer != null )
+        {
+            configuration.dispose();
+            configuration = null;
+
+            if ( quickFilterWidget != null )
+            {
+                quickFilterWidget.dispose();
+                quickFilterWidget = null;
+            }
+
+            tree.dispose();
+            tree = null;
+            viewer = null;
+        }
+
+        super.dispose();
+    }
+
+
+    /**
+     * Gets the viewer.
+     * 
+     * @return the viewer
+     */
+    public TreeViewer getViewer()
+    {
+        return viewer;
+    }
+
+
+    /**
+     * Gets the quick filter widget.
+     * 
+     * @return the quick filter widget
+     */
+    public EntryEditorWidgetQuickFilterWidget getQuickFilterWidget()
+    {
+        return quickFilterWidget;
+    }
+
+
+    /**
+     * Enables or disables this widget.
+     *
+     * @param enabled true to enable this widget, false to disable this widget
+     */
+    public void setEnabled( boolean enabled )
+    {
+        tree.setEnabled( enabled );
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,439 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.common.actions.CopyAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.NewValueAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.PasteAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.PropertiesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.SelectAllAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.ShowRawValuesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.ValueEditorPreferencesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.BrowserActionProxy;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.apache.directory.studio.valueeditors.IValueEditor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.commands.ICommandService;
+
+
+/**
+ * The EntryEditorWidgetActionGroup manages all actions of the entry editor widget.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetActionGroup implements ActionHandlerManager
+{
+
+    /** The open sort dialog action. */
+    protected OpenSortDialogAction openSortDialogAction;
+
+    /** The show raw values action. */
+    protected ShowRawValuesAction showRawValuesAction;
+
+    /** The show quick filter action. */
+    protected ShowQuickFilterAction showQuickFilterAction;
+
+    /** The open default editor action. */
+    protected EntryEditorActionProxy openDefaultValueEditorActionProxy;
+
+    /** The open best editor action. */
+    protected EntryEditorActionProxy openBestValueEditorActionProxy;
+
+    /** The open editor actions. */
+    protected EntryEditorActionProxy[] openValueEditorActionProxies;
+
+    /** The open value editor preferences action. */
+    protected ValueEditorPreferencesAction openValueEditorPreferencesAction;
+
+    /** The Constant newValueAction. */
+    protected final static String newValueAction = "newValueAction";
+
+    /** The Constant copyAction. */
+    protected final static String copyAction = "copyAction";
+
+    /** The Constant pasteAction. */
+    protected final static String pasteAction = "pasteAction";
+
+    /** The Constant deleteAction. */
+    protected final static String deleteAction = "deleteAction";
+
+    /** The Constant selectAllAction. */
+    protected final static String selectAllAction = "selectAllAction";
+
+    /** The Constant propertyDialogAction. */
+    protected final static String propertyDialogAction = "propertyDialogAction";
+
+    /** The entry editor action map. */
+    protected Map<String, EntryEditorActionProxy> entryEditorActionMap;
+
+    /** The action bars. */
+    protected IActionBars actionBars;
+
+    /** The main widget. */
+    private EntryEditorWidget mainWidget;
+
+
+    /**
+     * Creates a new instance of EntryEditorWidgetActionGroup.
+     * 
+     * @param mainWidget the main widget
+     * @param configuration the configuration
+     */
+    public EntryEditorWidgetActionGroup( EntryEditorWidget mainWidget, EntryEditorWidgetConfiguration configuration )
+    {
+        this.mainWidget = mainWidget;
+
+        entryEditorActionMap = new HashMap<String, EntryEditorActionProxy>();
+        TreeViewer viewer = mainWidget.getViewer();
+
+        openSortDialogAction = new OpenSortDialogAction( configuration.getPreferences() );
+        showRawValuesAction = new ShowRawValuesAction();
+        showQuickFilterAction = new ShowQuickFilterAction( mainWidget.getQuickFilterWidget() );
+
+        openBestValueEditorActionProxy = new EntryEditorActionProxy( viewer, this, new OpenBestEditorAction( viewer,
+            configuration.getValueEditorManager( viewer ) ) );
+        openDefaultValueEditorActionProxy = new EntryEditorActionProxy( viewer, this, new OpenDefaultEditorAction(
+            viewer, openBestValueEditorActionProxy, false ) );
+        IValueEditor[] valueEditors = configuration.getValueEditorManager( viewer ).getAllValueEditors();
+        openValueEditorActionProxies = new EntryEditorActionProxy[valueEditors.length];
+        for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+        {
+            openValueEditorActionProxies[i] = new EntryEditorActionProxy( viewer, this, new OpenEditorAction( viewer,
+                configuration.getValueEditorManager( viewer ), valueEditors[i] ) );
+        }
+        openValueEditorPreferencesAction = new ValueEditorPreferencesAction();
+
+        entryEditorActionMap.put( newValueAction, new EntryEditorActionProxy( viewer, this, new NewValueAction() ) );
+
+        entryEditorActionMap.put( pasteAction, new EntryEditorActionProxy( viewer, this, new PasteAction() ) );
+        entryEditorActionMap.put( copyAction, new EntryEditorActionProxy( viewer, this, new CopyAction(
+            ( BrowserActionProxy ) entryEditorActionMap.get( pasteAction ) ) ) );
+        entryEditorActionMap.put( deleteAction, new EntryEditorActionProxy( viewer, this, new DeleteAction() ) );
+        entryEditorActionMap.put( selectAllAction, new EntryEditorActionProxy( viewer, this, new SelectAllAction(
+            viewer ) ) );
+
+        entryEditorActionMap.put( propertyDialogAction, new EntryEditorActionProxy( viewer, this,
+            new PropertiesAction() ) );
+    }
+
+
+    /**
+     * Disposes this action group.
+     */
+    public void dispose()
+    {
+        if ( mainWidget != null )
+        {
+            openSortDialogAction = null;
+            showQuickFilterAction.dispose();
+            showQuickFilterAction = null;
+            showRawValuesAction = null;
+
+            openDefaultValueEditorActionProxy.dispose();
+            openDefaultValueEditorActionProxy = null;
+            openBestValueEditorActionProxy.dispose();
+            openBestValueEditorActionProxy = null;
+            for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+            {
+                openValueEditorActionProxies[i].dispose();
+                openValueEditorActionProxies[i] = null;
+            }
+            openValueEditorPreferencesAction = null;
+
+            for ( Iterator it = entryEditorActionMap.keySet().iterator(); it.hasNext(); )
+            {
+                String key = ( String ) it.next();
+                EntryEditorActionProxy action = ( EntryEditorActionProxy ) entryEditorActionMap.get( key );
+                action.dispose();
+                action = null;
+                it.remove();
+            }
+            entryEditorActionMap.clear();
+            entryEditorActionMap = null;
+
+            actionBars = null;
+            mainWidget = null;
+        }
+    }
+
+
+    /**
+     * Enables global action handlers.
+     * 
+     * @param actionBars the action bars
+     */
+    public void enableGlobalActionHandlers( IActionBars actionBars )
+    {
+        this.actionBars = actionBars;
+        activateGlobalActionHandlers();
+    }
+
+
+    /**
+     * Fill the tool bar.
+     * 
+     * @param toolBarManager the tool bar manager
+     */
+    public void fillToolBar( IToolBarManager toolBarManager )
+    {
+        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( showQuickFilterAction );
+        toolBarManager.update( true );
+    }
+
+
+    /**
+     * Fills the menu.
+     * 
+     * @param menuManager the menu manager
+     */
+    public void fillMenu( IMenuManager menuManager )
+    {
+        menuManager.add( openSortDialogAction );
+        menuManager.add( showRawValuesAction );
+        menuManager.addMenuListener( new IMenuListener()
+        {
+            public void menuAboutToShow( IMenuManager manager )
+            {
+                showRawValuesAction.setChecked( BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+                    BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) );
+            }
+        } );
+    }
+
+
+    /**
+     * Fills the context menu. Adds a menu listener to the given menu manager
+     * to fill the context menu whenever it pops up.
+     * 
+     * @param menuManager the menu manager
+     */
+    public void fillContextMenu( IMenuManager menuManager )
+    {
+        menuManager.setRemoveAllWhenShown( true );
+        menuManager.addMenuListener( new IMenuListener()
+        {
+            public void menuAboutToShow( IMenuManager manager )
+            {
+                contextMenuAboutToShow( manager );
+            }
+        } );
+    }
+
+
+    /**
+     * Fills the context menu.
+     * 
+     * @param menuManager the menu manager
+     */
+    protected void contextMenuAboutToShow( IMenuManager menuManager )
+    {
+        // new
+        menuManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        menuManager.add( new Separator() );
+
+        // copy, paste, delete
+        menuManager.add( ( IAction ) entryEditorActionMap.get( copyAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( pasteAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( selectAllAction ) );
+        menuManager.add( new Separator() );
+
+        // edit
+        addEditMenu( menuManager );
+        menuManager.add( new Separator() );
+
+        // properties
+        menuManager.add( ( IAction ) entryEditorActionMap.get( propertyDialogAction ) );
+    }
+
+
+    /**
+     * Adds the value editors to the menu.
+     * 
+     * @param menuManager the menu manager
+     */
+    protected void addEditMenu( IMenuManager menuManager )
+    {
+        menuManager.add( openDefaultValueEditorActionProxy );
+        MenuManager editorMenuManager = new MenuManager( "Edit Value With" );
+        if ( openBestValueEditorActionProxy.isEnabled() )
+        {
+            editorMenuManager.add( openBestValueEditorActionProxy );
+            editorMenuManager.add( new Separator() );
+        }
+        for ( int i = 0; i < openValueEditorActionProxies.length; i++ )
+        {
+            if ( openValueEditorActionProxies[i].isEnabled()
+                && ( ( OpenEditorAction ) openValueEditorActionProxies[i].getAction() ).getValueEditor().getClass() != ( ( OpenBestEditorAction ) openBestValueEditorActionProxy
+                    .getAction() ).getBestValueEditor().getClass() )
+            {
+                editorMenuManager.add( openValueEditorActionProxies[i] );
+            }
+        }
+        editorMenuManager.add( new Separator() );
+        editorMenuManager.add( openValueEditorPreferencesAction );
+        menuManager.add( editorMenuManager );
+    }
+
+
+    /**
+     * Activates global action handlers.
+     */
+    public void activateGlobalActionHandlers()
+    {
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+
+        if ( actionBars != null )
+        {
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) entryEditorActionMap
+                .get( copyAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), ( IAction ) entryEditorActionMap
+                .get( pasteAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), ( IAction ) entryEditorActionMap
+                .get( deleteAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), ( IAction ) entryEditorActionMap
+                .get( selectAllAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) entryEditorActionMap
+                .get( propertyDialogAction ) );
+            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), showQuickFilterAction ); // IWorkbenchActionDefinitionIds.FIND_REPLACE
+
+            actionBars.updateActionBars();
+        }
+        else
+        {
+            if ( commandService != null )
+            {
+                IAction da = ( IAction ) entryEditorActionMap.get( deleteAction );
+                da.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.delete" );
+                commandService.getCommand( da.getActionDefinitionId() ).setHandler( new ActionHandler( da ) );
+
+                IAction ca = ( IAction ) entryEditorActionMap.get( copyAction );
+                ca.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.copy" );
+                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( new ActionHandler( ca ) );
+
+                IAction pa = ( IAction ) entryEditorActionMap.get( pasteAction );
+                pa.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.paste" );
+                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( new ActionHandler( pa ) );
+
+                showQuickFilterAction.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.find" );
+                commandService.getCommand( showQuickFilterAction.getActionDefinitionId() ).setHandler(
+                    new ActionHandler( showQuickFilterAction ) );
+
+                IAction pda = ( IAction ) entryEditorActionMap.get( propertyDialogAction );
+                pda.setActionDefinitionId( "org.apache.directory.studio.ldapbrowser.action.properties" );
+                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( new ActionHandler( pda ) );
+            }
+        }
+
+        if ( commandService != null )
+        {
+            IAction nva = ( IAction ) entryEditorActionMap.get( newValueAction );
+            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) );
+            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler(
+                new ActionHandler( openDefaultValueEditorActionProxy ) );
+        }
+    }
+
+
+    /**
+     * Deactivates global action handlers.
+     */
+    public void deactivateGlobalActionHandlers()
+    {
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+
+        if ( actionBars != null )
+        {
+            actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.SELECT_ALL.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), null );
+            actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), null );
+
+            actionBars.updateActionBars();
+        }
+        else
+        {
+            if ( commandService != null )
+            {
+                IAction da = ( IAction ) entryEditorActionMap.get( deleteAction );
+                commandService.getCommand( da.getActionDefinitionId() ).setHandler( null );
+
+                IAction ca = ( IAction ) entryEditorActionMap.get( copyAction );
+                commandService.getCommand( ca.getActionDefinitionId() ).setHandler( null );
+
+                IAction pa = ( IAction ) entryEditorActionMap.get( pasteAction );
+                commandService.getCommand( pa.getActionDefinitionId() ).setHandler( null );
+
+                commandService.getCommand( showQuickFilterAction.getActionDefinitionId() ).setHandler( null );
+
+                IAction pda = ( IAction ) entryEditorActionMap.get( propertyDialogAction );
+                commandService.getCommand( pda.getActionDefinitionId() ).setHandler( null );
+            }
+        }
+
+        if ( commandService != null )
+        {
+            IAction nva = ( IAction ) entryEditorActionMap.get( newValueAction );
+            commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null );
+            commandService.getCommand( openDefaultValueEditorActionProxy.getActionDefinitionId() ).setHandler( null );
+        }
+    }
+
+
+    /**
+     * Gets the open default editor action.
+     * 
+     * @return the open default editor action
+     */
+    public OpenDefaultEditorAction getOpenDefaultEditorAction()
+    {
+        return ( OpenDefaultEditorAction ) openDefaultValueEditorActionProxy.getAction();
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroup.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,162 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.common.actions.DeleteAllValuesAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.NewAttributeAction;
+import org.apache.directory.studio.ldapbrowser.common.actions.proxy.EntryEditorActionProxy;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.commands.ActionHandler;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+
+
+/**
+ * This class manages all the actions of the attribute page of the new entry wizard.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetActionGroupWithAttribute extends EntryEditorWidgetActionGroup
+{
+
+    /** The Constant editAttributeDescriptionAction. */
+    private static final String editAttributeDescriptionAction = "editAttributeDescriptionAction";
+
+    /** The Constant newAttributeAction. */
+    private static final String newAttributeAction = "newAttributeAction";
+
+    /** The Constant deleteAllValuesAction. */
+    private static final String deleteAllValuesAction = "deleteAllValuesAction";
+
+
+    /**
+     * 
+     * Creates a new instance of NewEntryAttributesWizardPageActionGroup.
+     *
+     * @param mainWidget
+     * @param configuration
+     */
+    public EntryEditorWidgetActionGroupWithAttribute( EntryEditorWidget mainWidget,
+        EntryEditorWidgetConfiguration configuration )
+    {
+        super( mainWidget, configuration );
+        TreeViewer viewer = mainWidget.getViewer();
+
+        entryEditorActionMap.put( editAttributeDescriptionAction, new EntryEditorActionProxy( viewer, this,
+            new EditAttributeDescriptionAction( viewer ) ) );
+        entryEditorActionMap.put( newAttributeAction, new EntryEditorActionProxy( viewer, this,
+            new NewAttributeAction() ) );
+        entryEditorActionMap.put( deleteAllValuesAction, new EntryEditorActionProxy( viewer, this,
+            new DeleteAllValuesAction() ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void fillToolBar( IToolBarManager toolBarManager )
+    {
+        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        toolBarManager.add( ( IAction ) entryEditorActionMap.get( newAttributeAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( ( IAction ) this.entryEditorActionMap.get( deleteAction ) );
+        toolBarManager.add( ( IAction ) this.entryEditorActionMap.get( deleteAllValuesAction ) );
+        toolBarManager.add( new Separator() );
+        toolBarManager.add( this.showQuickFilterAction );
+        toolBarManager.update( true );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void contextMenuAboutToShow( IMenuManager menuManager )
+    {
+        // new
+        menuManager.add( ( IAction ) entryEditorActionMap.get( newAttributeAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( newValueAction ) );
+        menuManager.add( new Separator() );
+
+        // copy, paste, delete
+        menuManager.add( ( IAction ) entryEditorActionMap.get( copyAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( pasteAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( deleteAction ) );
+        menuManager.add( ( IAction ) entryEditorActionMap.get( selectAllAction ) );
+        MenuManager copyMenuManager = new MenuManager( "Advanced" );
+        copyMenuManager.add( ( IAction ) entryEditorActionMap.get( deleteAllValuesAction ) );
+        menuManager.add( copyMenuManager );
+        menuManager.add( new Separator() );
+
+        // edit
+        menuManager.add( ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction ) );
+        super.addEditMenu( menuManager );
+        menuManager.add( new Separator() );
+
+        // properties
+        menuManager.add( ( IAction ) entryEditorActionMap.get( propertyDialogAction ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void activateGlobalActionHandlers()
+    {
+        super.activateGlobalActionHandlers();
+
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
+            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( new ActionHandler( naa ) );
+            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
+            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( new ActionHandler( eada ) );
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void deactivateGlobalActionHandlers()
+    {
+        super.deactivateGlobalActionHandlers();
+
+        ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter(
+            ICommandService.class );
+        if ( commandService != null )
+        {
+            IAction naa = ( IAction ) entryEditorActionMap.get( newAttributeAction );
+            commandService.getCommand( naa.getActionDefinitionId() ).setHandler( null );
+            IAction eada = ( IAction ) entryEditorActionMap.get( editAttributeDescriptionAction );
+            commandService.getCommand( eada.getActionDefinitionId() ).setHandler( null );
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetActionGroupWithAttribute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,148 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.swt.widgets.Item;
+
+
+/**
+ * The EntryEditorWidgetCellModifier implements the {@link ICellModifier} interface
+ * for the entry editor widget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetCellModifier implements ICellModifier
+{
+
+    /** The value editor manager. */
+    private ValueEditorManager valueEditorManager;
+
+
+    /**
+     * Creates a new instance of EntryEditorWidgetCellModifier.
+     *
+     * @param valueEditorManager
+     */
+    public EntryEditorWidgetCellModifier( ValueEditorManager valueEditorManager )
+    {
+        this.valueEditorManager = valueEditorManager;
+    }
+
+
+    /**
+     * Disposes this object.
+     */
+    public void dispose()
+    {
+        valueEditorManager = null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean canModify( Object element, String property )
+    {
+        if ( element != null && element instanceof IValue && valueEditorManager != null )
+        {
+            IValue attributeValue = ( IValue ) element;
+
+            if ( !SchemaUtils.isModifyable( attributeValue.getAttribute().getAttributeTypeDescription() ) )
+            {
+                return false;
+            }
+            if ( attributeValue.isRdnPart() )
+            {
+                return false;
+            }
+            if ( EntryEditorWidgetTableMetadata.KEY_COLUMN_NAME.equals( property ) )
+            {
+                return false;
+            }
+            if ( EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME.equals( property ) )
+            {
+                return this.valueEditorManager.getCurrentValueEditor( attributeValue ).getRawValue( attributeValue ) != null;
+            }
+        }
+
+        return false;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object getValue( Object element, String property )
+    {
+        if ( element != null && element instanceof IValue && valueEditorManager != null )
+        {
+            IValue attributeValue = ( IValue ) element;
+            Object returnValue;
+            if ( EntryEditorWidgetTableMetadata.KEY_COLUMN_NAME.equals( property ) )
+            {
+                returnValue = attributeValue.getAttribute().getDescription();
+            }
+            else if ( EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME.equals( property ) )
+            {
+                returnValue = this.valueEditorManager.getCurrentValueEditor( attributeValue ).getRawValue(
+                    attributeValue );
+            }
+            else
+            {
+                returnValue = "";
+            }
+            return returnValue;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void modify( Object element, String property, Object newRawValue )
+    {
+        if ( element != null && element instanceof Item )
+        {
+            element = ( ( Item ) element ).getData();
+        }
+
+        if ( element != null && element instanceof IValue && valueEditorManager != null )
+        {
+            IValue oldValue = ( IValue ) element;
+
+            if ( EntryEditorWidgetTableMetadata.VALUE_COLUMN_NAME.equals( property ) )
+            {
+                valueEditorManager.modifyValue( oldValue, newRawValue );
+            }
+        }
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetCellModifier.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java?rev=592079&view=auto
==============================================================================
--- directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java (added)
+++ directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java Mon Nov  5 08:48:35 2007
@@ -0,0 +1,245 @@
+/*
+ *  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.studio.ldapbrowser.common.widgets.entryeditor;
+
+
+import org.apache.directory.studio.valueeditors.ValueEditorManager;
+import org.eclipse.jface.viewers.TreeViewer;
+
+
+/**
+ * The BrowserConfiguration contains the content provider, 
+ * label provider, sorter, filter the context menu manager and the
+ * preferences for the entry editor widget. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryEditorWidgetConfiguration
+{
+
+    /** The disposed flag */
+    private boolean disposed = false;
+
+    /** The sorter. */
+    protected EntryEditorWidgetSorter sorter;
+
+    /** The filter. */
+    protected EntryEditorWidgetFilter filter;
+
+    /** The preferences. */
+    protected EntryEditorWidgetPreferences preferences;
+
+    /** The content provider. */
+    protected EntryEditorWidgetContentProvider contentProvider;
+
+    /** The label provider. */
+    protected EntryEditorWidgetLabelProvider labelProvider;
+
+    /** The cell modifier. */
+    protected EntryEditorWidgetCellModifier cellModifier;
+
+    /** The value editor manager. */
+    protected ValueEditorManager valueEditorManager;
+
+
+    /**
+     * Creates a new instance of EntryEditorWidgetConfiguration.
+     */
+    public EntryEditorWidgetConfiguration()
+    {
+    }
+
+
+    /**
+     * Disposes this configuration.
+     */
+    public void dispose()
+    {
+        if ( !disposed )
+        {
+            if ( sorter != null )
+            {
+                sorter.dispose();
+                sorter = null;
+            }
+
+            if ( filter != null )
+            {
+                filter.dispose();
+                filter = null;
+            }
+
+            if ( preferences != null )
+            {
+                preferences.dispose();
+                preferences = null;
+            }
+
+            if ( contentProvider != null )
+            {
+                contentProvider.dispose();
+                contentProvider = null;
+            }
+
+            if ( labelProvider != null )
+            {
+                labelProvider.dispose();
+                labelProvider = null;
+            }
+
+            if ( cellModifier != null )
+            {
+                cellModifier.dispose();
+                cellModifier = null;
+            }
+
+            if ( valueEditorManager != null )
+            {
+                valueEditorManager.dispose();
+                valueEditorManager = null;
+            }
+
+            disposed = true;
+        }
+    }
+
+
+    /**
+     * Gets the content provider.
+     * 
+     * @param mainWidget the main widget
+     * 
+     * @return the content provider
+     */
+    public EntryEditorWidgetContentProvider getContentProvider( EntryEditorWidget mainWidget )
+    {
+        if ( contentProvider == null )
+        {
+            contentProvider = new EntryEditorWidgetContentProvider( getPreferences(), mainWidget );
+        }
+
+        return contentProvider;
+    }
+
+
+    /**
+     * Gets the label provider.
+     * 
+     * @param viewer the viewer
+     * 
+     * @return the label provider
+     */
+    public EntryEditorWidgetLabelProvider getLabelProvider( TreeViewer viewer )
+    {
+        if ( labelProvider == null )
+        {
+            labelProvider = new EntryEditorWidgetLabelProvider( getValueEditorManager( viewer ) );
+        }
+
+        return labelProvider;
+    }
+
+
+    /**
+     * Gets the cell modifier.
+     * 
+     * @param viewer the viewer
+     * 
+     * @return the cell modifier
+     */
+    public EntryEditorWidgetCellModifier getCellModifier( TreeViewer viewer )
+    {
+        if ( cellModifier == null )
+        {
+            cellModifier = new EntryEditorWidgetCellModifier( getValueEditorManager( viewer ) );
+        }
+
+        return cellModifier;
+    }
+
+
+    /**
+     * Gets the value editor manager.
+     * 
+     * @param viewer the viewer
+     * 
+     * @return the value editor manager
+     */
+    public ValueEditorManager getValueEditorManager( TreeViewer viewer )
+    {
+        if ( valueEditorManager == null )
+        {
+            valueEditorManager = new ValueEditorManager( viewer.getTree() );
+        }
+
+        return valueEditorManager;
+    }
+
+
+    /**
+     * Gets the sorter.
+     * 
+     * @return the sorter
+     */
+    public EntryEditorWidgetSorter getSorter()
+    {
+        if ( sorter == null )
+        {
+            sorter = new EntryEditorWidgetSorter( getPreferences() );
+        }
+
+        return sorter;
+    }
+
+
+    /**
+     * Gets the filter.
+     * 
+     * @return the filter
+     */
+    public EntryEditorWidgetFilter getFilter()
+    {
+        if ( filter == null )
+        {
+            filter = new EntryEditorWidgetFilter();
+        }
+
+        return filter;
+    }
+
+
+    /**
+     * Gets the preferences.
+     * 
+     * @return the preferences
+     */
+    public EntryEditorWidgetPreferences getPreferences()
+    {
+        if ( preferences == null )
+        {
+            preferences = new EntryEditorWidgetPreferences();
+        }
+
+        return preferences;
+    }
+
+}

Propchange: directory/sandbox/felixk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/entryeditor/EntryEditorWidgetConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message