directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1694439 [3/4] - in /directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui: ./ actions/ dialogs/ dnd/ preferences/ properties/ widgets/ wizards/
Date Thu, 06 Aug 2015 10:03:43 GMT
Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/preferences/PasswordsKeystorePreferencePage.java Thu Aug  6 10:03:42 2015
@@ -24,10 +24,11 @@ package org.apache.directory.studio.conn
 import java.io.File;
 import java.io.IOException;
 import java.security.KeyStoreException;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
 import org.apache.directory.studio.common.ui.CommonUIUtils;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.connection.core.Connection;
@@ -72,7 +73,7 @@ public class PasswordsKeystorePreference
     private PasswordsKeyStoreManager passwordsKeyStoreManager;
 
     /** The map used to backup connections passwords */
-    private Map<String, String> connectionsPasswordsBackup = new HashMap<String, String>();
+    private Map<String, String> connectionsPasswordsBackup = new ConcurrentHashMap<String, String>();
 
     /** The connection manager */
     private ConnectionManager connectionManager;
@@ -84,7 +85,10 @@ public class PasswordsKeystorePreference
     // Listeners
     private SelectionListener enableKeystoreCheckboxListener = new SelectionAdapter()
     {
-        public void widgetSelected( SelectionEvent e )
+        /**
+         * {@inheritDoc}
+         */
+        public void widgetSelected( SelectionEvent event )
         {
             Boolean selected = enableKeystoreCheckbox.getSelection();
 
@@ -117,9 +121,14 @@ public class PasswordsKeystorePreference
             updateButtonsEnabledState();
         }
     };
