directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1058669 - in /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2: ./ actions/ editor/ jobs/
Date Thu, 13 Jan 2011 17:17:08 GMT
Author: pamarcelot
Date: Thu Jan 13 17:17:07 2011
New Revision: 1058669

URL: http://svn.apache.org/viewvc?rev=1058669&view=rev
Log:
Added implementation for the 'Import Configuration' action.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
    directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/ApacheDS2ConfigurationPluginConstants.java Thu Jan 13 17:17:07 2011
@@ -27,6 +27,10 @@ package org.apache.directory.studio.apac
  */
 public interface ApacheDS2ConfigurationPluginConstants
 {
+    /** The plug-in ID */
+    public static final String PLUGIN_ID = ApacheDS2ConfigurationPlugin.getDefault().getPluginProperties()
+        .getString( "Plugin_id" ); //$NON-NLS-1$
+
     // ------
     // IMAGES
     // ------

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/actions/EditorImportConfigurationAction.java Thu Jan 13 17:17:07 2011
@@ -21,13 +21,29 @@
 package org.apache.directory.studio.apacheds.configuration.v2.actions;
 
 
-import java.util.jar.JarFile;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
 
+import org.apache.directory.server.config.beans.ConfigBean;
 import org.apache.directory.studio.apacheds.configuration.v2.ApacheDS2ConfigurationPlugin;
 import org.apache.directory.studio.apacheds.configuration.v2.ApacheDS2ConfigurationPluginConstants;
+import org.apache.directory.studio.apacheds.configuration.v2.editor.ServerConfigurationEditor;
+import org.apache.directory.studio.apacheds.configuration.v2.jobs.LoadConfigurationRunnable;
+import org.apache.directory.studio.common.ui.CommonUIUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
 
 
 /**
@@ -37,6 +53,23 @@ import org.eclipse.ui.dialogs.SaveAsDial
  */
 public class EditorImportConfigurationAction extends Action
 {
+    private static final String DIALOG_TITLE = "Select Configuration File";
+    /** The associated editor */
+    private ServerConfigurationEditor editor;
+
+
+    /**
+     * Creates a new instance of EditorImportConfigurationAction.
+     *
+     * @param editor
+     *      the associated editor
+     */
+    public EditorImportConfigurationAction( ServerConfigurationEditor editor )
+    {
+        this.editor = editor;
+    }
+
+
     /**
      * {@inheritDoc}
      */
@@ -61,6 +94,124 @@ public class EditorImportConfigurationAc
      */
     public void run()
     {
-        
+        try
+        {
+            // TODO Add confirmation ?
+
+            // The input stream that will be used to load the configuration
+            InputStream inputStream = null;
+
+            // detect IDE or RCP:
+            boolean isIDE = CommonUIUtils.isIDEEnvironment();
+            if ( isIDE )
+            {
+                // Opening a dialog for file selection
+                ElementTreeSelectionDialog dialog = createWorkspaceFileSelectionDialog();
+                if ( dialog.open() == Dialog.OK )
+                {
+                    // Getting the input stream for the selected file
+                    Object firstResult = dialog.getFirstResult();
+                    if ( ( firstResult != null ) && ( firstResult instanceof IFile ) )
+                    {
+                        inputStream = ( ( IFile ) firstResult ).getContents();
+                    }
+                }
+                else
+                {
+                    // Cancel button has been clicked
+                    return;
+                }
+            }
+            else
+            {
+                // Opening a dialog for file selection
+                FileDialog dialog = new FileDialog( editor.getSite().getShell(), SWT.OPEN | SWT.SINGLE );
+                dialog.setText( DIALOG_TITLE );
+                dialog.setFilterPath( System.getProperty( "user.home" ) );
+                String filePath = dialog.open();
+                if ( filePath == null )
+                {
+                    // Cancel button has been clicked
+                    return;
+                }
+
+                // Checking the file
+                File file = new File( filePath );
+                if ( !file.exists() || !file.isFile() || !file.canRead() )
+                {
+                    // This is not a valid file
+                    return;
+                }
+
+                // Getting the input stream for the selected file
+                inputStream = new FileInputStream( file );
+            }
+
+            // Checking if we found an input stream
+            if ( inputStream == null )
+            {
+                return;
+            }
+
+            // Reading the configuration of the file
+            ConfigBean configBean = LoadConfigurationRunnable.readConfiguration( inputStream );
+
+            // Resetting the configuration back to the editor
+            editor.resetConfiguration( configBean );
+        }
+        catch ( Exception e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+    }
+
+
+    /**
+     * Creates a {@link Dialog} to select a single file in the workspace.
+     *
+     * @return
+     *      a {@link Dialog} to select a single file in the workspace
+     */
+    private ElementTreeSelectionDialog createWorkspaceFileSelectionDialog()
+    {
+        ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( editor.getSite().getShell(),
+            new WorkbenchLabelProvider(), new WorkbenchContentProvider() );
+        dialog.setInput( ResourcesPlugin.getWorkspace().getRoot() );
+        dialog.setMessage( "Select the configuration file to import:" );
+        dialog.setTitle( DIALOG_TITLE );
+        dialog.setAllowMultiple( false );
+        dialog.setStatusLineAboveButtons( false );
+        dialog.setValidator( new ISelectionStatusValidator()
+        {
+            /** The validated status */
+            private Status validated = new Status( IStatus.OK, ApacheDS2ConfigurationPluginConstants.PLUGIN_ID,
+                IStatus.OK, "", null );
+
+            /** The not validated status */
+            private Status notValidated = new Status( IStatus.ERROR, ApacheDS2ConfigurationPluginConstants.PLUGIN_ID,
+                IStatus.ERROR, "", null );
+
+
+            public IStatus validate( Object[] selection )
+            {
+                if ( selection != null )
+                {
+                    if ( selection.length > 0 )
+                    {
+                        Object selectedObject = selection[0];
+                        if ( selectedObject instanceof IFile )
+                        {
+                            return validated;
+                        }
+                    }
+                }
+
+                return notValidated;
+            }
+        } );
+
+        return dialog;
     }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/KerberosServerPage.java Thu Jan 13 17:17:07 2011
@@ -74,6 +74,128 @@ public class KerberosServerPage extends 
     private Text maximumRenewableLifetimeText;
     private Text maximumTicketLifetimeText;
 
+    // UI Controls Listeners
+    private SelectionAdapter enableKerberosCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setEnabled( enableKerberosCheckbox.getSelection() );
+        }
+    };
+    private ModifyListener kerberosPortTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerTransportBean().setSystemPort( Integer.parseInt( kerberosPortText.getText() ) );
+        }
+    };
+    private SelectionAdapter enableChangePasswordCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getChangePasswordServerBean().setEnabled( enableChangePasswordCheckbox.getSelection() );
+        }
+    };
+    private ModifyListener changePasswordPortTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getChangePasswordServerTransportBean().setSystemPort(
+                Integer.parseInt( changePasswordPortText.getText() ) );
+        }
+    };
+    private ModifyListener kdcPrincipalTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean().setKrbKdcPrincipal( kdcPrincipalText.getText() );
+        }
+    };
+    private ModifyListener primaryKdcRealmTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean().setKrbPrimaryRealm( primaryKdcRealmText.getText() );
+        }
+    };
+    private ModifyListener kdcSearchBaseDnTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            String searchBaseDnValue = kdcSearchBaseDnText.getText();
+
+            try
+            {
+                DN searchBaseDn = new DN( searchBaseDnValue );
+                getKdcServerBean().setSearchBaseDn( searchBaseDn );
+            }
+            catch ( LdapInvalidDnException e1 )
+            {
+                // TODO Auto-generated catch block
+                e1.printStackTrace();
+            }
+        }
+    };
+    private SelectionAdapter verifyBodyChecksumCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbBodyChecksumVerified( verifyBodyChecksumCheckbox.getSelection() );
+        }
+    };
+    private SelectionAdapter allowEmptyAddressesCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbEmptyAddressesAllowed( allowEmptyAddressesCheckbox.getSelection() );
+        }
+    };
+    private SelectionAdapter allowForwardableAddressesCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbForwardableAllowed( allowForwardableAddressesCheckbox.getSelection() );
+        }
+    };
+    private SelectionAdapter requirePreAuthByEncryptedTimestampCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbPaEncTimestampRequired(
+                requirePreAuthByEncryptedTimestampCheckbox.getSelection() );
+        }
+    };
+    private SelectionAdapter allowPostdatedTicketsCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbPostdatedAllowed( allowPostdatedTicketsCheckbox.getSelection() );
+        }
+    };
+    private SelectionAdapter allowRenewableTicketsCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getKdcServerBean().setKrbRenewableAllowed( allowRenewableTicketsCheckbox.getSelection() );
+        }
+    };
+    private ModifyListener maximumRenewableLifetimeTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean().setKrbMaximumRenewableLifetime(
+                Integer.parseInt( maximumRenewableLifetimeText.getText() ) );
+        }
+    };
+    private ModifyListener maximumTicketLifetimeTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getKdcServerBean()
+                .setKrbMaximumTicketLifetime( Integer.parseInt( maximumTicketLifetimeText.getText() ) );
+        }
+    };
+
 
     /**
      * Creates a new instance of GeneralPage.
@@ -112,9 +234,7 @@ public class KerberosServerPage extends 
         createKerberosSettingsSection( toolkit, rightComposite );
         createTicketSettingsSection( toolkit, leftComposite );
 
-        initUI();
-
-        addListeners();
+        refreshUI();
     }
 
 
@@ -246,8 +366,13 @@ public class KerberosServerPage extends 
     }
 
 
-    private void initUI()
+    /**
+     * {@inheritDoc}
+     */
+    protected void refreshUI()
     {
+        removeListeners();
+
         KdcServerBean kdcServerBean = getKdcServerBean();
         ChangePasswordServerBean changePasswordServerBean = getChangePasswordServerBean();
 
@@ -269,6 +394,8 @@ public class KerberosServerPage extends 
         allowRenewableTicketsCheckbox.setSelection( kdcServerBean.isKrbRenewableAllowed() );
         maximumRenewableLifetimeText.setText( kdcServerBean.getKrbMaximumRenewableLifetime() + "" );
         maximumTicketLifetimeText.setText( kdcServerBean.getKrbMaximumTicketLifetime() + "" );
+
+        addListeners();
     }
 
 
