directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r687679 [1/2] - in /directory/studio/trunk: connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/ connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ ldapbrowser-common/resources/icons/ ldapbrows...
Date Thu, 21 Aug 2008 10:05:44 GMT
Author: seelmann
Date: Thu Aug 21 03:05:39 2008
New Revision: 687679

URL: http://svn.apache.org/viewvc?rev=687679&view=rev
Log:
Fix for DIRSTUDIO-291. Added an 'Entry Value Editor'. When editing the objectClass attribute it opens a wizard (similar to the 'new entry wizard'). In the first step one could define the object classes, in the second step it is possible to edit the attributes, on finish it computes the difference between the orignal entry and the changed entry and sends these changes to the server. Also added an action 'Edit Entry' to the context menu that opens this wizard.

Added:
    directory/studio/trunk/ldapbrowser-common/resources/icons/entry_wizard.gif   (props changed)
      - copied unchanged from r687012, directory/studio/trunk/ldapbrowser-ui/resources/icons/entry_wizard.gif
    directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_abstract.gif   (props changed)
      - copied unchanged from r687012, directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_abstract.gif
    directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_auxiliary.gif   (props changed)
      - copied unchanged from r687012, directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_auxiliary.gif
    directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_structural.gif   (props changed)
      - copied unchanged from r687012, directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_structural.gif
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java
      - copied, changed from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java
      - copied, changed from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java
      - copied, changed from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryTypeWizardPage.java
      - copied, changed from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryTypeWizardPage.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java
      - copied, changed from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryWizard.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java
      - copied, changed from r687295, directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifJob.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/OpenEntryEditorAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/OpenEntryEditorAction.java
Removed:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifJob.java
    directory/studio/trunk/ldapbrowser-ui/resources/icons/entry_wizard.gif
    directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_abstract.gif
    directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_auxiliary.gif
    directory/studio/trunk/ldapbrowser-ui/resources/icons/ocd_structural.gif
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryTypeWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryWizard.java
Modified:
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioProgressMonitor.java
    directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/RunnableContextRunner.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeWizard.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ModelConverter.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/Utils.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/BrowserUIConstants.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/EntryEditorActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/entry/OpenEntryEditorPreferencePageAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/editors/searchresult/SearchResultEditorActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/perspective/BrowserPerspective.java
    directory/studio/trunk/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/ExecuteLdifAction.java

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioProgressMonitor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioProgressMonitor.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioProgressMonitor.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/jobs/StudioProgressMonitor.java Thu Aug 21 03:05:39 2008
@@ -64,7 +64,7 @@
                         do
                         {
                             // check report progress message
-                            if ( !spm.done && spm.reportProgressMessage != null )
+                            if ( !spm.isCanceled() && !spm.done && spm.reportProgressMessage != null )
                             {
                                 spm.subTask( spm.reportProgressMessage );
                                 spm.reportProgressMessage = null;

Modified: directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/RunnableContextRunner.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/RunnableContextRunner.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/RunnableContextRunner.java (original)
+++ directory/studio/trunk/connection-ui/src/main/java/org/apache/directory/studio/connection/ui/RunnableContextRunner.java Thu Aug 21 03:05:39 2008
@@ -25,9 +25,10 @@
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.IConnectionListener;
 import org.apache.directory.studio.connection.core.Messages;
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+import org.apache.directory.studio.connection.core.jobs.StudioBulkRunnableWithProgress;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.connection.core.jobs.StudioRunnableWithProgress;
-import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -68,7 +69,7 @@
             public void run( IProgressMonitor monitor ) throws InterruptedException
             {
                 spm[0] = new StudioProgressMonitor( monitor );
-                
+
                 // ensure that connections are opened
                 Connection[] connections = runnable.getConnections();
                 if ( connections != null )
@@ -80,13 +81,14 @@
                             spm[0].setTaskName( Messages.bind( Messages.jobs__open_connections_task, new String[]
                                 { connection.getName() } ) );
                             spm[0].worked( 1 );
-            
+
                             connection.getJNDIConnectionWrapper().connect( spm[0] );
                             connection.getJNDIConnectionWrapper().bind( spm[0] );
 
                             if ( connection.getJNDIConnectionWrapper().isConnected() )
                             {
-                                for ( IConnectionListener listener : ConnectionCorePlugin.getDefault().getConnectionListeners() )
+                                for ( IConnectionListener listener : ConnectionCorePlugin.getDefault()
+                                    .getConnectionListeners() )
                                 {
                                     listener.connectionOpened( connection, spm[0] );
                                 }
@@ -95,8 +97,29 @@
                         }
                     }
                 }
-                
-                runnable.run( spm[0] );
+
+                //runnable.run( spm[0] );
+                if ( runnable instanceof StudioBulkRunnableWithProgress )
+                {
+                    StudioBulkRunnableWithProgress bulkRunnable = ( StudioBulkRunnableWithProgress ) runnable;
+                    ConnectionEventRegistry.suspendEventFireingInCurrentThread();
+                    try
+                    {
+                        bulkRunnable.run( spm[0] );
+                    }
+                    finally
+                    {
+                        ConnectionEventRegistry.resumeEventFireingInCurrentThread();
+                    }
+                    bulkRunnable.runNotification();
+                }
+                else
+                {
+                    System.out.println( "NoBulk: " + runnable );
+                    runnable.run( spm[0] );
+                }
+
+                spm[0].done();
             }
         };
 

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/entry_wizard.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_abstract.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_auxiliary.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Propchange: directory/studio/trunk/ldapbrowser-common/resources/icons/ocd_structural.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/BrowserCommonConstants.java Thu Aug 21 03:05:39 2008
@@ -33,6 +33,8 @@
 
     public static final String ACTION_ID_EDIT_ATTRIBUTE_DESCRIPTION = "org.apache.directory.studio.ldapbrowser.action.editAttributeDescription";
 
+    public static final String ACTION_ID_EDIT_RECORD = "org.apache.directory.studio.ldapbrowser.action.editRecord";
+    
 
     
     public static final String DIALOGSETTING_KEY_RECENT_FILE_PATH = "recentFilePath";
@@ -254,8 +256,16 @@
 
     public static final String IMG_OCD = "resources/icons/ocd.png";
 