+
+    
     private SelectionListener changeMasterPasswordButtonListener = new SelectionAdapter()
     {
-        public void widgetSelected( SelectionEvent e )
+        /**
+         * {@inheritDoc}
+         */
+        public void widgetSelected( SelectionEvent event )
         {
             changeMasterPassword();
         }
@@ -380,7 +389,7 @@ public class PasswordsKeystorePreference
             globalPasswordsKeyStoreManager.reset();
 
             // Looking for connections passwords in the list
-            if ( connectionsPasswordsBackup.size() > 0 )
+            if ( !connectionsPasswordsBackup.isEmpty() )
             {
                 // Adding them to the keystore
                 for ( String connectionId : connectionsPasswordsBackup.keySet() )
@@ -548,15 +557,15 @@ public class PasswordsKeystorePreference
                 // Creating the message
                 String message = null;
 
-                if ( checkPasswordException != null )
+                if ( checkPasswordException == null )
                 {
-                    message = Messages
-                        .getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException" ) //$NON-NLS-1$
-                        + checkPasswordException.getMessage();
+                    message = Messages.getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed" ); //$NON-NLS-1$
                 }
                 else
                 {
-                    message = Messages.getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed" ); //$NON-NLS-1$
+                    message = Messages
+                        .getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException" ) //$NON-NLS-1$
+                        + checkPasswordException.getMessage();
                 }
 
                 // We ask the user if he wants to retry to unlock the passwords keystore
@@ -617,7 +626,7 @@ public class PasswordsKeystorePreference
         {
             // We ask the user to reset his master password
             ResetPasswordDialog resetPasswordDialog = new ResetPasswordDialog( changeMasterPasswordButton.getShell(),
-                "", null, null ); //$NON-NLS-1$
+                StringUtils.EMPTY, null, null ); //$NON-NLS-1$
 
             if ( resetPasswordDialog.open() != ResetPasswordDialog.OK )
             {
@@ -643,15 +652,15 @@ public class PasswordsKeystorePreference
             // Creating the message
             String message = null;
 
-            if ( checkPasswordException != null )
+            if ( checkPasswordException == null )
             {
-                message = Messages
-                    .getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException" ) //$NON-NLS-1$
-                    + checkPasswordException.getMessage();
+                message = Messages.getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed" ); //$NON-NLS-1$
             }
             else
             {
-                message = Messages.getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailed" ); //$NON-NLS-1$
+                message = Messages
+                    .getString( "PasswordsKeystorePreferencePage.MasterPasswordVerificationFailedWithException" ) //$NON-NLS-1$
+                    + checkPasswordException.getMessage();
             }
 
             // We ask the user if he wants to retry to unlock the passwords keystore

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/Messages.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/Messages.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/properties/Messages.java Thu Aug  6 10:03:42 2015
@@ -29,13 +29,20 @@ import java.util.ResourceBundle;
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Messages
+public final class Messages
 {
     /** The resource name */
     private static final ResourceBundle RESOURCE_BUNDLE = 
         ResourceBundle.getBundle( Messages.class.getPackage().getName() + ".messages" );
     
     /**
+     * A private constructor : this is an utility class
+     */
+    private Messages()
+    {
+    }
+
+    /**
      * Get back a message from the resource file given a key
      * 
      * @param key The key associated with the message

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java Thu Aug  6 10:03:42 2015
@@ -26,6 +26,8 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.constants.SaslSecurityStrength;
 import org.apache.directory.api.ldap.model.url.LdapUrl;
 import org.apache.directory.api.ldap.model.url.LdapUrl.Extension;
+import org.apache.directory.api.util.Strings;
+import org.apache.directory.studio.common.ui.CommonUIUtils;
 import org.apache.directory.studio.common.ui.HistoryUtils;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.connection.core.Connection;
@@ -77,30 +79,52 @@ import org.eclipse.ui.forms.widgets.Expa
  */
 public class AuthenticationParameterPage extends AbstractConnectionParameterPage
 {
-
+    /** The URL X_AUTH_METHOD constant */
     private static final String X_AUTH_METHOD = "X-AUTH-METHOD"; //$NON-NLS-1$
 
+    /** The URL anonymous constant */
     private static final String X_AUTH_METHOD_ANONYMOUS = "Anonymous"; //$NON-NLS-1$
 
+    /** The URL simple constant */
     private static final String X_AUTH_METHOD_SIMPLE = "Simple"; //$NON-NLS-1$
 
+    /** The URL DIGEST-MD5 constant */
     private static final String X_AUTH_METHOD_DIGEST_MD5 = "DIGEST-MD5"; //$NON-NLS-1$
 
+    /** The URL CRAM-MD5 constant */
     private static final String X_AUTH_METHOD_CRAM_MD5 = "CRAM-MD5"; //$NON-NLS-1$
 
+    /** The URL GSSAPI constant */
     private static final String X_AUTH_METHOD_GSSAPI = "GSSAPI"; //$NON-NLS-1$
 
+    /** The URL X_BIND_USER constant */
     private static final String X_BIND_USER = "X-BIND-USER"; //$NON-NLS-1$
 
+    /** The URL X_BIND_PASSWORD constant */
     private static final String X_BIND_PASSWORD = "X-BIND-PASSWORD"; //$NON-NLS-1$
 
+    /** The SASL REALM constant */
     private static final String X_SASL_REALM = "X-SASL-REALM"; //$NON-NLS-1$
+
+    /** The SASL QOP constant */
     private static final String X_SASL_QOP = "X-SASL-QOP"; //$NON-NLS-1$
+    
+    /** The SASL QOP AUTH-INT constant */
     private static final String X_SASL_QOP_AUTH_INT = "AUTH-INT"; //$NON-NLS-1$
+    
+    /** The SASL QOP AUTH-INT PROV constant */
     private static final String X_SASL_QOP_AUTH_INT_PRIV = "AUTH-INT-PRIV"; //$NON-NLS-1$
+    
+    /** The SASL Security Strength constant */
     private static final String X_SASL_SEC_STRENGTH = "X-SASL-SEC-STRENGTH"; //$NON-NLS-1$
+    
+    /** The SASL Medium security constant */
     private static final String X_SASL_SEC_STRENGTH_MEDIUM = "MEDIUM"; //$NON-NLS-1$
+    
+    /** The SASL Low security constant */
     private static final String X_SASL_SEC_STRENGTH_LOW = "LOW"; //$NON-NLS-1$
+    
+    /** The SASL no-mutual-auth constant */
     private static final String X_SASL_NO_MUTUAL_AUTH = "X-SASL-NO-MUTUAL-AUTH"; //$NON-NLS-1$
 
     private static final String X_KRB5_CREDENTIALS_CONF = "X-KRB5-CREDENTIALS-CONF"; //$NON-NLS-1$
@@ -129,7 +153,6 @@ public class AuthenticationParameterPage
     private Button checkPrincipalPasswordAuthButton;
 
     // SASL stuff
-    private ExpandableComposite saslExpandableComposite;
     private Composite saslComposite;
     private Combo saslRealmText;
     private Combo saslQopCombo;
@@ -137,7 +160,6 @@ public class AuthenticationParameterPage
     private Button saslMutualAuthenticationButton;
 
     // Kerberos stuff
-    private ExpandableComposite krb5ExpandableComposite;
     private Composite krb5Composite;
     private Button krb5CredentialConfigurationUseNativeButton;
     private Button krb5CredentialConfigurationObtainTgtButton;
@@ -151,14 +173,6 @@ public class AuthenticationParameterPage
 
 
     /**
-     * Creates a new instance of AuthenticationParameterPage.
-     */
-    public AuthenticationParameterPage()
-    {
-    }
-
-
-    /**
      * Gets the authentication method.
      * 
      * @return the authentication method
@@ -169,12 +183,16 @@ public class AuthenticationParameterPage
         {
             case 1:
                 return ConnectionParameter.AuthenticationMethod.SIMPLE;
+                
             case 2:
                 return ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5;
+                
             case 3:
                 return ConnectionParameter.AuthenticationMethod.SASL_CRAM_MD5;
+                
             case 4:
                 return ConnectionParameter.AuthenticationMethod.SASL_GSSAPI;
+                
             default:
                 return ConnectionParameter.AuthenticationMethod.NONE;
         }
@@ -215,8 +233,10 @@ public class AuthenticationParameterPage
         {
             case 1:
                 return SaslQoP.AUTH_INT;
+                
             case 2:
                 return SaslQoP.AUTH_CONF;
+                
             default:
                 return SaslQoP.AUTH;
         }
@@ -229,8 +249,10 @@ public class AuthenticationParameterPage
         {
             case 1:
                 return SaslSecurityStrength.MEDIUM;
+                
             case 2:
                 return SaslSecurityStrength.LOW;
+                
             default:
                 return SaslSecurityStrength.HIGH;
         }
@@ -269,8 +291,16 @@ public class AuthenticationParameterPage
 
     private int getKdcPort()
     {
-        return !"".equals( krb5ConfigManualPortText.getText() ) ? Integer.parseInt( krb5ConfigManualPortText.getText() ) //$NON-NLS-1$
-            : 0;
+        String krb5ConfigPort = krb5ConfigManualPortText.getText();
+        
+        if ( Strings.isEmpty( krb5ConfigPort ) )
+        {
+            return 0;
+        }
+        else
+        {
+            return Integer.parseInt( krb5ConfigPort );
+        }
     }
 
 
@@ -293,14 +323,16 @@ public class AuthenticationParameterPage
      */
     private Connection getTestConnection()
     {
-        ConnectionParameter cp = connectionParameterPageModifyListener.getTestConnectionParameters();
-        Connection conn = new Connection( cp );
+        ConnectionParameter connectionParameter = connectionParameterPageModifyListener.getTestConnectionParameters();
+        Connection conn = new Connection( connectionParameter );
+        
         return conn;
     }
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#createComposite(org.eclipse.swt.widgets.Composite)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#
+     *          createComposite(org.eclipse.swt.widgets.Composite)
      */
     protected void createComposite( Composite parent )
     {
@@ -312,11 +344,14 @@ public class AuthenticationParameterPage
         Composite groupComposite = BaseWidgetUtils.createColumnContainer( group1, 1, 1 );
 
         String[] authMethods = new String[]
-            { Messages.getString( "AuthenticationParameterPage.AnonymousAuthentication" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.SimpleAuthentication" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.DigestMD5" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.CramMD5" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.GSSAPI" ) }; //$NON-NLS-1$
+        { 
+            Messages.getString( "AuthenticationParameterPage.AnonymousAuthentication" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.SimpleAuthentication" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.DigestMD5" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.CramMD5" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.GSSAPI" ) //$NON-NLS-1$
+        };
+        
         authenticationMethodCombo = BaseWidgetUtils.createReadonlyCombo( groupComposite, authMethods, 1, 2 );
 
         // Authentication Parameter
@@ -332,7 +367,7 @@ public class AuthenticationParameterPage
         bindPrincipalCombo = BaseWidgetUtils.createCombo( composite, dnHistory, -1, 2 );
 
         BaseWidgetUtils.createLabel( composite, Messages.getString( "AuthenticationParameterPage.BindPassword" ), 1 ); //$NON-NLS-1$
-        bindPasswordText = BaseWidgetUtils.createPasswordText( composite, "", 2 ); //$NON-NLS-1$
+        bindPasswordText = BaseWidgetUtils.createPasswordText( composite, StringUtils.EMPTY, 2 ); //$NON-NLS-1$
 
         BaseWidgetUtils.createSpacer( composite, 1 );
         saveBindPasswordButton = BaseWidgetUtils.createCheckbox( composite, Messages
@@ -340,32 +375,32 @@ public class AuthenticationParameterPage
         saveBindPasswordButton.setSelection( true );
 
         checkPrincipalPasswordAuthButton = new Button( composite, SWT.PUSH );
-        GridData gd = new GridData( GridData.FILL_HORIZONTAL );
-        gd.horizontalAlignment = SWT.RIGHT;
-        checkPrincipalPasswordAuthButton.setLayoutData( gd );
+        GridData gridData = new GridData( GridData.FILL_HORIZONTAL );
+        gridData.horizontalAlignment = SWT.RIGHT;
+        checkPrincipalPasswordAuthButton.setLayoutData( gridData );
         checkPrincipalPasswordAuthButton.setText( Messages
             .getString( "AuthenticationParameterPage.CheckAuthentication" ) ); //$NON-NLS-1$
         checkPrincipalPasswordAuthButton.setEnabled( false );
 
-        ScrolledComposite sc = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
-        sc.setLayout( new GridLayout() );
-        sc.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
-        Composite c = BaseWidgetUtils.createColumnContainer( sc, 1, 1 );
-        sc.setContent( c );
+        ScrolledComposite scrolledComposite = new ScrolledComposite( parent, SWT.H_SCROLL | SWT.V_SCROLL );
+        scrolledComposite.setLayout( new GridLayout() );
+        scrolledComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+        Composite contentComposite = BaseWidgetUtils.createColumnContainer( scrolledComposite, 1, 1 );
+        scrolledComposite.setContent( contentComposite );
 
-        saslExpandableComposite = createExpandableSection( c, Messages
+        ExpandableComposite saslExpandableComposite = createExpandableSection( contentComposite, Messages
             .getString( "AuthenticationParameterPage.SaslOptions" ), 1 ); //$NON-NLS-1$
         saslComposite = BaseWidgetUtils.createColumnContainer( saslExpandableComposite, 2, 1 );
         saslExpandableComposite.setClient( saslComposite );
         createSaslControls();
 
-        krb5ExpandableComposite = createExpandableSection( c, Messages
+        ExpandableComposite krb5ExpandableComposite = createExpandableSection( contentComposite, Messages
             .getString( "AuthenticationParameterPage.Krb5Options" ), 1 ); //$NON-NLS-1$
         krb5Composite = BaseWidgetUtils.createColumnContainer( krb5ExpandableComposite, 1, 1 );
         krb5ExpandableComposite.setClient( krb5Composite );
         createKrb5Controls();
 
-        c.setSize( c.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
+        contentComposite.setSize( contentComposite.computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
     }
 
 
@@ -379,12 +414,16 @@ public class AuthenticationParameterPage
         excomposite.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, false, nColumns, 1 ) );
         excomposite.addExpansionListener( new ExpansionAdapter()
         {
-            public void expansionStateChanged( ExpansionEvent e )
+            /**
+             * {@inheritDoc}
+             */
+            public void expansionStateChanged( ExpansionEvent event )
             {
-                ExpandableComposite excomposite = ( ExpandableComposite ) e.getSource();
+                ExpandableComposite excomposite = ( ExpandableComposite ) event.getSource();
                 excomposite.getParent().setSize( excomposite.getParent().computeSize( SWT.DEFAULT, SWT.DEFAULT ) );
             }
         } );
+        
         return excomposite;
     }
 
@@ -397,18 +436,26 @@ public class AuthenticationParameterPage
         saslRealmText = BaseWidgetUtils.createCombo( saslComposite, saslHistory, -1, 1 );
 
         BaseWidgetUtils.createLabel( saslComposite, Messages.getString( "AuthenticationParameterPage.SaslQop" ), 1 ); //$NON-NLS-1$
+        
         String[] qops = new String[]
-            { Messages.getString( "AuthenticationParameterPage.SaslQopAuth" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.SaslQopAuthInt" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.SaslQopAuthIntPriv" ) }; //$NON-NLS-1$
+        { 
+            Messages.getString( "AuthenticationParameterPage.SaslQopAuth" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.SaslQopAuthInt" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.SaslQopAuthIntPriv" ) //$NON-NLS-1$
+        };
+        
         saslQopCombo = BaseWidgetUtils.createReadonlyCombo( saslComposite, qops, 0, 1 );
 
         BaseWidgetUtils.createLabel( saslComposite, Messages
             .getString( "AuthenticationParameterPage.SaslSecurityStrength" ), 1 ); //$NON-NLS-1$
+        
         String[] securityStrengths = new String[]
-            { Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthHigh" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthMedium" ), //$NON-NLS-1$
-                Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthLow" ) }; //$NON-NLS-1$
+        { 
+            Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthHigh" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthMedium" ), //$NON-NLS-1$
+            Messages.getString( "AuthenticationParameterPage.SaslSecurityStrengthLow" ) //$NON-NLS-1$
+        };
+        
         saslSecurityStrengthCombo = BaseWidgetUtils.createReadonlyCombo( saslComposite, securityStrengths, 0, 1 );
 
         saslMutualAuthenticationButton = BaseWidgetUtils.createCheckbox( saslComposite, Messages
@@ -439,15 +486,15 @@ public class AuthenticationParameterPage
         krb5ConfigDefaultButton.setSelection( true );
         krb5ConfigFileButton = BaseWidgetUtils.createRadiobutton( configComposite, Messages
             .getString( "AuthenticationParameterPage.Krb5ConfigFile" ), 1 ); //$NON-NLS-1$
-        krb5ConfigFileText = BaseWidgetUtils.createText( configComposite, "", 2 ); //$NON-NLS-1$
+        krb5ConfigFileText = BaseWidgetUtils.createText( configComposite, StringUtils.EMPTY, 2 ); //$NON-NLS-1$
         krb5ConfigManualButton = BaseWidgetUtils.createRadiobutton( configComposite, Messages
             .getString( "AuthenticationParameterPage.Krb5ConfigManual" ), 1 ); //$NON-NLS-1$
         BaseWidgetUtils.createLabel( configComposite, Messages.getString( "AuthenticationParameterPage.Krb5Realm" ), 1 ); //$NON-NLS-1$
-        krb5ConfigManualRealmText = BaseWidgetUtils.createText( configComposite, "", 1 ); //$NON-NLS-1$
+        krb5ConfigManualRealmText = BaseWidgetUtils.createText( configComposite, StringUtils.EMPTY, 1 ); //$NON-NLS-1$
         BaseWidgetUtils.createSpacer( configComposite, 1 );
         BaseWidgetUtils.createLabel( configComposite,
             Messages.getString( "AuthenticationParameterPage.Krb5KdcHost" ), 1 ); //$NON-NLS-1$
-        krb5ConfigManualHostText = BaseWidgetUtils.createText( configComposite, "", 1 ); //$NON-NLS-1$
+        krb5ConfigManualHostText = BaseWidgetUtils.createText( configComposite, StringUtils.EMPTY, 1 ); //$NON-NLS-1$
         BaseWidgetUtils.createSpacer( configComposite, 1 );
         BaseWidgetUtils.createLabel( configComposite,
             Messages.getString( "AuthenticationParameterPage.Krb5KdcPort" ), 1 ); //$NON-NLS-1$
@@ -475,6 +522,7 @@ public class AuthenticationParameterPage
         Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences();
         boolean useKrb5SystemProperties = preferences
             .getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES );
+        
         if ( krb5Composite != null )
         {
             krb5CredentialConfigurationUseNativeButton.setEnabled( isGssapiEnabled() && !useKrb5SystemProperties );
@@ -493,56 +541,55 @@ public class AuthenticationParameterPage
             krb5ConfigManualPortText.setEnabled( isGssapiEnabled() && krb5ConfigManualButton.getSelection()
                 && !useKrb5SystemProperties );
         }
+        
         bindPrincipalCombo.setEnabled( isPrincipalPasswordEnabled() );
         bindPasswordText.setEnabled( isPrincipalPasswordEnabled() && isSaveBindPassword() );
         saveBindPasswordButton.setEnabled( isPrincipalPasswordEnabled() );
         checkPrincipalPasswordAuthButton
             .setEnabled( ( isPrincipalPasswordEnabled() && isSaveBindPassword()
-                && !bindPrincipalCombo.getText().equals( "" ) && !bindPasswordText.getText().equals( "" ) ) || isGssapiEnabled() ); //$NON-NLS-1$ //$NON-NLS-2$
+                && !bindPrincipalCombo.getText().equals( StringUtils.EMPTY ) && !bindPasswordText.getText().equals( StringUtils.EMPTY ) ) || isGssapiEnabled() ); //$NON-NLS-1$ //$NON-NLS-2$
 
         // validate input fields
         message = null;
         infoMessage = null;
         errorMessage = null;
+        
         if ( isPrincipalPasswordEnabled() )
         {
-            if ( isSaveBindPassword() && "".equals( bindPasswordText.getText() ) ) //$NON-NLS-1$
+            if ( isSaveBindPassword() && Strings.isEmpty( bindPasswordText.getText() ) ) //$NON-NLS-1$
             {
                 message = Messages.getString( "AuthenticationParameterPage.PleaseEnterBindPassword" ); //$NON-NLS-1$
             }
-            if ( "".equals( bindPrincipalCombo.getText() ) && !isGssapiEnabled() ) //$NON-NLS-1$
+            
+            if ( Strings.isEmpty( bindPrincipalCombo.getText() ) && !isGssapiEnabled() ) //$NON-NLS-1$
             {
                 message = Messages.getString( "AuthenticationParameterPage.PleaseEnterBindDNOrUser" ); //$NON-NLS-1$
             }
         }
 
-        if ( isSaslRealmTextEnabled() )
+        if ( isSaslRealmTextEnabled() &&Strings.isEmpty( saslRealmText.getText() ) ) //$NON-NLS-1$
         {
-            if ( "".equals( saslRealmText.getText() ) ) //$NON-NLS-1$
-            {
-                infoMessage = Messages.getString( "AuthenticationParameterPage.PleaseEnterSaslRealm" ); //$NON-NLS-1$
-            }
+            infoMessage = Messages.getString( "AuthenticationParameterPage.PleaseEnterSaslRealm" ); //$NON-NLS-1$
         }
 
-        if ( isGssapiEnabled() && krb5ConfigFileButton.getSelection() )
+        if ( isGssapiEnabled() && krb5ConfigFileButton.getSelection() && Strings.isEmpty( krb5ConfigFileText.getText() ) ) //$NON-NLS-1$
         {
-            if ( "".equals( krb5ConfigFileText.getText() ) ) //$NON-NLS-1$
-            {
-                message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5ConfigFile" ); //$NON-NLS-1$
-            }
+            message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5ConfigFile" ); //$NON-NLS-1$
         }
 
         if ( isGssapiEnabled() && krb5ConfigManualButton.getSelection() )
         {
-            if ( "".equals( krb5ConfigManualPortText.getText() ) ) //$NON-NLS-1$
+            if ( Strings.isEmpty( krb5ConfigManualPortText.getText() ) ) //$NON-NLS-1$
             {
                 message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Port" ); //$NON-NLS-1$
             }
-            if ( "".equals( krb5ConfigManualHostText.getText() ) ) //$NON-NLS-1$
+            
+            if ( Strings.isEmpty( krb5ConfigManualHostText.getText() ) ) //$NON-NLS-1$
             {
                 message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Host" ); //$NON-NLS-1$
             }
-            if ( "".equals( krb5ConfigManualRealmText.getText() ) ) //$NON-NLS-1$
+            
+            if ( Strings.isEmpty( krb5ConfigManualRealmText.getText() ) ) //$NON-NLS-1$
             {
                 message = Messages.getString( "AuthenticationParameterPage.PleaseEnterKrb5Realm" ); //$NON-NLS-1$
             }
@@ -573,9 +620,11 @@ public class AuthenticationParameterPage
 
     private boolean isSaslEnabled()
     {
-        return ( getAuthenticationMethod() == AuthenticationMethod.SASL_DIGEST_MD5 )
-            || ( getAuthenticationMethod() == AuthenticationMethod.SASL_CRAM_MD5 )
-            || ( getAuthenticationMethod() == AuthenticationMethod.SASL_GSSAPI );
+        AuthenticationMethod authenticationMethod = getAuthenticationMethod();
+    
+        return ( authenticationMethod == AuthenticationMethod.SASL_DIGEST_MD5 )
+            || ( authenticationMethod == AuthenticationMethod.SASL_CRAM_MD5 )
+            || ( authenticationMethod == AuthenticationMethod.SASL_GSSAPI );
     }
 
 
@@ -586,18 +635,17 @@ public class AuthenticationParameterPage
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     * @see org.apache.directory.studio.connection.ui.AbstractConnectionParameterPage#
+     *          loadParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
      */
     protected void loadParameters( ConnectionParameter parameter )
     {
-        this.connectionParameter = parameter;
-
-        int index = parameter.getAuthMethod() == AuthenticationMethod.SIMPLE ? 1
-            : parameter.getAuthMethod() == AuthenticationMethod.SASL_DIGEST_MD5 ? 2
-                : parameter.getAuthMethod() == AuthenticationMethod.SASL_CRAM_MD5 ? 3
-                    : parameter.getAuthMethod() == AuthenticationMethod.SASL_GSSAPI ? 4 : 0;
+        connectionParameter = parameter;
+        AuthenticationMethod authenticationMethod = parameter.getAuthMethod();
+        
+        int index = authenticationMethod.getValue();
         authenticationMethodCombo.select( index );
-        bindPrincipalCombo.setText( parameter.getBindPrincipal() );
+        bindPrincipalCombo.setText( CommonUIUtils.getTextValue( parameter.getBindPrincipal() ) );
 
         String bindPassword = null;
 
@@ -619,16 +667,59 @@ public class AuthenticationParameterPage
             bindPassword = parameter.getBindPassword();
         }
 
-        bindPasswordText.setText( bindPassword != null ? bindPassword : "" ); //$NON-NLS-1$
+        bindPasswordText.setText( CommonUIUtils.getTextValue( bindPassword ) );
+        
+        // The Save Bind Password Button
         saveBindPasswordButton.setSelection( bindPassword != null );
 
-        saslRealmText.setText( parameter.getSaslRealm() != null ? parameter.getSaslRealm() : "" ); //$NON-NLS-1$
-        int qopIndex = parameter.getSaslQop() == SaslQoP.AUTH_INT ? 1
-            : parameter.getSaslQop() == SaslQoP.AUTH_CONF ? 2 : 0;
+        // The SASL realm
+        saslRealmText.setText( CommonUIUtils.getTextValue( parameter.getSaslRealm() ) );
+
+        // The SASL QOP combo
+        int qopIndex;
+        
+        SaslQoP saslQop = parameter.getSaslQop();
+        
+        switch ( saslQop )
+        {
+            case AUTH_INT :
+                qopIndex = 1;
+                break;
+                
+            case AUTH_CONF :
+                qopIndex = 2;
+                break;
+                
+            default :
+                qopIndex = 0;
+                break;
+        }
+
         saslQopCombo.select( qopIndex );
-        int securityStrengthIndex = parameter.getSaslSecurityStrength() == SaslSecurityStrength.MEDIUM ? 1 : parameter
-            .getSaslSecurityStrength() == SaslSecurityStrength.LOW ? 2 : 0;
+        
+        // The Security Strength
+        int securityStrengthIndex;
+        
+        SaslSecurityStrength securityStrength = parameter.getSaslSecurityStrength();
+        
+        switch ( securityStrength ) 
+        {
+            case MEDIUM :
+                securityStrengthIndex = 1;
+                break;
+                
+            case LOW :
+                securityStrengthIndex = 2;
+                break;
+                
+            default :
+                securityStrengthIndex = 0;
+                break;
+        }
+
         saslSecurityStrengthCombo.select( securityStrengthIndex );
+        
+        // The Mutual Authentication  Button
         saslMutualAuthenticationButton.setSelection( parameter.isSaslMutualAuthentication() );
 
         krb5CredentialConfigurationUseNativeButton
@@ -638,11 +729,10 @@ public class AuthenticationParameterPage
         krb5ConfigDefaultButton.setSelection( parameter.getKrb5Configuration() == Krb5Configuration.DEFAULT );
         krb5ConfigFileButton.setSelection( parameter.getKrb5Configuration() == Krb5Configuration.FILE );
         krb5ConfigManualButton.setSelection( parameter.getKrb5Configuration() == Krb5Configuration.MANUAL );
-        krb5ConfigFileText.setText( parameter.getKrb5ConfigurationFile() != null ? parameter.getKrb5ConfigurationFile()
-            : "" ); //$NON-NLS-1$
-        krb5ConfigManualRealmText.setText( parameter.getKrb5Realm() != null ? parameter.getKrb5Realm() : "" ); //$NON-NLS-1$
-        krb5ConfigManualHostText.setText( parameter.getKrb5KdcHost() != null ? parameter.getKrb5KdcHost() : "" ); //$NON-NLS-1$
-        krb5ConfigManualPortText.setText( parameter.getKrb5KdcPort() != 0 ? "" + parameter.getKrb5KdcPort() : "" ); //$NON-NLS-1$ //$NON-NLS-2$
+        krb5ConfigFileText.setText( CommonUIUtils.getTextValue( parameter.getKrb5ConfigurationFile() ) ); //$NON-NLS-1$
+        krb5ConfigManualRealmText.setText( CommonUIUtils.getTextValue( parameter.getKrb5Realm() ) ); //$NON-NLS-1$
+        krb5ConfigManualHostText.setText( CommonUIUtils.getTextValue( parameter.getKrb5KdcHost() ) ); //$NON-NLS-1$
+        krb5ConfigManualPortText.setText( CommonUIUtils.getTextValue( parameter.getKrb5KdcPort() ) ); //$NON-NLS-1$ //$NON-NLS-2$
     }
 
 
@@ -653,6 +743,9 @@ public class AuthenticationParameterPage
     {
         authenticationMethodCombo.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -661,6 +754,9 @@ public class AuthenticationParameterPage
 
         bindPrincipalCombo.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -669,6 +765,9 @@ public class AuthenticationParameterPage
 
         bindPasswordText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -677,24 +776,32 @@ public class AuthenticationParameterPage
 
         saveBindPasswordButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 if ( !saveBindPasswordButton.getSelection() )
                 {
                     // Reseting the previously saved password (if any)
-                    bindPasswordText.setText( "" ); //$NON-NLS-1$
+                    bindPasswordText.setText( StringUtils.EMPTY ); //$NON-NLS-1$
                 }
+                
                 connectionPageModified();
             }
         } );
 
         checkPrincipalPasswordAuthButton.addSelectionListener( new SelectionAdapter()
         {
-            public void widgetSelected( SelectionEvent e )
+            /**
+             * {@inheritDoc}
+             */
+            public void widgetSelected( SelectionEvent event )
             {
                 Connection connection = getTestConnection();
                 CheckBindRunnable runnable = new CheckBindRunnable( connection );
                 IStatus status = RunnableContextRunner.execute( runnable, runnableContext, true );
+                
                 if ( status.isOK() )
                 {
                     MessageDialog.openInformation( Display.getDefault().getActiveShell(), Messages
@@ -706,6 +813,9 @@ public class AuthenticationParameterPage
 
         saslRealmText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent even )
             {
                 connectionPageModified();
@@ -714,6 +824,9 @@ public class AuthenticationParameterPage
 
         saslQopCombo.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -730,6 +843,9 @@ public class AuthenticationParameterPage
 
         saslMutualAuthenticationButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -738,6 +854,9 @@ public class AuthenticationParameterPage
 
         krb5CredentialConfigurationUseNativeButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -754,6 +873,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigDefaultButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -762,6 +884,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigFileButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -770,6 +895,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigFileText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -778,6 +906,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigManualButton.addSelectionListener( new SelectionAdapter()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void widgetSelected( SelectionEvent event )
             {
                 connectionPageModified();
@@ -786,6 +917,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigManualRealmText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -794,6 +928,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigManualHostText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -802,6 +939,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigManualPortText.addVerifyListener( new VerifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void verifyText( VerifyEvent event )
             {
                 if ( !event.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
@@ -813,6 +953,9 @@ public class AuthenticationParameterPage
 
         krb5ConfigManualPortText.addModifyListener( new ModifyListener()
         {
+            /**
+             * {@inheritDoc}
+             */
             public void modifyText( ModifyEvent event )
             {
                 connectionPageModified();
@@ -822,7 +965,8 @@ public class AuthenticationParameterPage
 
 
     /**
-     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#saveParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
+     * @see org.apache.directory.studio.connection.ui.ConnectionParameterPage#
+     *          saveParameters(org.apache.directory.studio.connection.core.ConnectionParameter)
      */
     public void saveParameters( ConnectionParameter parameter )
     {
@@ -870,6 +1014,7 @@ public class AuthenticationParameterPage
 
         HistoryUtils.save( dialogSettings, ConnectionUIConstants.DIALOGSETTING_KEY_PRINCIPAL_HISTORY,
             bindPrincipalCombo.getText() );
+        
         if ( getAuthenticationMethod().equals( AuthenticationMethod.SASL_DIGEST_MD5 ) )
         {
             HistoryUtils.save( dialogSettings, ConnectionUIConstants.DIALOGSETTING_KEY_REALM_HISTORY,
@@ -927,25 +1072,31 @@ public class AuthenticationParameterPage
             case SASL_CRAM_MD5:
                 ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_CRAM_MD5 ) );
                 break;
+                
             case SASL_DIGEST_MD5:
                 ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_DIGEST_MD5 ) );
                 break;
+                
             case SASL_GSSAPI:
                 ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_GSSAPI ) );
                 break;
+                
             case SIMPLE:
                 if ( StringUtils.isEmpty( parameter.getBindPrincipal() ) )
                 {
                     // default if bind user is present
                     ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_SIMPLE ) );
                 }
+                
                 break;
+                
             case NONE:
                 if ( StringUtils.isNotEmpty( parameter.getBindPrincipal() ) )
                 {
                     // default if bind user is absent
                     ldapUrl.getExtensions().add( new Extension( false, X_AUTH_METHOD, X_AUTH_METHOD_ANONYMOUS ) );
                 }
+                
                 break;
         }
 
@@ -974,9 +1125,11 @@ public class AuthenticationParameterPage
                     case AUTH:
                         // default
                         break;
+                        
                     case AUTH_INT:
                         ldapUrl.getExtensions().add( new Extension( false, X_SASL_QOP, X_SASL_QOP_AUTH_INT ) );
                         break;
+                        
                     case AUTH_CONF:
                         ldapUrl.getExtensions().add( new Extension( false, X_SASL_QOP, X_SASL_QOP_AUTH_INT_PRIV ) );
                         break;
@@ -987,10 +1140,12 @@ public class AuthenticationParameterPage
                     case HIGH:
                         // default
                         break;
+                        
                     case MEDIUM:
                         ldapUrl.getExtensions().add(
                             new Extension( false, X_SASL_SEC_STRENGTH, X_SASL_SEC_STRENGTH_MEDIUM ) );
                         break;
+                        
                     case LOW:
                         ldapUrl.getExtensions().add(
                             new Extension( false, X_SASL_SEC_STRENGTH, X_SASL_SEC_STRENGTH_LOW ) );
@@ -1011,6 +1166,7 @@ public class AuthenticationParameterPage
                     case USE_NATIVE:
                         // default
                         break;
+                        
                     case OBTAIN_TGT:
                         ldapUrl.getExtensions().add(
                             new Extension( false, X_KRB5_CREDENTIALS_CONF, X_KRB5_CREDENTIALS_CONF_OBTAIN_TGT ) );
@@ -1022,11 +1178,13 @@ public class AuthenticationParameterPage
                     case DEFAULT:
                         // default
                         break;
+                        
                     case FILE:
                         ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_FILE ) );
                         ldapUrl.getExtensions().add(
                             new Extension( false, X_KRB5_CONFIG_FILE_FILE, parameter.getKrb5ConfigurationFile() ) );
                         break;
+                        
                     case MANUAL:
                         ldapUrl.getExtensions().add( new Extension( false, X_KRB5_CONFIG, X_KRB5_CONFIG_MANUAL ) );
                         ldapUrl.getExtensions().add(
@@ -1034,7 +1192,7 @@ public class AuthenticationParameterPage
                         ldapUrl.getExtensions().add(
                             new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_HOST, parameter.getKrb5KdcHost() ) );
                         ldapUrl.getExtensions().add(
-                            new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_PORT, "" + parameter.getKrb5KdcPort() ) ); //$NON-NLS-1$
+                            new Extension( false, X_KRB5_CONFIG_MANUAL_KDC_PORT, Integer.toString( parameter.getKrb5KdcPort() ) ) ); //$NON-NLS-1$
                         break;
                 }
         }
@@ -1048,10 +1206,12 @@ public class AuthenticationParameterPage
     {
         // bind user and password, none if empty or absent
         String principal = ldapUrl.getExtensionValue( X_BIND_USER );
+        
         if ( principal == null )
         {
             principal = StringUtils.EMPTY;
         }
+        
         parameter.setBindPrincipal( principal );
 
         String password = ldapUrl.getExtensionValue( X_BIND_PASSWORD );
@@ -1059,6 +1219,7 @@ public class AuthenticationParameterPage
 
         // auth method, simple if unknown or absent and X-BIND-USER is present, else anonymous 
         String authMethod = ldapUrl.getExtensionValue( X_AUTH_METHOD );
+        
         if ( StringUtils.isNotEmpty( authMethod ) && X_AUTH_METHOD_ANONYMOUS.equalsIgnoreCase( authMethod ) )
         {
             parameter.setAuthMethod( ConnectionParameter.AuthenticationMethod.NONE );
@@ -1086,6 +1247,7 @@ public class AuthenticationParameterPage
 
         // SASL realm, none if empty or absent 
         String saslRealm = ldapUrl.getExtensionValue( X_SASL_REALM );
+        
         if ( StringUtils.isNotEmpty( saslRealm ) )
         {
             parameter.setSaslRealm( saslRealm );
@@ -1093,6 +1255,7 @@ public class AuthenticationParameterPage
 
         // SASL QOP, default to AUTH
         String saslQop = ldapUrl.getExtensionValue( X_SASL_QOP );
+        
         if ( StringUtils.isNotEmpty( saslQop ) && X_SASL_QOP_AUTH_INT.equalsIgnoreCase( saslQop ) )
         {
             parameter.setSaslQop( SaslQoP.AUTH_INT );
@@ -1108,6 +1271,7 @@ public class AuthenticationParameterPage
 
         // SASL security strength, default to HIGH
         String saslSecStrength = ldapUrl.getExtensionValue( X_SASL_SEC_STRENGTH );
+        
         if ( StringUtils.isNotEmpty( saslSecStrength ) && X_SASL_SEC_STRENGTH_MEDIUM.equalsIgnoreCase( saslSecStrength ) )
         {
             parameter.setSaslSecurityStrength( SaslSecurityStrength.MEDIUM );
@@ -1128,6 +1292,7 @@ public class AuthenticationParameterPage
 
         // KRB5 credentials
         String krb5CredentialsConf = ldapUrl.getExtensionValue( X_KRB5_CREDENTIALS_CONF );
+       
         if ( StringUtils.isNotEmpty( krb5CredentialsConf )
             && X_KRB5_CREDENTIALS_CONF_OBTAIN_TGT.equalsIgnoreCase( krb5CredentialsConf ) )
         {
@@ -1140,6 +1305,7 @@ public class AuthenticationParameterPage
 
         // KRB5 configuration
         String krb5Config = ldapUrl.getExtensionValue( X_KRB5_CONFIG );
+        
         if ( StringUtils.isNotEmpty( krb5Config ) && X_KRB5_CONFIG_FILE.equalsIgnoreCase( krb5Config ) )
         {
             parameter.setKrb5Configuration( Krb5Configuration.FILE );
@@ -1158,9 +1324,10 @@ public class AuthenticationParameterPage
         parameter.setKrb5KdcHost( ldapUrl.getExtensionValue( X_KRB5_CONFIG_MANUAL_KDC_HOST ) );
 
         String kdcPort = ldapUrl.getExtensionValue( X_KRB5_CONFIG_MANUAL_KDC_PORT );
+        
         try
         {
-            parameter.setKrb5KdcPort( new Integer( kdcPort ).intValue() );
+            parameter.setKrb5KdcPort( Integer.valueOf( kdcPort ) );
         }
         catch ( NumberFormatException e )
         {

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/CertificateInfoComposite.java Thu Aug  6 10:03:42 2015
@@ -24,19 +24,18 @@ import java.io.IOException;
 import java.security.cert.CertificateEncodingException;
 import java.security.cert.X509Certificate;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import javax.naming.NamingException;
-import javax.naming.ldap.LdapName;
-import javax.naming.ldap.Rdn;
 import javax.security.auth.x500.X500Principal;
 
 import org.apache.commons.codec.binary.Hex;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateFormatUtils;
+import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
+import org.apache.directory.api.ldap.model.name.Dn;
+import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.studio.common.ui.widgets.BaseWidgetUtils;
 import org.bouncycastle.asn1.ASN1Object;
 import org.bouncycastle.x509.extension.X509ExtensionUtil;
@@ -72,10 +71,10 @@ import org.eclipse.swt.widgets.TreeItem;
  */
 public class CertificateInfoComposite extends Composite
 {
-
     /** The default attributes of an X500Principal: CN, L, ST, O, OU, C, STREET, DC, UID */
-    String[] ATTRIBUTES =
-        { "CN", //$NON-NLS-1$
+    private static final String[] ATTRIBUTES =
+        { 
+            "CN", //$NON-NLS-1$
             "L", //$NON-NLS-1$
             "ST", //$NON-NLS-1$
             "O", //$NON-NLS-1$
@@ -96,8 +95,6 @@ public class CertificateInfoComposite ex
     private TabFolder tabFolder;
 
     /** The general tab */
-    private TabItem generalTab;
-
     private Text issuedToCN;
     private Text issuedToO;
     private Text issuedToOU;
@@ -109,10 +106,6 @@ public class CertificateInfoComposite ex
     private Text expiresOn;
     private Text fingerprintSHA1;
     private Text fingerprintMD5;
-
-    /** The details tab */
-    private TabItem detailsTab;
-
     private TreeViewer hierarchyTreeViewer;
     private Tree certificateTree;
     private Text valueText;
@@ -224,7 +217,7 @@ public class CertificateInfoComposite ex
         fingerprintMD5 = BaseWidgetUtils.createLabeledText( fingerprintsComposite, StringUtils.EMPTY, 1 );
 
         // create tab
-        generalTab = new TabItem( tabFolder, SWT.NONE, GENERAL_TAB_INDEX );
+        TabItem generalTab = new TabItem( tabFolder, SWT.NONE, GENERAL_TAB_INDEX );
         generalTab.setText( Messages.getString( "CertificateInfoComposite.General" ) ); //$NON-NLS-1$
         generalTab.setControl( generalContainer );
     }
@@ -267,16 +260,17 @@ public class CertificateInfoComposite ex
         certificateTree.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
         certificateTree.addSelectionListener( new SelectionAdapter()
         {
-            public void widgetSelected( final SelectionEvent e )
+            public void widgetSelected( final SelectionEvent event )
             {
-                TreeItem item = ( TreeItem ) e.item;
-                if ( ( item != null ) && ( item.getData() != null ) )
+                TreeItem item = ( TreeItem ) event.item;
+                
+                if ( ( item == null ) || ( item.getData() == null ) )
                 {
-                    valueText.setText( item.getData().toString() );
+                    valueText.setText( StringUtils.EMPTY );
                 }
                 else
                 {
-                    valueText.setText( StringUtils.EMPTY );
+                    valueText.setText( item.getData().toString() );
                 }
             }
         } );
@@ -296,7 +290,7 @@ public class CertificateInfoComposite ex
         // create tab
         detailsForm.setWeights( new int[]
             { 1, 2, 1 } );
-        detailsTab = new TabItem( tabFolder, SWT.NONE, DETAILS_TAB_INDEX );
+        TabItem detailsTab = new TabItem( tabFolder, SWT.NONE, DETAILS_TAB_INDEX );
         detailsTab.setText( Messages.getString( "CertificateInfoComposite.Details" ) ); //$NON-NLS-1$
         detailsTab.setControl( detailsForm );
     }
@@ -328,6 +322,7 @@ public class CertificateInfoComposite ex
         expiresOn.setText( DateFormatUtils.ISO_DATE_FORMAT.format( certificate.getNotAfter() ) );
 
         byte[] encoded2 = null;
+        
         try
         {
             encoded2 = certificate.getEncoded();
@@ -335,6 +330,7 @@ public class CertificateInfoComposite ex
         catch ( CertificateEncodingException e )
         {
         }
+        
         byte[] md5 = DigestUtils.md5( encoded2 );
         String md5HexString = getHexString( md5 );
         fingerprintMD5.setText( md5HexString );
@@ -345,20 +341,25 @@ public class CertificateInfoComposite ex
         // Details: certificate chain
         CertificateChainItem parentItem = null;
         CertificateChainItem certificateItem = null;
+        
         for ( X509Certificate cert : certificateChain )
         {
             CertificateChainItem item = new CertificateChainItem( cert );
+            
             if ( parentItem != null )
             {
                 item.child = parentItem;
                 parentItem.parent = item;
             }
+            
             if ( certificateItem == null )
             {
                 certificateItem = item;
             }
+        
             parentItem = item;
         }
+        
         hierarchyTreeViewer.setInput( new CertificateChainItem[]
             { parentItem } );
         hierarchyTreeViewer.expandAll();
@@ -377,12 +378,13 @@ public class CertificateInfoComposite ex
         valueText.setText( StringUtils.EMPTY );
 
         IStructuredSelection selection = ( IStructuredSelection ) hierarchyTreeViewer.getSelection();
+        
         if ( selection.size() != 1 )
         {
             return;
         }
 
-        CertificateChainItem certificateItem = ( CertificateChainItem ) selection.getFirstElement();;
+        CertificateChainItem certificateItem = ( CertificateChainItem ) selection.getFirstElement();
         X509Certificate certificate = certificateItem.certificate;
 
         TreeItem rootItem = new TreeItem( certificateTree, SWT.NONE );
@@ -449,6 +451,7 @@ public class CertificateInfoComposite ex
         TreeItem item = new TreeItem( parent, SWT.NONE );
         item.setText( field );
         item.setData( value );
+        
         return item;
     }
 
@@ -465,6 +468,7 @@ public class CertificateInfoComposite ex
                 // try to parse the extension value byte[] to an ASN1 object
                 byte[] extensionValueBin = certificate.getExtensionValue( oid );
                 String extensionValue = null;
+                
                 try
                 {
                     ASN1Object extension = X509ExtensionUtil.fromExtensionValue( extensionValueBin );
@@ -494,16 +498,19 @@ public class CertificateInfoComposite ex
     private String getHexString( byte[] bytes )
     {
         char[] hex = Hex.encodeHex( bytes );
-        StringBuilder sb = new StringBuilder();
+        StringBuilder buffer = new StringBuilder();
+        
         for ( int i = 0; i < hex.length; i++ )
         {
             if ( i % 2 == 0 && i > 0 )
             {
-                sb.append( ':' );
+                buffer.append( ':' );
             }
-            sb.append( Character.toUpperCase( hex[i] ) );
+            
+            buffer.append( Character.toUpperCase( hex[i] ) );
         }
-        return sb.toString();
+        
+        return buffer.toString();
     }
 
 
@@ -523,42 +530,44 @@ public class CertificateInfoComposite ex
         for ( String attribute : ATTRIBUTES )
         {
             map.put( attribute, "-" ); //$NON-NLS-1$
-
         }
 
         // populate map with principal's name
         try
         {
             String name = principal.getName();
-            LdapName dn = new LdapName( name );
-            List<Rdn> rdns = dn.getRdns();
-            for ( Rdn rdn : rdns )
+            Dn dn = new Dn( name );
+            //List<Rdn> rdns = dn.getRdns();
+            
+            for ( Rdn rdn : dn )
             {
                 map.put( rdn.getType().toUpperCase(), rdn.getValue().toString() );
             }
         }
-        catch ( NamingException e )
+        catch ( LdapInvalidDnException lide )
         {
-            map.put( "CN", e.getMessage() ); //$NON-NLS-1$
+            map.put( "CN", lide.getMessage() ); //$NON-NLS-1$
         }
 
         return map;
     }
+    
 
     class HierarchyContentProvider implements ITreeContentProvider
     {
-
         public Object[] getChildren( Object parentElement )
         {
             if ( parentElement instanceof CertificateChainItem )
             {
                 CertificateChainItem item = ( CertificateChainItem ) parentElement;
+                
                 if ( item.child != null )
                 {
                     return new CertificateChainItem[]
                         { item.child };
                 }
             }
+            
             return new Object[0];
         }
 
@@ -568,8 +577,10 @@ public class CertificateInfoComposite ex
             if ( element instanceof CertificateChainItem )
             {
                 CertificateChainItem item = ( CertificateChainItem ) element;
+                
                 return item.parent;
             }
+            
             return null;
         }
 
@@ -586,6 +597,7 @@ public class CertificateInfoComposite ex
             {
                 return ( CertificateChainItem[] ) inputElement;
             }
+            
             return getChildren( inputElement );
         }
 
@@ -616,11 +628,11 @@ public class CertificateInfoComposite ex
         }
     }
 
-    class CertificateChainItem
+    private class CertificateChainItem
     {
-        X509Certificate certificate;
-        CertificateChainItem parent;
-        CertificateChainItem child;
+        private X509Certificate certificate;
+        private CertificateChainItem parent;
+        private CertificateChainItem child;
 
 
         public CertificateChainItem( X509Certificate certificate )

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionActionGroup.java Thu Aug  6 10:03:42 2015
@@ -71,31 +71,31 @@ public class ConnectionActionGroup imple
     private ExpandAllAction expandAllAction;
 
     /** The Constant newConnectionAction. */
-    protected static final String newConnectionAction = "newConnectionAction"; //$NON-NLS-1$
+    protected static final String NEW_CONNECTION_ACTION = "newConnectionAction"; //$NON-NLS-1$
 
     /** The Constant newConnectionFolderAction. */
-    protected static final String newConnectionFolderAction = "newConnectionFolderAction"; //$NON-NLS-1$
+    protected static final String NEW_CONNECTION_FOLDER_ACTION = "newConnectionFolderAction"; //$NON-NLS-1$
 
     /** The Constant openConnectionAction. */
-    protected static final String openConnectionAction = "openConnectionAction"; //$NON-NLS-1$
+    protected static final String OPEN_CONNECTION_ACTION = "openConnectionAction"; //$NON-NLS-1$
 
     /** The Constant closeConnectionAction. */
-    protected static final String closeConnectionAction = "closeConnectionAction"; //$NON-NLS-1$
+    protected static final String CLOSE_CONNECTION_ACTION = "closeConnectionAction"; //$NON-NLS-1$
 
     /** The Constant copyConnectionAction. */
-    protected static final String copyConnectionAction = "copyConnectionAction"; //$NON-NLS-1$
+    protected static final String COPY_CONNECTION_ACTION = "copyConnectionAction"; //$NON-NLS-1$
 
     /** The Constant pasteConnectionAction. */
-    protected static final String pasteConnectionAction = "pasteConnectionAction"; //$NON-NLS-1$
+    protected static final String PASTE_CONNECTION_ACTION = "pasteConnectionAction"; //$NON-NLS-1$
 
     /** The Constant deleteConnectionAction. */
-    protected static final String deleteConnectionAction = "deleteConnectionAction"; //$NON-NLS-1$
+    protected static final String DELETE_CONNECTION_ACTION = "deleteConnectionAction"; //$NON-NLS-1$
 
     /** The Constant renameConnectionAction. */
-    protected static final String renameConnectionAction = "renameConnectionAction"; //$NON-NLS-1$
+    protected static final String RENAME_CONNECTION_ACTION = "renameConnectionAction"; //$NON-NLS-1$
 
     /** The Constant propertyDialogAction. */
-    protected static final String propertyDialogAction = "propertyDialogAction"; //$NON-NLS-1$
+    protected static final String PROPERTY_DIALOG_ACTION = "propertyDialogAction"; //$NON-NLS-1$
 
     /** The drag connection listener. */
     private DragConnectionListener dragConnectionListener;
@@ -129,23 +129,23 @@ public class ConnectionActionGroup imple
 
         connectionActionMap = new HashMap<String, ConnectionViewActionProxy>();
 
-        connectionActionMap.put( newConnectionAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( NEW_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
             new NewConnectionAction() ) );
-        connectionActionMap.put( newConnectionFolderAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( NEW_CONNECTION_FOLDER_ACTION, new ConnectionViewActionProxy( viewer, this,
             new NewConnectionFolderAction() ) );
-        connectionActionMap.put( openConnectionAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( OPEN_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
             new OpenConnectionAction() ) );
-        connectionActionMap.put( closeConnectionAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( CLOSE_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
             new CloseConnectionAction() ) );
         connectionActionMap
-            .put( pasteConnectionAction, new ConnectionViewActionProxy( viewer, this, new PasteAction() ) );
-        connectionActionMap.put( copyConnectionAction, new ConnectionViewActionProxy( viewer, this, new CopyAction(
-            ( StudioActionProxy ) connectionActionMap.get( pasteConnectionAction ) ) ) );
-        connectionActionMap.put( deleteConnectionAction, new ConnectionViewActionProxy( viewer, this,
+            .put( PASTE_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this, new PasteAction() ) );
+        connectionActionMap.put( COPY_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this, new CopyAction(
+            ( StudioActionProxy ) connectionActionMap.get( PASTE_CONNECTION_ACTION ) ) ) );
+        connectionActionMap.put( DELETE_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
             new DeleteAction() ) );
-        connectionActionMap.put( renameConnectionAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( RENAME_CONNECTION_ACTION, new ConnectionViewActionProxy( viewer, this,
             new RenameAction() ) );
-        connectionActionMap.put( propertyDialogAction, new ConnectionViewActionProxy( viewer, this,
+        connectionActionMap.put( PROPERTY_DIALOG_ACTION, new ConnectionViewActionProxy( viewer, this,
             new PropertiesAction() ) );
 
         // DND support
@@ -212,10 +212,10 @@ public class ConnectionActionGroup imple
      */
     public void fillToolBar( IToolBarManager toolBarManager )
     {
-        toolBarManager.add( ( IAction ) this.connectionActionMap.get( newConnectionAction ) );
+        toolBarManager.add( ( IAction ) this.connectionActionMap.get( NEW_CONNECTION_ACTION ) );
         toolBarManager.add( new Separator() );
-        toolBarManager.add( ( IAction ) this.connectionActionMap.get( openConnectionAction ) );
-        toolBarManager.add( ( IAction ) this.connectionActionMap.get( closeConnectionAction ) );
+        toolBarManager.add( ( IAction ) this.connectionActionMap.get( OPEN_CONNECTION_ACTION ) );
+        toolBarManager.add( ( IAction ) this.connectionActionMap.get( CLOSE_CONNECTION_ACTION ) );
         toolBarManager.add( new Separator() );
         toolBarManager.add( expandAllAction );
         toolBarManager.add( collapseAllAction );
@@ -231,9 +231,6 @@ public class ConnectionActionGroup imple
      */
     public void fillMenu( IMenuManager menuManager )
     {
-        // menuManager.add(this.openSortDialogAction);
-        // menuManager.add(new Separator());
-        // menuManager.update(true);
     }
 
 
@@ -257,26 +254,26 @@ public class ConnectionActionGroup imple
     public void menuAboutToShow( IMenuManager menuManager )
     {
         // add
-        menuManager.add( ( IAction ) connectionActionMap.get( newConnectionAction ) );
-        menuManager.add( ( IAction ) connectionActionMap.get( newConnectionFolderAction ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( NEW_CONNECTION_ACTION ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( NEW_CONNECTION_FOLDER_ACTION ) );
         menuManager.add( new Separator() );
 
         // open/close
-        if ( ( ( IAction ) connectionActionMap.get( closeConnectionAction ) ).isEnabled() )
+        if ( ( ( IAction ) connectionActionMap.get( CLOSE_CONNECTION_ACTION ) ).isEnabled() )
         {
-            menuManager.add( ( IAction ) connectionActionMap.get( closeConnectionAction ) );
+            menuManager.add( ( IAction ) connectionActionMap.get( CLOSE_CONNECTION_ACTION ) );
         }
-        else if ( ( ( IAction ) connectionActionMap.get( openConnectionAction ) ).isEnabled() )
+        else if ( ( ( IAction ) connectionActionMap.get( OPEN_CONNECTION_ACTION ) ).isEnabled() )
         {
-            menuManager.add( ( IAction ) connectionActionMap.get( openConnectionAction ) );
+            menuManager.add( ( IAction ) connectionActionMap.get( OPEN_CONNECTION_ACTION ) );
         }
         menuManager.add( new Separator() );
 
         // copy/paste/...
-        menuManager.add( ( IAction ) connectionActionMap.get( copyConnectionAction ) );
-        menuManager.add( ( IAction ) connectionActionMap.get( pasteConnectionAction ) );
-        menuManager.add( ( IAction ) connectionActionMap.get( deleteConnectionAction ) );
-        menuManager.add( ( IAction ) connectionActionMap.get( renameConnectionAction ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( COPY_CONNECTION_ACTION ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( PASTE_CONNECTION_ACTION ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( DELETE_CONNECTION_ACTION ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( RENAME_CONNECTION_ACTION ) );
         menuManager.add( new Separator() );
 
         // additions
@@ -284,7 +281,7 @@ public class ConnectionActionGroup imple
         menuManager.add( new Separator() );
 
         // properties
-        menuManager.add( ( IAction ) connectionActionMap.get( propertyDialogAction ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( PROPERTY_DIALOG_ACTION ) );
     }
 
 
@@ -293,38 +290,38 @@ public class ConnectionActionGroup imple
      */
     public void activateGlobalActionHandlers()
     {
-        if ( actionBars != null )
+        if ( actionBars == null )
+        {
+            IAction copyConnectionAction = ( IAction ) connectionActionMap.get( COPY_CONNECTION_ACTION );
+            copyConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_COPY );
+            ActionUtils.activateActionHandler( copyConnectionAction );
+
+            IAction pasteConnectionAction = ( IAction ) connectionActionMap.get( PASTE_CONNECTION_ACTION );
+            pasteConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_PASTE );
+            ActionUtils.activateActionHandler( pasteConnectionAction );
+
+            IAction deleteConnectionAction = ( IAction ) connectionActionMap.get( DELETE_CONNECTION_ACTION );
+            deleteConnectionAction.setActionDefinitionId( ConnectionUIConstants.CMD_DELETE );
+            ActionUtils.activateActionHandler( deleteConnectionAction );
+
+            IAction propertyDialogAction = ( IAction ) connectionActionMap.get( PROPERTY_DIALOG_ACTION );
+            propertyDialogAction.setActionDefinitionId( ConnectionUIConstants.CMD_PROPERTIES );
+            ActionUtils.activateActionHandler( propertyDialogAction );
+        }
+        else
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) connectionActionMap
-                .get( copyConnectionAction ) );
+                .get( COPY_CONNECTION_ACTION ) );
             actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), ( IAction ) connectionActionMap
-                .get( pasteConnectionAction ) );
+                .get( PASTE_CONNECTION_ACTION ) );
             actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), ( IAction ) connectionActionMap
-                .get( deleteConnectionAction ) );
+                .get( DELETE_CONNECTION_ACTION ) );
             actionBars.setGlobalActionHandler( ActionFactory.RENAME.getId(), ( IAction ) connectionActionMap
-                .get( renameConnectionAction ) );
+                .get( RENAME_CONNECTION_ACTION ) );
             actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), ( IAction ) connectionActionMap
-                .get( propertyDialogAction ) );
+                .get( PROPERTY_DIALOG_ACTION ) );
             actionBars.updateActionBars();
         }
-        else
-        {
-            IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
-            ca.setActionDefinitionId( ConnectionUIConstants.CMD_COPY );
-            ActionUtils.activateActionHandler( ca );
-
-            IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
-            pa.setActionDefinitionId( ConnectionUIConstants.CMD_PASTE );
-            ActionUtils.activateActionHandler( pa );
-
-            IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
-            da.setActionDefinitionId( ConnectionUIConstants.CMD_DELETE );
-            ActionUtils.activateActionHandler( da );
-
-            IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
-            pda.setActionDefinitionId( ConnectionUIConstants.CMD_PROPERTIES );
-            ActionUtils.activateActionHandler( pda );
-        }
     }
 
 
@@ -333,7 +330,18 @@ public class ConnectionActionGroup imple
      */
     public void deactivateGlobalActionHandlers()
     {
-        if ( actionBars != null )
+        if ( actionBars == null )
+        {
+            IAction copyConnectionAction = ( IAction ) connectionActionMap.get( COPY_CONNECTION_ACTION );
+            ActionUtils.deactivateActionHandler( copyConnectionAction );
+            IAction pasteConnectionAction = ( IAction ) connectionActionMap.get( PASTE_CONNECTION_ACTION );
+            ActionUtils.deactivateActionHandler( pasteConnectionAction );
+            IAction deleteConnectionAction = ( IAction ) connectionActionMap.get( DELETE_CONNECTION_ACTION );
+            ActionUtils.deactivateActionHandler( deleteConnectionAction );
+            IAction propertyDialogAction = ( IAction ) connectionActionMap.get( PROPERTY_DIALOG_ACTION );
+            ActionUtils.deactivateActionHandler( propertyDialogAction );
+        }
+        else
         {
             actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null );
             actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), null );
@@ -342,17 +350,5 @@ public class ConnectionActionGroup imple
             actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), null );
             actionBars.updateActionBars();
         }
-        else
-        {
-            IAction ca = ( IAction ) connectionActionMap.get( copyConnectionAction );
-            ActionUtils.deactivateActionHandler( ca );
-            IAction pa = ( IAction ) connectionActionMap.get( pasteConnectionAction );
-            ActionUtils.deactivateActionHandler( pa );
-            IAction da = ( IAction ) connectionActionMap.get( deleteConnectionAction );
-            ActionUtils.deactivateActionHandler( da );
-            IAction pda = ( IAction ) connectionActionMap.get( propertyDialogAction );
-            ActionUtils.deactivateActionHandler( pda );
-        }
     }