@@ -279,85 +406,31 @@ public class KerberosServerPage extends 
     {
         // Enable Kerberos Checkbox
         addDirtyListener( enableKerberosCheckbox );
-        enableKerberosCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setEnabled( enableKerberosCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( enableKerberosCheckbox, enableKerberosCheckboxListener );
 
         // Kerberos Port Text
         addDirtyListener( kerberosPortText );
-        kerberosPortText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getKdcServerTransportBean().setSystemPort( Integer.parseInt( kerberosPortText.getText() ) );
-            }
-        } );
+        addModifyListener( kerberosPortText, kerberosPortTextListener );
 
         // Enable Change Password Checkbox
         addDirtyListener( enableChangePasswordCheckbox );
-        enableChangePasswordCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getChangePasswordServerBean().setEnabled( enableChangePasswordCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( enableChangePasswordCheckbox, enableChangePasswordCheckboxListener );
 
         // Change Password Port Text
         addDirtyListener( changePasswordPortText );
-        changePasswordPortText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getChangePasswordServerTransportBean().setSystemPort(
-                    Integer.parseInt( changePasswordPortText.getText() ) );
-            }
-        } );
+        addModifyListener( changePasswordPortText, changePasswordPortTextListener );
 
         // KDC Principal Text
         addDirtyListener( kdcPrincipalText );