+    public static final String IMG_OCD_ABSTRACT = "resources/icons/ocd_abstract.gif";
+
+    public static final String IMG_OCD_AUXILIARY = "resources/icons/ocd_auxiliary.gif";
+
+    public static final String IMG_OCD_STRUCTURAL = "resources/icons/ocd_structural.gif";
+
     public static final String IMG_MRD = "resources/icons/mrd.png";
 
+    public static final String IMG_ENTRY_WIZARD = "resources/icons/entry_wizard.gif";
+
 
 
 

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeWizard.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeWizard.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/AttributeWizard.java Thu Aug 21 03:05:39 2008
@@ -70,7 +70,7 @@
 
     /**
      * Creates a new instance of AttributeWizard with an empty
-     * attriute description.
+     * attribute description.
      */
     public AttributeWizard()
     {
@@ -84,7 +84,7 @@
 
 
     /**
-     * Creates a new instance of AttributeWizard with the given initial attribute desription
+     * Creates a new instance of AttributeWizard with the given initial attribute description.
      * 
      * @param title the title
      * @param entry the entry

Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java?rev=687679&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java (added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/EditEntryWizard.java Thu Aug 21 03:05:39 2008
@@ -0,0 +1,217 @@
+/*
+ *  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.wizards;
+
+
+import org.apache.directory.studio.connection.ui.RunnableContextRunner;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ExecuteLdifRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.InitializeAttributesRunnable;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
+import org.apache.directory.studio.ldapbrowser.core.utils.ModelConverter;
+import org.apache.directory.studio.ldapbrowser.core.utils.Utils;
+import org.apache.directory.studio.ldifparser.LdifFormatParameters;
+import org.apache.directory.studio.ldifparser.model.container.LdifChangeModifyRecord;
+import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
+import org.eclipse.core.runtime.IStatus;
+
+
+/**
+ * The EditEntryWizard is used to edit an existing entry offline, on finish 
+ * it computes the difference between the orignal entry and the changed entry 
+ * and sends these changes to the server.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EditEntryWizard extends NewEntryWizard
+{
+
+    /**
+     * Creates a new instance of EditEntryWizard.
+     * 
+     * @param entry the entry to edit
+     */
+    public EditEntryWizard( IEntry entry )
+    {
+        setWindowTitle( "Edit Entry" );
+        setNeedsProgressMonitor( true );
+
+        selectedEntry = entry;
+        selectedConnection = entry.getBrowserConnection();
+        originalReadOnlyFlag = selectedConnection.getConnection().isReadOnly();
+        selectedConnection.getConnection().setReadOnly( true );
+
+        // ensure the attributes of the entry are initialized
+        if ( !selectedEntry.isAttributesInitialized() )
+        {
+            initAttributes();
+        }
+
+        try
+        {
+            EventRegistry.suspendEventFireingInCurrentThread();
+            LdifContentRecord record = ModelConverter.entryToLdifContentRecord( selectedEntry );
+            prototypeEntry = ModelConverter.ldifContentRecordToEntry( record, selectedConnection );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        finally
+        {
+            EventRegistry.resumeEventFireingInCurrentThread();
+        }
+    }
+
+
+    private void initAttributes()
+    {
+        boolean soa = BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean(
+            BrowserCommonConstants.PREFERENCE_ENTRYEDITOR_SHOW_OPERATIONAL_ATTRIBUTES );
+        InitializeAttributesRunnable iar = new InitializeAttributesRunnable( new IEntry[]
+            { selectedEntry }, soa );
+        RunnableContextRunner.execute( iar, getContainer(), true );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPages()
+    {
+        ocPage = new NewEntryObjectclassWizardPage( NewEntryObjectclassWizardPage.class.getName(), this );
+        addPage( ocPage );
+
+        attributePage = new NewEntryAttributesWizardPage( NewEntryAttributesWizardPage.class.getName(), this );
+        addPage( attributePage );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean performCancel()
+    {
+        if ( selectedConnection != null && selectedConnection.getConnection() != null )
+        {
+            selectedConnection.getConnection().setReadOnly( originalReadOnlyFlag );
+        }
+
+        return true;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean performFinish()
+    {
+        try
+        {
+            if ( selectedConnection != null && selectedConnection.getConnection() != null )
+            {
+                selectedConnection.getConnection().setReadOnly( originalReadOnlyFlag );
+
+                LdifChangeModifyRecord record = Utils.computeDiff( selectedEntry, prototypeEntry );
+                if ( record != null )
+                {
+                    ExecuteLdifRunnable runnable = new ExecuteLdifRunnable( selectedConnection, record
+                        .toFormattedString( LdifFormatParameters.DEFAULT ), false );
+                    IStatus status = RunnableContextRunner.execute( runnable, getContainer(), true );
+                    if ( !status.isOK() )
+                    {
+                        selectedConnection.getConnection().setReadOnly( true );
+                        return false;
+                    }
+                    else
+                    {
+                        initAttributes();
+                        return true;
+                    }
+                }
+                else
+                {
+                    // no changes
+                    return true;
+                }
+            }
+            else
+            {
+                return true;
+            }
+        }
+        catch ( Throwable t )
+        {
+            t.printStackTrace();
+            return false;
+        }
+    }
+
+
+    /**
+     * Gets the selected entry.
+     * 
+     * @return the selected entry
+     */
+    public IEntry getSelectedEntry()
+    {
+        return selectedEntry;
+    }
+
+
+    /**
+     * Gets the selected connection.
+     * 
+     * @return the selected connection
+     */
+    public IBrowserConnection getSelectedConnection()
+    {
+        return selectedConnection;
+    }
+
+
+    /**
+     * Gets the prototype entry.
+     * 
+     * @return the prototype entry
+     */
+    public DummyEntry getPrototypeEntry()
+    {
+        return prototypeEntry;
+    }
+
+
+    /**
+     * Sets the prototype entry.
+     * 
+     * @param getPrototypeEntry the prototype entry
+     */
+    public void setPrototypeEntry( DummyEntry getPrototypeEntry )
+    {
+        this.prototypeEntry = getPrototypeEntry;
+    }
+
+}

Copied: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java (from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java?p2=directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java&r1=687012&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryAttributesWizardPage.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryAttributesWizardPage.java Thu Aug 21 03:05:39 2008
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.studio.ldapbrowser.ui.wizards;
+package org.apache.directory.studio.ldapbrowser.common.wizards;
 
 
 import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
@@ -36,8 +36,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Attribute;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -89,7 +87,8 @@
         super( pageName );
         setTitle( "Attributes" );
         setDescription( "Please enter the attributes for the entry. Enter at least the MUST attributes." );
-        setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_WIZARD ) );
+        setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_ENTRY_WIZARD ) );
         setPageComplete( false );
 
         this.wizard = wizard;

Copied: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java (from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java?p2=directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java&r1=687012&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryDnWizardPage.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryDnWizardPage.java Thu Aug 21 03:05:39 2008
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.studio.ldapbrowser.ui.wizards;
+package org.apache.directory.studio.ldapbrowser.common.wizards;
 
 
 import java.util.Arrays;
@@ -29,6 +29,8 @@
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.studio.connection.core.DnUtils;
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.DnBuilderWidget;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
@@ -41,8 +43,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.WizardPage;
@@ -77,7 +77,8 @@
         super( pageName );
         setTitle( "Distinguished Name" );
         setDescription( "Please select the parent of the new entry and enter the RDN." );
-        setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_WIZARD ) );
+        setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_ENTRY_WIZARD ) );
         setPageComplete( false );
 
         this.wizard = wizard;