-
 }

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java Thu Aug  6 10:03:42 2015
@@ -36,7 +36,6 @@ import org.eclipse.swt.widgets.Menu;
  */
 public class ConnectionConfiguration
 {
-
     /** The disposed flag */
     private boolean disposed = false;
 
@@ -54,21 +53,12 @@ public class ConnectionConfiguration
 
 
     /**
-     * Creates a new instance of ConnectionConfiguration.
-     */
-    public ConnectionConfiguration()
-    {
-    }
-
-
-    /**
      * Disposes this configuration.
      */
     public void dispose()
     {
         if ( !disposed )
         {
-
             if ( contentProvider != null )
             {
                 contentProvider.dispose();
@@ -101,13 +91,14 @@ public class ConnectionConfiguration
      */
     public IMenuManager getContextMenuManager( TreeViewer viewer )
     {
-        if ( this.contextMenuManager == null )
+        if ( contextMenuManager == null )
         {
-            this.contextMenuManager = new MenuManager();
-            Menu menu = this.contextMenuManager.createContextMenu( viewer.getControl() );
+            contextMenuManager = new MenuManager();
+            Menu menu = contextMenuManager.createContextMenu( viewer.getControl() );
             viewer.getControl().setMenu( menu );
         }
-        return this.contextMenuManager;
+        
+        return contextMenuManager;
     }
 
 
@@ -161,5 +152,4 @@ public class ConnectionConfiguration
 
         return sorter;
     }
-
 }

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionContentProvider.java Thu Aug  6 10:03:42 2015
@@ -41,9 +41,9 @@ import org.eclipse.jface.viewers.Viewer;
  */
 public class ConnectionContentProvider implements ITreeContentProvider
 {
-
     /**
-     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     * @see org.eclipse.jface.viewers.IContentProvider#
+     *      inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
      */
     public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
     {
@@ -68,6 +68,7 @@ public class ConnectionContentProvider i
             ConnectionFolderManager cfm = ( ConnectionFolderManager ) inputElement;
             ConnectionFolder rootConnectionFolder = cfm.getRootConnectionFolder();
             Object[] elements = getChildren( rootConnectionFolder );
+            
             return elements;
         }
         else
@@ -94,6 +95,7 @@ public class ConnectionContentProvider i
             {
                 ConnectionFolder subFolder = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
                     .getConnectionFolderById( subFolderId );
+                
                 if ( subFolder != null )
                 {
                     children.add( subFolder );
@@ -103,6 +105,7 @@ public class ConnectionContentProvider i
             {
                 Connection conn = ConnectionCorePlugin.getDefault().getConnectionManager().getConnectionById(
                     connectionId );
+                
                 if ( conn != null )
                 {
                     children.add( conn );
@@ -111,6 +114,7 @@ public class ConnectionContentProvider i
 
             return children.toArray();
         }
+        
         return null;
     }
 
@@ -143,6 +147,7 @@ public class ConnectionContentProvider i
     public boolean hasChildren( Object element )
     {
         Object[] children = getChildren( element );
+        
         return children != null && children.length > 0;
     }
 

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionLabelProvider.java Thu Aug  6 10:03:42 2015
@@ -21,6 +21,7 @@
 package org.apache.directory.studio.connection.ui.widgets;
 
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.ConnectionFolder;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
@@ -38,7 +39,6 @@ import org.eclipse.swt.graphics.Image;
  */
 public class ConnectionLabelProvider extends LabelProvider
 {
-
     /**
      * {@inheritDoc}
      * 
@@ -50,11 +50,14 @@ public class ConnectionLabelProvider ext
         if ( obj instanceof ConnectionFolder )
         {
             ConnectionFolder folder = ( ConnectionFolder ) obj;
+            
             return folder.getName();
         }
+        
         if ( obj instanceof Connection )
         {
             Connection conn = ( Connection ) obj;
+            
             if ( conn.getEncryptionMethod() == EncryptionMethod.LDAPS )
             {
                 return conn.getName() + " (LDAPS)"; //$NON-NLS-1$
@@ -68,13 +71,13 @@ public class ConnectionLabelProvider ext
                 return conn.getName();
             }
         }
-        else if ( obj != null )
+        else if ( obj == null )
         {
-            return obj.toString();
+            return StringUtils.EMPTY; //$NON-NLS-1$
         }
         else
         {
-            return ""; //$NON-NLS-1$
+            return obj.toString();
         }
     }
 
@@ -93,6 +96,7 @@ public class ConnectionLabelProvider ext
         else if ( obj instanceof Connection )
         {
             Connection conn = ( Connection ) obj;
+            
             if ( ( conn.getEncryptionMethod() == EncryptionMethod.LDAPS )
                 || ( conn.getEncryptionMethod() == EncryptionMethod.START_TLS ) )
             {
@@ -112,5 +116,4 @@ public class ConnectionLabelProvider ext
             return null;
         }
     }
-
 }
\ No newline at end of file

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java Thu Aug  6 10:03:42 2015
@@ -35,14 +35,6 @@ public class ConnectionSorter extends Vi
 {
 
     /**
-     * Creates a new instance of ConnectionSorter.
-     */
-    public ConnectionSorter()
-    {
-    }
-
-
-    /**
      * Connects the tree viewer to this sorter.
      *
      * @param viewer the tree viewer
@@ -58,6 +50,7 @@ public class ConnectionSorter extends Vi
      */
     public void dispose()
     {
+        // Nothing to do
     }
 
 
@@ -77,5 +70,4 @@ public class ConnectionSorter extends Vi
             return 2;
         }
     }
-
 }

Modified: directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java?rev=1694439&r1=1694438&r2=1694439&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java (original)
+++ directory/studio/trunk/plugins/connection.ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionUniversalListener.java Thu Aug  6 10:03:42 2015
@@ -41,18 +41,21 @@ import org.eclipse.jface.viewers.TreeVie
  */
 public class ConnectionUniversalListener implements ConnectionUpdateListener
 {
-
     /** The tree viewer */
     protected TreeViewer viewer;
 
     /** This listener expands/collapses a connection folder when double clicking */
     private IDoubleClickListener viewerDoubleClickListener = new IDoubleClickListener()
     {
+        /**
+         * {@InheritDoc}
+         */
         public void doubleClick( DoubleClickEvent event )
         {
             if ( event.getSelection() instanceof IStructuredSelection )
             {
                 Object obj = ( ( IStructuredSelection ) event.getSelection() ).getFirstElement();
+                
                 if ( obj instanceof ConnectionFolder )
                 {
                     if ( viewer.getExpandedState( obj ) )
@@ -97,7 +100,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionUpdated(org.apache.directory.studio.connection.core.Connection)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionUpdated(org.apache.directory.studio.connection.core.Connection)
      */
     public void connectionUpdated( Connection connection )
     {
@@ -109,11 +113,13 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionAdded(org.apache.directory.studio.connection.core.Connection)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionAdded(org.apache.directory.studio.connection.core.Connection)
      */
     public void connectionAdded( Connection connection )
     {
         connectionUpdated( connection );
+        
         if ( viewer != null )
         {
             viewer.setSelection( new StructuredSelection( connection ), true );
@@ -122,7 +128,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionRemoved(org.apache.directory.studio.connection.core.Connection)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionRemoved(org.apache.directory.studio.connection.core.Connection)
      */
     public void connectionRemoved( Connection connection )
     {
@@ -131,7 +138,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionOpened(org.apache.directory.studio.connection.core.Connection)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionOpened(org.apache.directory.studio.connection.core.Connection)
      */
     public void connectionOpened( Connection connection )
     {
@@ -140,7 +148,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionClosed(org.apache.directory.studio.connection.core.Connection)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionClosed(org.apache.directory.studio.connection.core.Connection)
      */
     public void connectionClosed( Connection connection )
     {
@@ -149,7 +158,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
      */
     public void connectionFolderModified( ConnectionFolder connectionFolder )
     {
@@ -158,7 +168,8 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderAdded(org.apache.directory.studio.connection.core.ConnectionFolder)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionFolderAdded(org.apache.directory.studio.connection.core.ConnectionFolder)
      */
     public void connectionFolderAdded( ConnectionFolder connectionFolder )
     {
@@ -171,11 +182,11 @@ public class ConnectionUniversalListener
 
 
     /**
-     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderRemoved(org.apache.directory.studio.connection.core.ConnectionFolder)
+     * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#
+     *          connectionFolderRemoved(org.apache.directory.studio.connection.core.ConnectionFolder)
      */
     public void connectionFolderRemoved( ConnectionFolder connectionFolder )
     {
         connectionUpdated( null );
     }
-
 }



Mime
View raw message