-        kdcPrincipalText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getKdcServerBean().setKrbKdcPrincipal( kdcPrincipalText.getText() );
-            }
-        } );
+        addModifyListener( kdcPrincipalText, kdcPrincipalTextListener );
 
         // Primary KDC Text
         addDirtyListener( primaryKdcRealmText );
-        primaryKdcRealmText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getKdcServerBean().setKrbPrimaryRealm( primaryKdcRealmText.getText() );
-            }
-        } );
+        addModifyListener( primaryKdcRealmText, primaryKdcRealmTextListener );
 
         // KDC Search Base DN Text
         addDirtyListener( kdcSearchBaseDnText );
-        kdcSearchBaseDnText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                String searchBaseDnValue = kdcSearchBaseDnText.getText();
-
-                try
-                {
-                    DN searchBaseDn = new DN( searchBaseDnValue );
-                    getKdcServerBean().setSearchBaseDn( searchBaseDn );
-                }
-                catch ( LdapInvalidDnException e1 )
-                {
-                    // TODO Auto-generated catch block
-                    e1.printStackTrace();
-                }
-            }
-        } );
+        addModifyListener( kdcSearchBaseDnText, kdcSearchBaseDnTextListener );
 
         // Encryption Types Text
         addDirtyListener( encryptionTypesText );
@@ -368,86 +441,111 @@ public class KerberosServerPage extends 
 
         // Verify Body Checksum Checkbox
         addDirtyListener( verifyBodyChecksumCheckbox );
-        verifyBodyChecksumCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbBodyChecksumVerified( verifyBodyChecksumCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( verifyBodyChecksumCheckbox, verifyBodyChecksumCheckboxListener );
 
         // Allow Empty Addresses Checkbox
         addDirtyListener( allowEmptyAddressesCheckbox );
-        allowEmptyAddressesCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbEmptyAddressesAllowed( allowEmptyAddressesCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( allowEmptyAddressesCheckbox, allowEmptyAddressesCheckboxListener );
 
         // Allow Forwardable Addresses Checkbox
         addDirtyListener( allowForwardableAddressesCheckbox );
-        allowForwardableAddressesCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbForwardableAllowed( allowForwardableAddressesCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( allowForwardableAddressesCheckbox, allowForwardableAddressesCheckboxListener );
 
         // Require Pre-Authentication By Encrypted Timestamp Checkbox
         addDirtyListener( requirePreAuthByEncryptedTimestampCheckbox );
-        requirePreAuthByEncryptedTimestampCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbPaEncTimestampRequired(
-                    requirePreAuthByEncryptedTimestampCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( requirePreAuthByEncryptedTimestampCheckbox,
+            requirePreAuthByEncryptedTimestampCheckboxListener );
 
         // Allow Postdated Tickets Checkbox
         addDirtyListener( allowPostdatedTicketsCheckbox );
-        allowPostdatedTicketsCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbPostdatedAllowed( allowPostdatedTicketsCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( allowPostdatedTicketsCheckbox, allowPostdatedTicketsCheckboxListener );
 
         // Allow Renewable Tickets Checkbox
         addDirtyListener( allowRenewableTicketsCheckbox );
-        allowRenewableTicketsCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getKdcServerBean().setKrbRenewableAllowed( allowRenewableTicketsCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( allowRenewableTicketsCheckbox, allowRenewableTicketsCheckboxListener );
 
         // Maximum Renewable Lifetime Text
         addDirtyListener( maximumRenewableLifetimeText );
-        maximumRenewableLifetimeText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getKdcServerBean().setKrbMaximumRenewableLifetime(
-                    Integer.parseInt( maximumRenewableLifetimeText.getText() ) );
-            }
-        } );
+        addModifyListener( maximumRenewableLifetimeText, maximumRenewableLifetimeTextListener );
 
         // Maximum Ticket Lifetime Text
         addDirtyListener( maximumTicketLifetimeText );
-        maximumTicketLifetimeText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getKdcServerBean()
-                    .setKrbMaximumTicketLifetime( Integer.parseInt( maximumTicketLifetimeText.getText() ) );
-            }
-        } );
+        addModifyListener( maximumTicketLifetimeText, maximumTicketLifetimeTextListener );
+    }
+
+
+    /**
+     * Removes listeners to UI Controls.
+     */
+    private void removeListeners()
+    {
+        // Enable Kerberos Checkbox
+        removeDirtyListener( enableKerberosCheckbox );
+        removeSelectionListener( enableKerberosCheckbox, enableKerberosCheckboxListener );
+
+        // Kerberos Port Text
+        removeDirtyListener( kerberosPortText );
+        removeModifyListener( kerberosPortText, kerberosPortTextListener );
+
+        // Enable Change Password Checkbox
+        removeDirtyListener( enableChangePasswordCheckbox );
+        removeSelectionListener( enableChangePasswordCheckbox, enableChangePasswordCheckboxListener );
+
+        // Change Password Port Text
+        removeDirtyListener( changePasswordPortText );
+        removeModifyListener( changePasswordPortText, changePasswordPortTextListener );
+
+        // KDC Principal Text
+        removeDirtyListener( kdcPrincipalText );
+        removeModifyListener( kdcPrincipalText, kdcPrincipalTextListener );
+
+        // Primary KDC Text
+        removeDirtyListener( primaryKdcRealmText );
+        removeModifyListener( primaryKdcRealmText, primaryKdcRealmTextListener );
+
+        // KDC Search Base DN Text
+        removeDirtyListener( kdcSearchBaseDnText );
+        removeModifyListener( kdcSearchBaseDnText, kdcSearchBaseDnTextListener );
+
+        // Encryption Types Text
+        removeDirtyListener( encryptionTypesText );
+        // TODO A Text Control is probably not the most appropriate one
+
+        removeDirtyListener( allowClockSkewCheckbox );
+        // TODO A Checkbox Control is probably not the most appropriate one
+
+        // Verify Body Checksum Checkbox
+        removeDirtyListener( verifyBodyChecksumCheckbox );
+        removeSelectionListener( verifyBodyChecksumCheckbox, verifyBodyChecksumCheckboxListener );
+
+        // Allow Empty Addresses Checkbox
+        removeDirtyListener( allowEmptyAddressesCheckbox );
+        removeSelectionListener( allowEmptyAddressesCheckbox, allowEmptyAddressesCheckboxListener );
+
+        // Allow Forwardable Addresses Checkbox
+        removeDirtyListener( allowForwardableAddressesCheckbox );
+        removeSelectionListener( allowForwardableAddressesCheckbox, allowForwardableAddressesCheckboxListener );
+
+        // Require Pre-Authentication By Encrypted Timestamp Checkbox
+        removeDirtyListener( requirePreAuthByEncryptedTimestampCheckbox );
+        removeSelectionListener( requirePreAuthByEncryptedTimestampCheckbox,
+            requirePreAuthByEncryptedTimestampCheckboxListener );
+
+        // Allow Postdated Tickets Checkbox
+        removeDirtyListener( allowPostdatedTicketsCheckbox );
+        removeSelectionListener( allowPostdatedTicketsCheckbox, allowPostdatedTicketsCheckboxListener );
+
+        // Allow Renewable Tickets Checkbox
+        removeDirtyListener( allowRenewableTicketsCheckbox );
+        removeSelectionListener( allowRenewableTicketsCheckbox, allowRenewableTicketsCheckboxListener );
+
+        // Maximum Renewable Lifetime Text
+        removeDirtyListener( maximumRenewableLifetimeText );
+        removeModifyListener( maximumRenewableLifetimeText, maximumRenewableLifetimeTextListener );
+
+        // Maximum Ticket Lifetime Text
+        removeDirtyListener( maximumTicketLifetimeText );
+        removeModifyListener( maximumTicketLifetimeText, maximumTicketLifetimeTextListener );
     }
 
 

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/LdapLdapsServersPage.java Thu Jan 13 17:17:07 2011
@@ -72,6 +72,68 @@ public class LdapLdapsServersPage extend
     private Text saslPrincipalText;
     private Text saslSearchBaseDnText;
 