Copied: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java (from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java?p2=directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java&r1=687012&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryObjectclassWizardPage.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryObjectclassWizardPage.java Thu Aug 21 03:05:39 2008
@@ -18,7 +18,7 @@
  *  
  */
 
-package org.apache.directory.studio.ldapbrowser.ui.wizards;
+package org.apache.directory.studio.ldapbrowser.common.wizards;
 
 
 import java.util.ArrayList;
@@ -28,6 +28,8 @@
 
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
 import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.core.events.EventRegistry;
 import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
@@ -37,8 +39,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.Value;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.Schema;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.fieldassist.DecoratedField;
 import org.eclipse.jface.fieldassist.FieldDecoration;
 import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
@@ -113,8 +113,8 @@
 
     private LabelProvider labelProvider = new LabelProvider()
     {
-        /* (non-Javadoc)
-         * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+        /**
+         * {@inheritDoc}
          */
         public String getText( Object element )
         {
@@ -123,14 +123,14 @@
                 ObjectClassDescription ocd = ( ObjectClassDescription ) element;
                 return SchemaUtils.toString( ocd );
             }
-            
+
             // Default
             return super.getText( element );
         }
-        
-        
-        /* (non-Javadoc)
-         * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+
+
+        /**
+         * {@inheritDoc}
          */
         public Image getImage( Object element )
         {
@@ -140,13 +140,13 @@
                 switch ( ocd.getKind() )
                 {
                     case STRUCTURAL:
-                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_STRUCTURAL );
+                        return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_OCD_STRUCTURAL );
                     case ABSTRACT:
-                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_ABSTRACT );
+                        return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_OCD_ABSTRACT );
                     case AUXILIARY:
-                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD_AUXILIARY );
+                        return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_OCD_AUXILIARY );
                     default:
-                        return BrowserUIPlugin.getDefault().getImage( BrowserUIConstants.IMG_OCD );
+                        return BrowserCommonActivator.getDefault().getImage( BrowserCommonConstants.IMG_OCD );
                 }
             }
 
@@ -166,8 +166,9 @@
     {
         super( pageName );
         setTitle( "Object Classes" );
-        setDescription( "Please select object classes of the new entry. Select at least one structural object class." );
-        setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_WIZARD ) );
+        setDescription( "Please select object classes of the entry. Select at least one structural object class." );
+        setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_ENTRY_WIZARD ) );
         setPageComplete( false );
 
         this.wizard = wizard;
@@ -223,27 +224,21 @@
 
         if ( wizard.getSelectedConnection() != null )
         {
-            //            if ( !wizard.getSelectedConnection().isOpened() )
-            //            {
-            //                OpenConnectionsJob job = new OpenConnectionsJob( wizard.getSelectedConnection().getConnection() );
-            //                RunnableContextJobAdapter.execute( job, getContainer() );
-            //            }
-
-            availableObjectClasses.addAll( wizard.getSelectedConnection().getSchema()
-                .getObjectClassDescriptions() );
+            availableObjectClasses.addAll( wizard.getSelectedConnection().getSchema().getObjectClassDescriptions() );
 
             DummyEntry newEntry = wizard.getPrototypeEntry();
             IAttribute ocAttribute = newEntry.getAttribute( IAttribute.OBJECTCLASS_ATTRIBUTE );
             if ( ocAttribute != null )
             {
-                String[] ocValues = ocAttribute.getStringValues();
-                for ( int i = 0; i < ocValues.length; i++ )
+                for ( IValue ocValue : ocAttribute.getValues() )
                 {
-                    String ocValue = ocValues[i];
-                    ObjectClassDescription ocd = wizard.getSelectedConnection().getSchema().getObjectClassDescription(
-                        ocValue );
-                    availableObjectClasses.remove( ocd );
-                    selectedObjectClasses.add( ocd );
+                    if(!ocValue.isEmpty())
+                    {
+                        ObjectClassDescription ocd = wizard.getSelectedConnection().getSchema()
+                        .getObjectClassDescription( ocValue.getStringValue() );
+                        availableObjectClasses.remove( ocd );
+                        selectedObjectClasses.add( ocd );
+                    }
                 }
             }
         }
@@ -461,8 +456,8 @@
 
 
     /**
-     * Adds the selected object classes to the list of selected 
-     * object classes.
+     * Adds the selected object classes and all superiors
+     * to the list of selected object classes.
      * 
      * @param iselection the selection
      */
@@ -480,7 +475,8 @@
                 selectedObjectClasses.add( ocd );
 
                 // recursively add superior object classes
-                List<ObjectClassDescription> superiorObjectClassDescriptions = SchemaUtils.getSuperiorObjectClassDescriptions( ocd, schema );
+                List<ObjectClassDescription> superiorObjectClassDescriptions = SchemaUtils
+                    .getSuperiorObjectClassDescriptions( ocd, schema );
                 if ( !superiorObjectClassDescriptions.isEmpty() )
                 {
                     add( new StructuredSelection( superiorObjectClassDescriptions ) );
@@ -501,8 +497,8 @@
 
 
     /**
-     * Removes the selected object classes from the list of selected
-     * object classes.
+     * Removes the selected object classes and all sub classes
+     * from the list of selected object classes.
      * 
      * @param iselection the iselection
      */
@@ -520,7 +516,8 @@
                 availableObjectClasses.add( ocd );
 
                 // recursively remove sub object classes
-                List<ObjectClassDescription> subObjectClassDescriptions = SchemaUtils.getSuperiorObjectClassDescriptions( ocd, schema );
+                List<ObjectClassDescription> subObjectClassDescriptions = SchemaUtils
+                    .getSuperiorObjectClassDescriptions( ocd, schema );
                 if ( !subObjectClassDescriptions.isEmpty() )
                 {
                     remove( new StructuredSelection( subObjectClassDescriptions ) );
@@ -528,20 +525,23 @@
             }
         }
 
