directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1059057 - in /directory/studio/trunk/plugins/apacheds.configuration.v2/src/main/java/org/apache/directory/studio/apacheds/configuration/v2/editor: KerberosServerPage.java LdapLdapsServersPage.java ServerConfigurationEditorPage.java
Date Fri, 14 Jan 2011 16:16:26 GMT
Author: pamarcelot
Date: Fri Jan 14 16:16:26 2011
New Revision: 1059057

URL: http://svn.apache.org/viewvc?rev=1059057&view=rev
Log:
Added utility methods to avoid issues with widgets not been yet created or being already disposed.

Modified:
    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/ServerConfigurationEditorPage.java

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=1059057&r1=1059056&r2=1059057&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
Fri Jan 14 16:16:26 2011
@@ -376,24 +376,24 @@ public class KerberosServerPage extends 
         KdcServerBean kdcServerBean = getKdcServerBean();
         ChangePasswordServerBean changePasswordServerBean = getChangePasswordServerBean();
 
-        enableKerberosCheckbox.setSelection( kdcServerBean.isEnabled() );
-        kerberosPortText.setText( "" + getKdcServerTransportBean().getSystemPort() );
+        setSelection( enableKerberosCheckbox, kdcServerBean.isEnabled() );
+        setText(kerberosPortText,"" + getKdcServerTransportBean().getSystemPort() );
 
-        enableChangePasswordCheckbox.setSelection( changePasswordServerBean.isEnabled() );
-        changePasswordPortText.setText( "" + getChangePasswordServerTransportBean().getSystemPort()
);
+        setSelection(enableChangePasswordCheckbox, changePasswordServerBean.isEnabled() );
+        setText(changePasswordPortText, "" + getChangePasswordServerTransportBean().getSystemPort()
);
 
-        kdcPrincipalText.setText( kdcServerBean.getKrbKdcPrincipal().toString() );
-        kdcSearchBaseDnText.setText( kdcServerBean.getSearchBaseDn().toString() );
-        encryptionTypesText.setText( kdcServerBean.getKrbEncryptionTypes().toString() );
-
-        verifyBodyChecksumCheckbox.setSelection( kdcServerBean.isKrbBodyChecksumVerified()
);
-        allowEmptyAddressesCheckbox.setSelection( kdcServerBean.isKrbEmptyAddressesAllowed()
);
-        allowForwardableAddressesCheckbox.setSelection( kdcServerBean.isKrbForwardableAllowed()
);
-        requirePreAuthByEncryptedTimestampCheckbox.setSelection( kdcServerBean.isKrbPaEncTimestampRequired()
);
-        allowPostdatedTicketsCheckbox.setSelection( kdcServerBean.isKrbPostdatedAllowed()
);
-        allowRenewableTicketsCheckbox.setSelection( kdcServerBean.isKrbRenewableAllowed()
);
-        maximumRenewableLifetimeText.setText( kdcServerBean.getKrbMaximumRenewableLifetime()
+ "" );
-        maximumTicketLifetimeText.setText( kdcServerBean.getKrbMaximumTicketLifetime() +
"" );
+        setText(kdcPrincipalText, kdcServerBean.getKrbKdcPrincipal().toString() );
+        setText(kdcSearchBaseDnText, kdcServerBean.getSearchBaseDn().toString() );
+        setText(encryptionTypesText, kdcServerBean.getKrbEncryptionTypes().toString() );
+
+        setSelection(verifyBodyChecksumCheckbox, kdcServerBean.isKrbBodyChecksumVerified()
);
+        setSelection( allowEmptyAddressesCheckbox, kdcServerBean.isKrbEmptyAddressesAllowed()
);
+        setSelection(allowForwardableAddressesCheckbox, kdcServerBean.isKrbForwardableAllowed()
);
+        setSelection(requirePreAuthByEncryptedTimestampCheckbox, kdcServerBean.isKrbPaEncTimestampRequired()
);
+        setSelection( allowPostdatedTicketsCheckbox, kdcServerBean.isKrbPostdatedAllowed()
);
+        setSelection(allowRenewableTicketsCheckbox, kdcServerBean.isKrbRenewableAllowed()
);
+        setText(maximumRenewableLifetimeText, kdcServerBean.getKrbMaximumRenewableLifetime()
+ "" );
+        setText(maximumTicketLifetimeText, kdcServerBean.getKrbMaximumTicketLifetime() +
"" );
 
         addListeners();
     }

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=1059057&r1=1059056&r2=1059057&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
Fri Jan 14 16:16:26 2011
@@ -380,15 +380,15 @@ public class LdapLdapsServersPage extend
 
         LdapServerBean ldapServerBean = getLdapServerBean();
 
-        enableLdapCheckbox.setSelection( ldapServerBean.isEnabled() );
-        ldapPortText.setText( getLdapServerTransportBean().getSystemPort() + "" );
+        setSelection( enableLdapCheckbox, ldapServerBean.isEnabled() );
+        setText( ldapPortText, getLdapServerTransportBean().getSystemPort() + "" );
 
-        enableLdapsCheckbox.setSelection( true );
-        ldapsPortText.setText( getLdapsServerTransportBean().getSystemPort() + "" );
+        setSelection( enableLdapsCheckbox, true );
+        setText( ldapsPortText, getLdapsServerTransportBean().getSystemPort() + "" );
 
-        saslHostText.setText( ldapServerBean.getLdapServerSaslHost() );
-        saslPrincipalText.setText( ldapServerBean.getLdapServerSaslPrincipal() );
-        saslSearchBaseDnText.setText( ldapServerBean.getSearchBaseDn().toString() );
+        setText( saslHostText, ldapServerBean.getLdapServerSaslHost() );
+        setText( saslPrincipalText, ldapServerBean.getLdapServerSaslPrincipal() );
+        setText( saslSearchBaseDnText, ldapServerBean.getSearchBaseDn().toString() );
 
         addListeners();
     }

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=1059057&r1=1059056&r2=1059057&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
Fri Jan 14 16:16:26 2011
@@ -387,4 +387,44 @@ public abstract class ServerConfiguratio
     {
         removeSelectionListener( button, dirtySelectionListener );
     }
+
+
+    /**
+     * Sets the selection state of the button widget.
+     * <p>
+     * Verifies that the button exists and is not disposed 
+     * before applying the new selection state.
+     *
+     * @param button
+     *      the button
+     * @param selected
+     *      the new selection state
+     */
+    public void setSelection( Button button, boolean selected )
+    {
+        if ( ( button != null ) && ( !button.isDisposed() ) )
+        {
+            button.setSelection( selected );
+        }
+    }
+
+
+    /**
+     * Sets the contents of the text widget.
+     * <p>
+     * Verifies that the button exists and is not disposed 
+     * before applying the new text.
+     *
+     * @param text
+     *      the text
+     * @param string
+     *       the new text
+     */
+    public void setText( Text text, String string )
+    {
+        if ( ( text != null ) && ( !text.isDisposed() ) )
+        {
+            text.setText( string );
+        }
+    }
 }



Mime
View raw message