+    // UI Control Listeners
+    private SelectionAdapter enableLdapCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getLdapServerTransportBean().setEnabled( enableLdapCheckbox.getSelection() );
+        }
+    };
+    private ModifyListener ldapPortTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getLdapsServerTransportBean().setSystemPort( Integer.parseInt( ldapPortText.getText() ) );
+        }
+    };
+    private SelectionAdapter enableLdapsCheckboxListener = new SelectionAdapter()
+    {
+        public void widgetSelected( SelectionEvent e )
+        {
+            getLdapsServerTransportBean().setEnabled( enableLdapsCheckbox.getSelection() );
+        }
+    };
+    private ModifyListener ldapsPortTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getLdapsServerTransportBean().setSystemPort( Integer.parseInt( ldapsPortText.getText() ) );
+        }
+    };
+    private ModifyListener saslHostTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getLdapServerBean().setLdapServerSaslHost( saslHostText.getText() );
+        }
+    };
+    private ModifyListener saslPrincipalTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            getLdapServerBean().setLdapServerSaslPrincipal( saslPrincipalText.getText() );
+        }
+    };
+    private ModifyListener saslSearchBaseDnTextListener = new ModifyListener()
+    {
+        public void modifyText( ModifyEvent e )
+        {
+            String searchBaseDnValue = saslSearchBaseDnText.getText();
+
+            try
+            {
+                DN searchBaseDn = new DN( searchBaseDnValue );
+                getLdapServerBean().setSearchBaseDn( searchBaseDn );
+            }
+            catch ( LdapInvalidDnException e1 )
+            {
+                // TODO Auto-generated catch block
+                e1.printStackTrace();
+            }
+        }
+    };
+
 
     /**
      * Creates a new instance of GeneralPage.
@@ -112,9 +174,7 @@ public class LdapLdapsServersPage extend
         createSupportedAuthenticationMechanismsSection( toolkit, rightComposite );
         createSaslSettingsSection( toolkit, rightComposite );
 
-        initUI();
-
-        addListeners();
+        refreshUI();
     }
 
 
@@ -311,8 +371,13 @@ public class LdapLdapsServersPage extend
     }
 
 
-    private void initUI()
+    /**
+     * {@inheritDoc}
+     */
+    protected void refreshUI()
     {
+        removeListeners();
+
         LdapServerBean ldapServerBean = getLdapServerBean();
 
         enableLdapCheckbox.setSelection( ldapServerBean.isEnabled() );
@@ -324,6 +389,8 @@ public class LdapLdapsServersPage extend
         saslHostText.setText( ldapServerBean.getLdapServerSaslHost() );
         saslPrincipalText.setText( ldapServerBean.getLdapServerSaslPrincipal() );
         saslSearchBaseDnText.setText( ldapServerBean.getSearchBaseDn().toString() );
+
+        addListeners();
     }
 
 