+        // re-add superior object classes of remaining object classes
+        List<ObjectClassDescription> copy = new ArrayList<ObjectClassDescription>( selectedObjectClasses );
+        for ( ObjectClassDescription ocd : copy )
+        {
+            List<ObjectClassDescription> superiorObjectClassDescriptions = SchemaUtils
+                .getSuperiorObjectClassDescriptions( ocd, schema );
+            if ( !superiorObjectClassDescriptions.isEmpty() )
+            {
+                add( new StructuredSelection( superiorObjectClassDescriptions ) );
+            }
+        }
+
         availableObjectClassesViewer.refresh();
         selectedObjectClassesViewer.refresh();
         validate();
     }
 
-
-    /**
-     * Saves dialog settings.
-     */
-    public void saveDialogSettings()
-    {
-
-    }
-
     /**
      * The Class InstantSearchFilter.
      */

Copied: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryTypeWizardPage.java (from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryTypeWizardPage.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryTypeWizardPage.java?p2=directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryTypeWizardPage.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryTypeWizardPage.java&r1=687012&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryTypeWizardPage.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryTypeWizardPage.java Thu Aug 21 03:05:39 2008
@@ -18,11 +18,13 @@
  *  
  */
 
-package org.apache.directory.studio.ldapbrowser.ui.wizards;
+package org.apache.directory.studio.ldapbrowser.common.wizards;
 
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyEvent;
 import org.apache.directory.studio.ldapbrowser.common.widgets.WidgetModifyListener;
@@ -36,8 +38,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
 import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
 import org.apache.directory.studio.ldapbrowser.core.utils.ModelConverter;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.apache.directory.studio.ldifparser.model.container.LdifContentRecord;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.wizard.IWizardPage;
@@ -89,7 +89,8 @@
         super( pageName );
         setTitle( "Entry Creation Method" );
         setDescription( "Please select the entry creation method." );
-        setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_WIZARD ) );
+        setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_ENTRY_WIZARD ) );
         setPageComplete( false );
 
         this.wizard = wizard;