@@ -334,43 +401,19 @@ public class LdapLdapsServersPage extend
     {
         // Enable LDAP Checkbox
         addDirtyListener( enableLdapCheckbox );
-        enableLdapCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getLdapServerTransportBean().setEnabled( enableLdapCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( enableLdapCheckbox, enableLdapCheckboxListener );
 
         // LDAP Port Text
         addDirtyListener( ldapPortText );
-        ldapPortText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getLdapsServerTransportBean().setSystemPort( Integer.parseInt( ldapPortText.getText() ) );
-            }
-        } );
+        addModifyListener( ldapPortText, ldapPortTextListener );
 
         // Enable LDAPS Checkbox
         addDirtyListener( enableLdapsCheckbox );
-        enableLdapsCheckbox.addSelectionListener( new SelectionAdapter()
-        {
-            public void widgetSelected( SelectionEvent e )
-            {
-                getLdapsServerTransportBean().setEnabled( enableLdapsCheckbox.getSelection() );
-            }
-        } );
+        addSelectionListener( enableLdapsCheckbox, enableLdapsCheckboxListener );
 
         // LDAPS Port Text
         addDirtyListener( ldapsPortText );
-        ldapsPortText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getLdapsServerTransportBean().setSystemPort( Integer.parseInt( ldapsPortText.getText() ) );
-            }
-        } );
+        addModifyListener( ldapsPortText, ldapsPortTextListener );
 
         // Max Time Limit Text
         addDirtyListener( maxTimeLimitText );
@@ -398,44 +441,74 @@ public class LdapLdapsServersPage extend
 
         // SASL Host Text
         addDirtyListener( saslHostText );
-        saslHostText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getLdapServerBean().setLdapServerSaslHost( saslHostText.getText() );
-            }
-        } );
+        addModifyListener( saslHostText, saslHostTextListener );
 
         // SASL Principal Text
         addDirtyListener( saslPrincipalText );
-        saslPrincipalText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                getLdapServerBean().setLdapServerSaslPrincipal( saslPrincipalText.getText() );
-            }
-        } );
+        addModifyListener( saslPrincipalText, saslPrincipalTextListener );
 
         // SASL Seach Base DN Text
         addDirtyListener( saslSearchBaseDnText );
-        saslSearchBaseDnText.addModifyListener( new ModifyListener()
-        {
-            public void modifyText( ModifyEvent e )
-            {
-                String searchBaseDnValue = saslSearchBaseDnText.getText();
+        addModifyListener( saslSearchBaseDnText, saslSearchBaseDnTextListener );
+    }
 
-                try
-                {
-                    DN searchBaseDn = new DN( searchBaseDnValue );
-                    getLdapServerBean().setSearchBaseDn( searchBaseDn );
-                }
-                catch ( LdapInvalidDnException e1 )
-                {
-                    // TODO Auto-generated catch block
-                    e1.printStackTrace();
-                }
-            }
-        } );
+
+    /**
+     * Removes listeners to UI Controls.
+     */
+    private void removeListeners()
+    {
+        // Enable LDAP Checkbox
+        removeDirtyListener( enableLdapCheckbox );
+        removeSelectionListener( enableLdapCheckbox, enableLdapCheckboxListener );
+
+        // LDAP Port Text
+        removeDirtyListener( ldapPortText );
+        removeModifyListener( ldapPortText, ldapPortTextListener );
+
+        // Enable LDAPS Checkbox
+        removeDirtyListener( enableLdapsCheckbox );
+        removeSelectionListener( enableLdapsCheckbox, enableLdapsCheckboxListener );
+
+        // LDAPS Port Text
+        removeDirtyListener( ldapsPortText );
+        removeModifyListener( ldapsPortText, ldapsPortTextListener );
+
+        // Max Time Limit Text
+        removeDirtyListener( maxTimeLimitText );
+
+        // Max Size Limit Text
+        removeDirtyListener( maxSizeLimitText );
+
+        // Auth Mechanisms Simple Checkbox
+        removeDirtyListener( authMechSimpleCheckbox );
+
+        // Auth Mechanisms CRAM-MD5 Checkbox
+        removeDirtyListener( authMechCramMd5Checkbox );
+
+        // Auth Mechanisms DIGEST-MD5 Checkbox
+        removeDirtyListener( authMechDigestMd5Checkbox );
+
+        // Auth Mechanisms GSSAPI Checkbox
+        removeDirtyListener( authMechGssapiCheckbox );
+
+        // Auth Mechanisms NTLM Checkbox
+        removeDirtyListener( authMechNtlmCheckbox );
+
+        // Auth Mechanisms GSS SPENEGO Checkbox
+        removeDirtyListener( authMechGssSpnegoCheckbox );
+
+        // SASL Host Text
+        removeDirtyListener( saslHostText );
+        removeModifyListener( saslHostText, saslHostTextListener );
+
+        // SASL Principal Text
+        removeDirtyListener( saslPrincipalText );
+        removeModifyListener( saslPrincipalText, saslPrincipalTextListener );
+
+        // SASL Seach Base DN Text
+        removeDirtyListener( saslSearchBaseDnText );
+        removeModifyListener( saslSearchBaseDnText, saslSearchBaseDnTextListener );
     }
 
 

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/OverviewPage.java Thu Jan 13 17:17:07 2011
@@ -119,9 +119,7 @@ public class OverviewPage extends Server
         createKerberosServerSection( toolkit, rightComposite );
         createOptionsSection( toolkit, rightComposite );
 
-        initUI();
-        
-        addListeners();
+        refreshUI();
     }
 
 
@@ -258,8 +256,47 @@ public class OverviewPage extends Server
     }
 
 
-    private void initUI()
+    /**
+     * Adds listeners to UI Controls.
+     */
+    private void addListeners()
+    {
+        addDirtyListener( enableLdapCheckbox );
+        addDirtyListener( ldapPortText );
+        addDirtyListener( enableLdapsCheckbox );
+        addDirtyListener( ldapsPortText );
+        addDirtyListener( enableKerberosCheckbox );
+        addDirtyListener( kerberosPortText );
+        addDirtyListener( enableChangePasswordCheckbox );
+        addDirtyListener( allowAnonymousAccessCheckbox );
+        addDirtyListener( enableAccesControlCheckbox );
+    }
+
+
+    /**
+     * Removes listeners to UI Controls.
+     */
+    private void removeListeners()
+    {
+        removeDirtyListener( enableLdapCheckbox );
+        removeDirtyListener( ldapPortText );
+        removeDirtyListener( enableLdapsCheckbox );
+        removeDirtyListener( ldapsPortText );
+        removeDirtyListener( enableKerberosCheckbox );
+        removeDirtyListener( kerberosPortText );
+        removeDirtyListener( enableChangePasswordCheckbox );
+        removeDirtyListener( allowAnonymousAccessCheckbox );
+        removeDirtyListener( enableAccesControlCheckbox );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void refreshUI()
     {
+        removeListeners();
+
         ConfigBean configBean = getConfigBean();
 
         DirectoryServiceBean directoryServiceBean = configBean.getDirectoryServiceBean();
@@ -288,22 +325,7 @@ public class OverviewPage extends Server
 
         allowAnonymousAccessCheckbox.setSelection( directoryServiceBean.isDsAllowAnonymousAccess() );
         enableAccesControlCheckbox.setSelection( directoryServiceBean.isDsAccessControlEnabled() );
-    }
 
-
-    /**
-     * Adds listeners to UI Controls.
-     */
-    private void addListeners()
-    {
-        addDirtyListener( enableLdapCheckbox );
-        addDirtyListener( ldapPortText );
-        addDirtyListener( enableLdapsCheckbox );
-        addDirtyListener( ldapsPortText );
-        addDirtyListener( enableKerberosCheckbox );
-        addDirtyListener( kerberosPortText );
-        addDirtyListener( enableChangePasswordCheckbox );
-        addDirtyListener( allowAnonymousAccessCheckbox );
-        addDirtyListener( enableAccesControlCheckbox );
+        addListeners();
     }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/PartitionsPage.java Thu Jan 13 17:17:07 2011
@@ -39,7 +39,7 @@ public class PartitionsPage extends Serv
 
 
     /**
-     * Creates a new instance of GeneralPage.
+     * Creates a new instance of PartitionsPage.
      *
      * @param editor
      *      the associated editor
@@ -58,4 +58,14 @@ public class PartitionsPage extends Serv
         PartitionsMasterDetailsBlock masterDetailsBlock = new PartitionsMasterDetailsBlock( this );
         masterDetailsBlock.createContent( getManagedForm() );
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void refreshUI()
+    {
+        // TODO Auto-generated method stub
+
+    }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ReplicationPage.java Thu Jan 13 17:17:07 2011
@@ -20,13 +20,8 @@
 package org.apache.directory.studio.apacheds.configuration.v2.editor;
 
 
-import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.IManagedForm;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
 import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
 
 
 /**
@@ -34,7 +29,7 @@ import org.eclipse.ui.forms.widgets.Scro
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ReplicationPage extends FormPage
+public class ReplicationPage extends ServerConfigurationEditorPage
 {
     /** The Page ID*/
     public static final String ID = ReplicationPage.class.getName(); //$NON-NLS-1$
@@ -44,12 +39,12 @@ public class ReplicationPage extends For
 
 
     /**
-     * Creates a new instance of GeneralPage.
+     * Creates a new instance of ReplicationPage.
      *
      * @param editor
      *      the associated editor
      */
-    public ReplicationPage( FormEditor editor )
+    public ReplicationPage( ServerConfigurationEditor editor )
     {
         super( editor, ID, TITLE );
     }
@@ -58,15 +53,17 @@ public class ReplicationPage extends For
     /**
      * {@inheritDoc}
      */
-    protected void createFormContent( IManagedForm managedForm )
+    protected void createFormContent( Composite parent, FormToolkit toolkit )
     {
-        ScrolledForm form = managedForm.getForm();
-        form.setText( "Replication" );
+    }
+
 
-        Composite parent = form.getBody();
-        parent.setLayout( new GridLayout() );
+    /**
+     * {@inheritDoc}
+     */
+    protected void refreshUI()
+    {
+        // TODO Auto-generated method stub
 
-        FormToolkit toolkit = managedForm.getToolkit();
-        toolkit.decorateFormHeading( form.getForm() );
     }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditor.java Thu Jan 13 17:17:07 2011
@@ -67,6 +67,14 @@ public class ServerConfigurationEditor e
     /** The configuration bean */
     private ConfigBean configBean;
 
+    // The pages
+    private LoadingPage loadingPage;
+    private OverviewPage overviewPage;
+    private LdapLdapsServersPage ldapLdapsServersPage;
+    private KerberosServerPage kerberosServerPage;
+    private PartitionsPage partitionsPage;
+    private ReplicationPage replicationPage;
+
 
     /**
      * {@inheritDoc}
@@ -107,7 +115,8 @@ public class ServerConfigurationEditor e
     {
         try
         {
-            addPage( new LoadingPage( this ) );
+            loadingPage = new LoadingPage( this );
+            addPage( loadingPage );
         }
         catch ( PartInitException e )
         {
@@ -418,6 +427,24 @@ public class ServerConfigurationEditor e
 
 
     /**
+     * Resets the configuration and refresh the UI.
+     *
+     * @param configBean
+     *      the configuration bean
+     */
+    public void resetConfiguration( ConfigBean configBean )
+    {
+        setConfiguration( configBean );
+
+        overviewPage.refreshUI();
+        ldapLdapsServersPage.refreshUI();
+        kerberosServerPage.refreshUI();
+        partitionsPage.refreshUI();
+        replicationPage.refreshUI();
+    }
+
+
+    /**
      * This method is called by the job responsible for loading the configuration.
      *
      * @param configBean
@@ -442,11 +469,16 @@ public class ServerConfigurationEditor e
         // Adding the configuration pages
         try
         {
-            addPage( new OverviewPage( this ) );
-            addPage( new LdapLdapsServersPage( this ) );
-            addPage( new KerberosServerPage( this ) );
-            addPage( new PartitionsPage( this ) );
-            addPage( new ReplicationPage( this ) );
+            overviewPage = new OverviewPage( this );
+            addPage( overviewPage );
+            ldapLdapsServersPage = new LdapLdapsServersPage( this );
+            addPage( ldapLdapsServersPage );
+            kerberosServerPage = new KerberosServerPage( this );
+            addPage( kerberosServerPage );
+            partitionsPage = new PartitionsPage( this );
+            addPage( partitionsPage );
+            replicationPage = new ReplicationPage( this );
+            addPage( replicationPage );
         }
         catch ( PartInitException e )
         {

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor/ServerConfigurationEditorPage.java Thu Jan 13 17:17:07 2011
@@ -162,10 +162,12 @@ public abstract class ServerConfiguratio
         FormToolkit toolkit = managedForm.getToolkit();
         toolkit.decorateFormHeading( form.getForm() );
 
+        ServerConfigurationEditor editor = ( ServerConfigurationEditor ) getEditor();
+
         IToolBarManager toolbarManager = form.getToolBarManager();
-        toolbarManager.add( new EditorImportConfigurationAction() );
+        toolbarManager.add( new EditorImportConfigurationAction( editor ) );
         toolbarManager.add( new Separator() );
-        toolbarManager.add( new EditorExportConfigurationAction( ( ServerConfigurationEditor ) getEditor() ) );
+        toolbarManager.add( new EditorExportConfigurationAction( editor ) );
 
         toolbarManager.update( true );
 
@@ -185,6 +187,12 @@ public abstract class ServerConfiguratio
 
 
     /**
+     * Refreshes the UI.
+     */
+    protected abstract void refreshUI();
+
+
+    /**
      * Creates a Text that can be used to enter a port number.
      *
      * @param toolkit
@@ -266,6 +274,74 @@ public abstract class ServerConfiguratio
 
 
     /**
+     * Adds a modify listener to the given Text.
+     *
+     * @param text
+     *      the Text control
+     * @param listener
+     *      the listener
+     */
+    public void addModifyListener( Text text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener != null ) )
+        {
+            text.addModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Adds a selection listener to the given Button.
+     *
+     * @param button
+     *      the Button control
+     * @param listener
+     *      the listener
+     */
+    public void addSelectionListener( Button button, SelectionListener listener )
+    {
+        if ( ( button != null ) && ( !button.isDisposed() ) && ( listener != null ) )
+        {
+            button.addSelectionListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a modify listener to the given Text.
+     *
+     * @param text
+     *      the Text control
+     * @param listener
+     *      the listener
+     */
+    public void removeModifyListener( Text text, ModifyListener listener )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) && ( listener != null ) )
+        {
+            text.removeModifyListener( listener );
+        }
+    }
+
+
+    /**
+     * Removes a selection listener to the given Button.
+     *
+     * @param button
+     *      the Button control
+     * @param listener
+     *      the listener
+     */
+    public void removeSelectionListener( Button button, SelectionListener listener )
+    {
+        if ( ( button != null ) && ( !button.isDisposed() ) && ( listener != null ) )
+        {
+            button.removeSelectionListener( listener );
+        }
+    }
+
+
+    /**
      * Adds a 'dirty' listener to the given Text.
      *
      * @param text
@@ -287,4 +363,28 @@ public abstract class ServerConfiguratio
     {
         button.addSelectionListener( dirtySelectionListener );
     }
+
+
+    /**
+     * Removes a 'dirty' listener to the given Text.
+     *
+     * @param text
+     *      the Text control
+     */
+    public void removeDirtyListener( Text text )
+    {
+        removeModifyListener( text, dirtyModifyListener );
+    }
+
+
+    /**
+     * Removes a 'dirty' listener to the given Button.
+     *
+     * @param button
+     *      the Button control
+     */
+    public void removeDirtyListener( Button button )
+    {
+        removeSelectionListener( button, dirtySelectionListener );
+    }
 }