@@ -115,7 +116,7 @@
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      * 
@@ -127,7 +128,7 @@
     {
         return isPageComplete();
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -185,7 +186,8 @@
             // init attributes
             if ( !templateEntries[0].isAttributesInitialized() )
             {
-                InitializeAttributesRunnable initializeAttributesRunnable = new InitializeAttributesRunnable( templateEntries, false );
+                InitializeAttributesRunnable initializeAttributesRunnable = new InitializeAttributesRunnable(
+                    templateEntries, false );
                 RunnableContextRunner.execute( initializeAttributesRunnable, getContainer(), true );
             }
 
@@ -246,12 +248,15 @@
         entryWidget.createWidget( entryComposite );
         entryWidget.addWidgetModifyListener( this );
 
-        if ( BrowserUIPlugin.getDefault().getDialogSettings().get( PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY ) == null )
-            BrowserUIPlugin.getDefault().getDialogSettings().put( PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY,
-                true );
-        schemaButton.setSelection( BrowserUIPlugin.getDefault().getDialogSettings().getBoolean(
+        if ( BrowserCommonActivator.getDefault().getDialogSettings().get(
+            PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY ) == null )
+        {
+            BrowserCommonActivator.getDefault().getDialogSettings().put(
+                PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY, true );
+        }
+        schemaButton.setSelection( BrowserCommonActivator.getDefault().getDialogSettings().getBoolean(
             PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY ) );
-        templateButton.setSelection( !BrowserUIPlugin.getDefault().getDialogSettings().getBoolean(
+        templateButton.setSelection( !BrowserCommonActivator.getDefault().getDialogSettings().getBoolean(
             PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY ) );
         widgetSelected( null );
 
@@ -291,7 +296,7 @@
      */
     public void saveDialogSettings()
     {
-        BrowserUIPlugin.getDefault().getDialogSettings().put( PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY,
+        BrowserCommonActivator.getDefault().getDialogSettings().put( PREFERRED_ENTRY_CREATION_METHOD_DIALOGSETTING_KEY,
             schemaButton.getSelection() );
     }
 

Copied: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java (from r687012, directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryWizard.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java?p2=directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java&p1=directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryWizard.java&r1=687012&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/NewEntryWizard.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java Thu Aug 21 03:05:39 2008
@@ -18,11 +18,13 @@
  *  
  */
 
-package org.apache.directory.studio.ldapbrowser.ui.wizards;
+package org.apache.directory.studio.ldapbrowser.common.wizards;
 
 
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.studio.connection.ui.RunnableContextRunner;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonActivator;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserCategory;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserEntryPage;
 import org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserSearchResultPage;
@@ -35,8 +37,6 @@
 import org.apache.directory.studio.ldapbrowser.core.model.ISearchResult;
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
-import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
@@ -62,28 +62,28 @@
 {
 
     /** The type page. */
-    private NewEntryTypeWizardPage typePage;
+    protected NewEntryTypeWizardPage typePage;
 
     /** The object class page. */
-    private NewEntryObjectclassWizardPage ocPage;
+    protected NewEntryObjectclassWizardPage ocPage;
 
     /** The dn page. */
-    private NewEntryDnWizardPage dnPage;
+    protected NewEntryDnWizardPage dnPage;
 
     /** The attributes page. */
-    private NewEntryAttributesWizardPage attributePage;
+    protected NewEntryAttributesWizardPage attributePage;
 
     /** The selected entry. */
-    private IEntry selectedEntry;
+    protected IEntry selectedEntry;
 
     /** The selected connection. */
-    private IBrowserConnection selectedConnection;
+    protected IBrowserConnection selectedConnection;
 
     /** The read only flag of the selected connection. */
-    private boolean originalReadOnlyFlag;
+    protected boolean originalReadOnlyFlag;
     
     /** The prototype entry. */
-    private DummyEntry prototypeEntry;
+    protected DummyEntry prototypeEntry;
 
 
     /**
@@ -216,14 +216,26 @@
         // set help context ID
         if ( selectedConnection != null )
         {
-            PlatformUI.getWorkbench().getHelpSystem().setHelp( typePage.getControl(),
-                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-            PlatformUI.getWorkbench().getHelpSystem().setHelp( ocPage.getControl(),
-                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-            PlatformUI.getWorkbench().getHelpSystem().setHelp( dnPage.getControl(),
-                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
-            PlatformUI.getWorkbench().getHelpSystem().setHelp( attributePage.getControl(),
-                BrowserUIPlugin.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            if ( typePage != null )
+            {
+                PlatformUI.getWorkbench().getHelpSystem().setHelp( typePage.getControl(),
+                    BrowserCommonActivator.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            }
+            if ( ocPage != null )
+            {
+                PlatformUI.getWorkbench().getHelpSystem().setHelp( ocPage.getControl(),
+                    BrowserCommonActivator.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            }
+            if ( dnPage != null )
+            {
+                PlatformUI.getWorkbench().getHelpSystem().setHelp( dnPage.getControl(),
+                    BrowserCommonActivator.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            }
+            if ( attributePage != null )
+            {
+                PlatformUI.getWorkbench().getHelpSystem().setHelp( attributePage.getControl(),
+                    BrowserCommonActivator.PLUGIN_ID + "." + "tools_newentry_wizard" );
+            }
         }
     }
 
@@ -244,8 +256,8 @@
             super( "" );
             setTitle( "No connection selected or connection is closed" );
             setDescription( "In order to use the entry creation wizard please select an entry or connection." );
-            setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
-                BrowserUIConstants.IMG_ENTRY_WIZARD ) );
+            setImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+                BrowserCommonConstants.IMG_ENTRY_WIZARD ) );
             setPageComplete( true );
         }
 
@@ -291,7 +303,6 @@
                 selectedConnection.getConnection().setReadOnly( originalReadOnlyFlag );
                 
                 typePage.saveDialogSettings();
-                ocPage.saveDialogSettings();
                 dnPage.saveDialogSettings();
 
                 CreateEntryRunnable runnable = new CreateEntryRunnable( prototypeEntry, selectedConnection );

Added: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java?rev=687679&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java (added)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/EntryValueEditor.java Thu Aug 21 03:05:39 2008
@@ -0,0 +1,290 @@
+/*
+ *  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.valueeditors;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.directory.studio.ldapbrowser.common.wizards.EditEntryWizard;
+import org.apache.directory.studio.ldapbrowser.core.model.AttributeHierarchy;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IValue;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * Special ValueEditor to edit an entry off-line in the {@link EditEntryWizard}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class EntryValueEditor extends CellEditor implements IValueEditor
+{
+
+    /** The value to handle */
+    private Object value;
+
+    /** The parent composite, used to instantiate 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 EntryValueEditor.
+     *
+     * @param parent the parent composite
+     * @param valueEditorManager the value editor manager, used to get
+     *                           proper value editors
+     */
+    public EntryValueEditor( 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 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 ( getValue() != null && getValue() instanceof IEntry )
+        {
+            IEntry entry = ( IEntry ) getValue();
+            if ( entry != null )
+            {
+                EditEntryWizard wizard = new EditEntryWizard( entry );
+                WizardDialog dialog = new WizardDialog( parent.getShell(), wizard );
+                dialog.setBlockOnOpen( true );
+                dialog.create();
+                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 ( IAttribute attribute : attributeHierarchy )
+        {
+            valueList.addAll( Arrays.asList( attribute.getValues() ) );
+        }
+
+        StringBuffer sb = new StringBuffer();
+        if ( valueList.size() > 1 )
+        {
+            sb.append( valueList.size() + " values: " );
+        }
+        for ( Iterator<IValue> it = valueList.iterator(); it.hasNext(); )
+        {
+            IValue value = it.next();
+            IValueEditor vp = getValueEditor( value );
+            sb.append( vp.getDisplayValue( value ) );
+            if ( it.hasNext() )
+                sb.append( ", " );
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * This implementation gets the display value of the real value editor. 
+     */
+    public String getDisplayValue( IValue value )
+    {
+        IValueEditor vp = getValueEditor( value );
+        return vp.getDisplayValue( value );
+    }
+
+
+    private IValueEditor getValueEditor( IValue value )
+    {
+        IValueEditor vp = valueEditorManager.getCurrentValueEditor( value.getAttribute().getEntry(), value
+            .getAttribute().getDescription() );
+
+        // avoid recursion: unset the user selected value editor
+        if ( vp instanceof EntryValueEditor )
+        {
+            IValueEditor userSelectedValueEditor = valueEditorManager.getUserSelectedValueEditor();
+            valueEditorManager.setUserSelectedValueEditor( null );
+            vp = valueEditorManager.getCurrentValueEditor( value.getAttribute().getEntry(), value.getAttribute()
+                .getDescription() );
+            valueEditorManager.setUserSelectedValueEditor( userSelectedValueEditor );
+        }
+
+        return vp;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Returns the entry.
+     */
+    public Object getRawValue( AttributeHierarchy attributeHierarchy )
+    {
+        return attributeHierarchy.getEntry().isDirectoryEntry() ? attributeHierarchy.getEntry() : null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Returns the entry.
+     */
+    public Object getRawValue( IValue value )
+    {
+        return value.getAttribute().getEntry().isDirectoryEntry() ? value.getAttribute().getEntry() : null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * 
+     * Modification is performed by the wizard. 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;
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/IValueEditor.java Thu Aug 21 03:05:39 2008
@@ -73,7 +73,7 @@
      * 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
+     * Note: It is also possible 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

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/MultivaluedValueEditor.java Thu Aug 21 03:05:39 2008
@@ -48,7 +48,7 @@
     /** The value to handle */
     private Object value;
 
-    /** The parent composite, used to instanciate a new control */
+    /** The parent composite, used to instantiate a new control */
     private Composite parent;
 
     /** The name of this value editor */
@@ -94,7 +94,7 @@
      */
     protected final Object doGetValue()
     {
-        return this.value;
+        return value;
     }
 
 
@@ -127,12 +127,12 @@
      */
     public void activate()
     {
-        if ( this.getValue() != null && this.getValue() instanceof AttributeHierarchy )
+        if ( getValue() != null && getValue() instanceof AttributeHierarchy )
         {
-            AttributeHierarchy ah = ( AttributeHierarchy ) this.getValue();
+            AttributeHierarchy ah = ( AttributeHierarchy ) getValue();
             if ( ah != null )
             {
-                MultivaluedDialog dialog = new MultivaluedDialog( this.parent.getShell(), ah );
+                MultivaluedDialog dialog = new MultivaluedDialog( parent.getShell(), ah );
                 dialog.open();
             }
         }
@@ -160,24 +160,27 @@
      */
     public String getDisplayValue( AttributeHierarchy attributeHierarchy )
     {
-
         List<IValue> valueList = new ArrayList<IValue>();
-        for ( Iterator it = attributeHierarchy.iterator(); it.hasNext(); )
+        for ( IAttribute attribute : attributeHierarchy )
         {
-            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(); )
+        }
+        for ( Iterator<IValue> it = valueList.iterator(); it.hasNext(); )
         {
-            IValue value = ( IValue ) it.next();
-            IValueEditor vp = this.valueEditorManager.getCurrentValueEditor( value );
+            IValue value = it.next();
+            IValueEditor vp = valueEditorManager.getCurrentValueEditor( value.getAttribute().getEntry(), value
+                .getAttribute().getDescription() );
             sb.append( vp.getDisplayValue( value ) );
             if ( it.hasNext() )
+            {
                 sb.append( ", " );
+            }
         }
         return sb.toString();
     }

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/valueeditors/ValueEditorManager.java Thu Aug 21 03:05:39 2008
@@ -87,6 +87,9 @@
     /** The special value editor for multi-valued attributes */
     private MultivaluedValueEditor multiValuedValueEditor;
 
+    /** The special value editor to edit the entry in an wizard */
+    private EntryValueEditor entryValueEditor;
+
     /** The default string editor for single-line values */
     private IValueEditor defaultStringSingleLineValueEditor;
 
@@ -124,6 +127,12 @@
         multiValuedValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
             BrowserCommonConstants.IMG_MULTIVALUEDEDITOR ) );
 
+        // special case: entry editor
+        entryValueEditor = new EntryValueEditor( this.parent, this );
+        entryValueEditor.setValueEditorName( "Entry Editor" );
+        entryValueEditor.setValueEditorImageDescriptor( BrowserCommonActivator.getDefault().getImageDescriptor(
+            BrowserCommonConstants.IMG_ENTRY ) );
+
         // get default editors from value editor map
         defaultStringSingleLineValueEditor = class2ValueEditors.get( InPlaceTextValueEditor.class.getName() );
         defaultStringMultiLineValueEditor = class2ValueEditors.get( TextValueEditor.class.getName() );
@@ -136,20 +145,21 @@
      */
     public void dispose()
     {
-        if ( this.parent != null )
+        if ( parent != null )
         {
-            this.userSelectedValueEditor = null;
-            this.multiValuedValueEditor.dispose();
-            this.defaultStringSingleLineValueEditor.dispose();
-            this.defaultStringMultiLineValueEditor.dispose();
-            this.defaultBinaryValueEditor.dispose();
+            userSelectedValueEditor = null;
+            multiValuedValueEditor.dispose();
+            entryValueEditor.dispose();
+            defaultStringSingleLineValueEditor.dispose();
+            defaultStringMultiLineValueEditor.dispose();
+            defaultBinaryValueEditor.dispose();
 
             for ( IValueEditor ve : class2ValueEditors.values() )
             {
                 ve.dispose();
             }
 
-            this.parent = null;
+            parent = null;
         }
     }
 
@@ -167,6 +177,17 @@
 
 
     /**
+     * Gets the value editor explicitly selected by the user.
+     * 
+     * @return the user selected value editor, null if non is set
+     */
+    public IValueEditor getUserSelectedValueEditor()
+    {
+        return userSelectedValueEditor;
+    }
+
+
+    /**
      * Returns the current (best) value editor for the given attribute.
      * 
      * <ol>
@@ -192,8 +213,8 @@
             return userSelectedValueEditor;
         }
 
-        // check attribute preferences
         AttributeTypeDescription atd = schema.getAttributeTypeDescription( attributeType );
+        // check attribute preferences
         Map<String, String> attributeValueEditorMap = BrowserCommonActivator.getDefault().getValueEditorsPreferences()
             .getAttributeValueEditorMap();
         if ( atd.getNumericOid() != null && attributeValueEditorMap.containsKey( atd.getNumericOid().toLowerCase() ) )
@@ -229,7 +250,6 @@
         {
             return defaultStringSingleLineValueEditor;
         }
-
     }
 
 
@@ -256,10 +276,16 @@
      */
     public IValueEditor getCurrentValueEditor( IValue value )
     {
-
         IValueEditor ve = this.getCurrentValueEditor( value.getAttribute().getEntry(), value.getAttribute()
             .getDescription() );
 
+        // special case objectClass: always return entry editor
+        if ( userSelectedValueEditor == null && value.getAttribute().isObjectClassAttribute()
+            && value.getAttribute().getEntry().isDirectoryEntry() )
+        {
+            return entryValueEditor;
+        }
+
         // here the value is known, we can check for single-line or multi-line
         if ( ve == defaultStringSingleLineValueEditor )
         {
@@ -290,6 +316,17 @@
         {
             return null;
         }
+        else if ( userSelectedValueEditor == null && attributeHierarchy.getAttribute().isObjectClassAttribute()
+            && attributeHierarchy.getEntry().isDirectoryEntry() )
+        {
+            // special case objectClass: always return entry editor
+            return entryValueEditor;
+        }
+        else if ( userSelectedValueEditor == entryValueEditor )
+        {
+            // special case objectClass: always return entry editor
+            return entryValueEditor;
+        }
         else if ( attributeHierarchy.size() == 1 && attributeHierarchy.getAttribute().getValueSize() == 0 )
         {
             return getCurrentValueEditor( attributeHierarchy.getAttribute().getEntry(), attributeHierarchy
@@ -300,12 +337,7 @@
             && attributeHierarchy.getAttributeDescription().equalsIgnoreCase(
                 attributeHierarchy.getAttribute().getValues()[0].getAttribute().getDescription() ) )
         {
-            // special case objectClass and RDN: always return MV-editor
-            // perhaps this should be moved somewhere else
-            if ( attributeHierarchy.getAttribute().isObjectClassAttribute() )
-            {
-                return multiValuedValueEditor;
-            }
+            // special case RDN: always return MV-editor
             if ( attributeHierarchy.getAttribute().getValues()[0].isRdnPart() )
             {
                 return multiValuedValueEditor;
@@ -341,7 +373,7 @@
      * 
      * @param schema the schema
      * @param attributeName the attribute
-     * @return alternative value editors
+     * @return the alternative value editors
      */
     public IValueEditor[] getAlternativeValueEditors( Schema schema, String attributeName )
     {
@@ -366,8 +398,7 @@
 
         alternativeList.remove( getCurrentValueEditor( schema, attributeName ) );
 
-        return ( org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList
-            .toArray( new IValueEditor[alternativeList.size()] );
+        return alternativeList.toArray( new IValueEditor[alternativeList.size()] );
     }
 
 
@@ -376,7 +407,7 @@
      * are the three default editors.
      *
      * @param value the value
-     * @return lternative value editors
+     * @return the alternative value editors
      */
     public IValueEditor[] getAlternativeValueEditors( IValue value )
     {
@@ -399,8 +430,7 @@
 
         alternativeList.remove( getCurrentValueEditor( value ) );
 
-        return ( org.apache.directory.studio.valueeditors.IValueEditor[] ) alternativeList
-            .toArray( new IValueEditor[alternativeList.size()] );
+        return alternativeList.toArray( new IValueEditor[alternativeList.size()] );
     }
 
 
@@ -417,7 +447,32 @@
         {
             return new IValueEditor[0];
         }
-        else if ( ah.size() == 1 && ah.getAttribute().getValueSize() == 0 )
+
+        // special case RDN: no alternative to the MV editor, except the entry editor
+        // perhaps this should be moved somewhere else
+        for ( IAttribute attribute : ah )
+        {
+            for ( IValue value : attribute.getValues() )
+            {
+                if ( value.isRdnPart() )
+                {
+                    return new IValueEditor[]
+                        { entryValueEditor };
+                }
+            }
+        }
+
+        // special case objectClass: no alternative to the entry editor
+        // perhaps this should be moved somewhere else
+        for ( IAttribute attribute : ah )
+        {
+            if ( attribute.isObjectClassAttribute() )
+            {
+                return new IValueEditor[0];
+            }
+        }
+
+        if ( ah.size() == 1 && ah.getAttribute().getValueSize() == 0 )
         {
             return getAlternativeValueEditors( ah.getAttribute().getEntry(), ah.getAttribute().getDescription() );
         }
@@ -426,22 +481,10 @@
             && ah.getAttributeDescription().equalsIgnoreCase(
                 ah.getAttribute().getValues()[0].getAttribute().getDescription() ) )
         {
-
-            // 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 getAlternativeValueEditors( ah.getAttribute().getValues()[0] );
         }
         else
-        /* if(attribute.getValueSize() > 1) */{
+        {
             return new IValueEditor[0];
         }
     }
@@ -464,6 +507,7 @@
         list.addAll( class2ValueEditors.values() );
 
         list.add( multiValuedValueEditor );
+        list.add( entryValueEditor );
 
         return list.toArray( new IValueEditor[list.size()] );
     }
@@ -503,6 +547,17 @@
 
 
     /**
+     * Returns the entry value editor.
+     *
+     * @return the entry value editor
+     */
+    public EntryValueEditor getEntryValueEditor()
+    {
+        return entryValueEditor;
+    }
+
+
+    /**
      * Creates the attribute with the given value at the entry.
      * 
      * It is called from a ICellModifier if no attribute of value exists and

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/events/EventRegistry.java Thu Aug 21 03:05:39 2008
@@ -27,6 +27,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.directory.studio.connection.core.event.ConnectionEventRegistry;
+
 
 /**
  * The EventRegistry is a central point to register for Apache Directory Studio specific
@@ -52,7 +54,8 @@
      */
     public static boolean isEventFireingSuspendedInCurrentThread()
     {
-        return suspendedEventFireringThreads.contains( Thread.currentThread() );
+        return suspendedEventFireringThreads.contains( Thread.currentThread() )
+            || ConnectionEventRegistry.isEventFireingSuspendedInCurrentThread();
     }
 
 

Copied: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java (from r687295, directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifJob.java)
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java?p2=directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java&p1=directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifJob.java&r1=687295&r2=687679&rev=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifJob.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExecuteLdifRunnable.java Thu Aug 21 03:05:39 2008
@@ -29,6 +29,7 @@
 
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.connection.core.jobs.StudioBulkRunnableWithProgress;
 import org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor;
 import org.apache.directory.studio.ldapbrowser.core.BrowserCoreMessages;
 import org.apache.directory.studio.ldapbrowser.core.events.BulkModificationEvent;
@@ -39,12 +40,12 @@
 
 
 /**
- * Job to execute an LDIF.
+ * Runnable to execute an LDIF.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ExecuteLdifJob extends AbstractNotificationJob
+public class ExecuteLdifRunnable implements StudioBulkRunnableWithProgress
 {
 
     /** The browser connection. */
@@ -64,20 +65,18 @@
      * @param ldif the LDIF to execute
      * @param continueOnError the continue on error flag
      */
-    public ExecuteLdifJob( IBrowserConnection browserConnection, String ldif, boolean continueOnError )
+    public ExecuteLdifRunnable( IBrowserConnection browserConnection, String ldif, boolean continueOnError )
     {
         this.browserConnection = browserConnection;
         this.ldif = ldif;
         this.continueOnError = continueOnError;
-
-        setName( BrowserCoreMessages.jobs__execute_ldif_name );
     }
 
 
     /**
-     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getConnections()
+     * {@inheritDoc}
      */
-    protected Connection[] getConnections()
+    public Connection[] getConnections()
     {
         return new Connection[]
             { browserConnection.getConnection() };
@@ -85,9 +84,18 @@
 
 
     /**
-     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getLockedObjects()
+     * {@inheritDoc}
+     */
+    public String getName()
+    {
+        return BrowserCoreMessages.jobs__execute_ldif_name;
+    }
+
+
+    /**
+     * {@inheritDoc}
      */
-    protected Object[] getLockedObjects()
+    public Object[] getLockedObjects()
     {
         List<Object> l = new ArrayList<Object>();
         l.add( browserConnection.getUrl() + "_" + DigestUtils.shaHex( ldif ) );
@@ -96,9 +104,9 @@
 
 
     /**
-     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob#executeNotificationJob(org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor)
+     * {@inheritDoc}
      */
-    protected void executeNotificationJob( StudioProgressMonitor monitor )
+    public void run( StudioProgressMonitor monitor )
     {
         monitor.beginTask( BrowserCoreMessages.jobs__execute_ldif_task, 2 );
         monitor.reportProgress( " " ); //$NON-NLS-1$
@@ -140,18 +148,18 @@
 
 
     /**
-     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractEclipseJob#getErrorMessage()
+     * {@inheritDoc}
      */
-    protected String getErrorMessage()
+    public String getErrorMessage()
     {
         return BrowserCoreMessages.jobs__execute_ldif_error;
     }
 
 
-    /** 
-     * @see org.apache.directory.studio.ldapbrowser.core.jobs.AbstractNotificationJob#runNotification()
+    /**
+     * {@inheritDoc}
      */
-    protected void runNotification()
+    public void runNotification()
     {
         EventRegistry.fireEntryUpdated( new BulkModificationEvent( browserConnection ), this );
     }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java Thu Aug 21 03:05:39 2008
@@ -573,7 +573,8 @@
             ai = new AttributeInfo();
             getBrowserConnectionImpl().setAttributeInfo( this, ai );
         }
-        if ( ai.subschema == null )
+        if ( ai.subschema == null || ai.subschema.getObjectClassNames() == null
+            || ai.subschema.getObjectClassNames().length == 0 )
         {
             ai.subschema = new Subschema( this );
         }

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ModelConverter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ModelConverter.java?rev=687679&r1=687678&r2=687679&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ModelConverter.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/utils/ModelConverter.java Thu Aug 21 03:05:39 2008
@@ -129,12 +129,6 @@
                 IAttribute attribute = new Attribute( entry, name );
                 attribute.addValue( new Value( attribute, parts[i] ) );
                 entry.addAttribute( attribute );
-                // IAttribute attribute = entry.getAttribute("");
-                // if(attribute == null) {
-                // attribute = new Attribute(entry, "");
-                // entry.addAttribute(attribute, null);
-                // }
-                // attribute.addValue(new Value(attribute, parts[i]), null);
             }
         }
 
@@ -146,15 +140,11 @@
 
     public static LdifChangeAddRecord entryToLdifChangeAddRecord( IEntry entry )
     {
-
         boolean mustCreateChangeTypeLine = true;
-        IAttribute[] attributes = entry.getAttributes();
-        for ( int i = 0; i < attributes.length; i++ )
+        for ( IAttribute attribute : entry.getAttributes() )
         {
-            IValue[] values = attributes[i].getValues();
-            for ( int ii = 0; ii < values.length; ii++ )
+            for ( IValue value : attribute.getValues() )
             {
-                IValue value = values[ii];
                 if ( value.getRawValue() instanceof LdifPart )
                 {
                     mustCreateChangeTypeLine = false;
@@ -162,8 +152,6 @@
             }
         }
 
-        // LdifChangeAddRecord record =
-        // LdifChangeAddRecord.create(entry.getDn().toString());
         LdifChangeAddRecord record = new LdifChangeAddRecord( LdifDnLine.create( entry.getDn().getUpName() ) );
         if ( mustCreateChangeTypeLine )
         {
@@ -171,37 +159,38 @@
             record.setChangeType( LdifChangeTypeLine.createAdd() );
         }
 
-        for ( int i = 0; i < attributes.length; i++ )
+        for ( IAttribute attribute : entry.getAttributes() )
         {
-            String name = attributes[i].getDescription();
-            IValue[] values = attributes[i].getValues();
-            for ( int ii = 0; ii < values.length; ii++ )
+            String name = attribute.getDescription();
+            for ( IValue value : attribute.getValues() )
             {
-                IValue value = values[ii];
-                if ( value.getRawValue() instanceof LdifPart )
+                if ( !value.isEmpty() )
                 {
-                    LdifPart part = ( LdifPart ) value.getRawValue();
-                    if ( part instanceof LdifChangeTypeLine )
+                    if ( value.getRawValue() instanceof LdifPart )
                     {
-                        record.setChangeType( ( LdifChangeTypeLine ) part );
+                        LdifPart part = ( LdifPart ) value.getRawValue();
+                        if ( part instanceof LdifChangeTypeLine )
+                        {
+                            record.setChangeType( ( LdifChangeTypeLine ) part );
+                        }
+                        else if ( part instanceof LdifCommentLine )
+                        {
+                            record.addComment( ( LdifCommentLine ) part );
+                        }
+                        else if ( part instanceof LdifControlLine )
+                        {
+                            record.addControl( ( LdifControlLine ) part );
+                        }
                     }
-                    else if ( part instanceof LdifCommentLine )
+                    else if ( value.isString() )
                     {
-                        record.addComment( ( LdifCommentLine ) part );
+                        record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
                     }
-                    else if ( part instanceof LdifControlLine )
+                    else
                     {
-                        record.addControl( ( LdifControlLine ) part );
+                        record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
                     }
                 }
-                else if ( value.isString() )
-                {
-                    record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
-                }
-                else
-                {
-                    record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
-                }
             }
         }
 
@@ -213,32 +202,31 @@
 
     public static LdifContentRecord entryToLdifContentRecord( IEntry entry )
     {
-
         LdifContentRecord record = LdifContentRecord.create( entry.getDn().getUpName() );
 
-        IAttribute[] attributes = entry.getAttributes();
-        for ( int i = 0; i < attributes.length; i++ )
+        for ( IAttribute attribute : entry.getAttributes() )
         {
-            String name = attributes[i].getDescription();
-            IValue[] values = attributes[i].getValues();
-            for ( int ii = 0; ii < values.length; ii++ )
+            String name = attribute.getDescription();
+            for ( IValue value : attribute.getValues() )
             {
-                IValue value = values[ii];
-                if ( value.getRawValue() instanceof LdifPart )
+                if ( !value.isEmpty() )
                 {
-                    LdifPart part = ( LdifPart ) value.getRawValue();
-                    if ( part instanceof LdifCommentLine )
+                    if ( value.getRawValue() instanceof LdifPart )
                     {
-                        record.addComment( ( LdifCommentLine ) part );
+                        LdifPart part = ( LdifPart ) value.getRawValue();
+                        if ( part instanceof LdifCommentLine )
+                        {
+                            record.addComment( ( LdifCommentLine ) part );
+                        }
+                    }
+                    else if ( value.isString() )
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
+                    }
+                    else
+                    {
+                        record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
                     }
-                }
-                else if ( value.isString() )
-                {
-                    record.addAttrVal( LdifAttrValLine.create( name, value.getStringValue() ) );
-                }
-                else
-                {
-                    record.addAttrVal( LdifAttrValLine.create( name, value.getBinaryValue() ) );
                 }
             }
         }



Mime
View raw message