Modified: directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java?rev=1058669&r1=1058668&r2=1058669&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/jobs/LoadConfigurationRunnable.java Thu Jan 13 17:17:07 2011
@@ -117,20 +117,16 @@ public class LoadConfigurationRunnable i
     {
         IEditorInput input = editor.getEditorInput();
 
-        ConfigBean configBean = null;
         try
         {
-            configBean = getConfiguration( input, monitor );
+            final ConfigBean configBean = getConfiguration( input, monitor );
             if ( configBean != null )
             {
-                final ConfigBean finalConfigBean = configBean;
-                final IEditorInput finalInput = input;
-
                 Display.getDefault().asyncExec( new Runnable()
                 {
                     public void run()
                     {
-                        editor.configurationLoaded( finalConfigBean );
+                        editor.configurationLoaded( configBean );
                     }
                 } );
             }
@@ -144,7 +140,7 @@ public class LoadConfigurationRunnable i
 
 
     /**
-     * Gets a new default configuration.
+     * Gets the configuration from the input.
      * 
      * @param input
      *      the editor input
@@ -156,34 +152,31 @@ public class LoadConfigurationRunnable i
      */
     public ConfigBean getConfiguration( IEditorInput input, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the schema manager
-        SchemaManager schemaManager = ApacheDS2ConfigurationPlugin.getDefault().getSchemaManager();
-
         String inputClassName = input.getClass().getName();
         // If the input is a NewServerConfigurationInput, then we only 
         // need to get the server configuration and return
         if ( input instanceof NewServerConfigurationInput )
         {
             InputStream is = ApacheDS2ConfigurationPlugin.class.getResourceAsStream( "config.ldif" );
-            return readConfiguration( schemaManager, is );
+            return readConfiguration( is );
         }
         // If the input is a ConnectionServerConfigurationInput, then we 
         // read the server configuration from the selected connection
         if ( input instanceof ConnectionServerConfigurationInput )
         {
-            return readConfiguration( schemaManager, ( ConnectionServerConfigurationInput ) input, monitor );
+            return readConfiguration( ( ConnectionServerConfigurationInput ) input, monitor );
         }
         else if ( input instanceof FileEditorInput )
         // The 'FileEditorInput' class is used when the file is opened
         // from a project in the workspace.
         {
             InputStream is = ( ( FileEditorInput ) input ).getFile().getContents();
-            return readConfiguration( schemaManager, is );
+            return readConfiguration( is );
         }
         else if ( input instanceof IPathEditorInput )
         {
             InputStream is = new FileInputStream( new File( ( ( IPathEditorInput ) input ).getPath().toOSString() ) );
-            return readConfiguration( schemaManager, is );
+            return readConfiguration( is );
         }
         else if ( inputClassName.equals( "org.eclipse.ui.internal.editors.text.JavaFileEditorInput" ) //$NON-NLS-1$
             || inputClassName.equals( "org.eclipse.ui.ide.FileStoreEditorInput" ) ) //$NON-NLS-1$
@@ -194,7 +187,7 @@ public class LoadConfigurationRunnable i
         {
             // We use the tooltip to get the full path of the file
             InputStream is = new FileInputStream( new File( input.getToolTipText() ) );
-            return readConfiguration( schemaManager, is );
+            return readConfiguration( is );
         }
 
         return null;
@@ -204,21 +197,19 @@ public class LoadConfigurationRunnable i
     /**
      * Reads the configuration from the given input stream.
      *
-     * @param schemaManager
-     *      the schema manager
      * @param is
      *      the input stream
      * @return
      *      the associated configuration bean
      * @throws Exception
      */
-    private ConfigBean readConfiguration( SchemaManager schemaManager, InputStream is ) throws Exception
+    public static ConfigBean readConfiguration( InputStream is ) throws Exception
     {
         if ( is != null )
         {
             // Creating a partition associated from the input stream
             ReadOnlyConfigurationPartition configurationPartition = new ReadOnlyConfigurationPartition( is,
-                schemaManager );
+                ApacheDS2ConfigurationPlugin.getDefault().getSchemaManager() );
             configurationPartition.initialize();
 
             // Reading the configuration partition
@@ -239,7 +230,7 @@ public class LoadConfigurationRunnable i
      *      the associated configuration bean
      * @throws LdapException
      */
-    private ConfigBean readConfiguration( BTreePartition<Long> partition ) throws LdapException
+    private static ConfigBean readConfiguration( BTreePartition<Long> partition ) throws LdapException
     {
         if ( partition != null )
         {
@@ -254,8 +245,6 @@ public class LoadConfigurationRunnable i
     /**
      * Reads the configuration from the given connection.
      *
-     * @param schemaManager
-     *      the schema manager
      * @param input
      *      the editor input
      * @param monitor 
@@ -264,11 +253,12 @@ public class LoadConfigurationRunnable i
      *      the associated configuration bean
      * @throws Exception
      */
-    private ConfigBean readConfiguration( SchemaManager schemaManager, ConnectionServerConfigurationInput input,
+    private ConfigBean readConfiguration( ConnectionServerConfigurationInput input,
         StudioProgressMonitor monitor ) throws Exception
     {
         if ( input != null )
         {
+            SchemaManager schemaManager = ApacheDS2ConfigurationPlugin.getDefault().getSchemaManager();
 
             // Getting the browser connection associated with the 
             IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()



Mime
View raw message