You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2013/04/17 17:13:46 UTC
svn commit: r1468962 -
/directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java
Author: pamarcelot
Date: Wed Apr 17 15:13:46 2013
New Revision: 1468962
URL: http://svn.apache.org/r1468962
Log:
Fix for DIRSTUDIO-903 (Clicking "Accept" when no changes have been made on the password edit dialog changes the password)
Modified:
directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java
Modified: directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java?rev=1468962&r1=1468961&r2=1468962&view=diff
==============================================================================
--- directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java (original)
+++ directory/studio/trunk/plugins/valueeditors/src/main/java/org/apache/directory/studio/valueeditors/password/PasswordDialog.java Wed Apr 17 15:13:46 2013
@@ -64,7 +64,6 @@ import org.eclipse.swt.widgets.Text;
*/
public class PasswordDialog extends Dialog
{
-
/** The supported hash methods */
private static final String[] HASH_METHODS =
{
@@ -81,69 +80,59 @@ public class PasswordDialog extends Dial
Password.HASH_METHOD_CRYPT,
Password.HASH_METHOD_NO };
+ /** Constant for the Current Password tab */
private static final int CURRENT_TAB = 0;
+ /** Constant for the New Password tab */
private static final int NEW_TAB = 1;
+ /** Constant for the selected tab dialog settings key */
private static final String SELECTED_TAB_DIALOGSETTINGS_KEY = PasswordDialog.class.getName() + ".tab"; //$NON-NLS-1$
+ /** Constant for the selected hash method dialog settings key */
private static final String SELECTED_HASH_METHOD_DIALOGSETTINGS_KEY = PasswordDialog.class.getName()
+ ".hashMethod"; //$NON-NLS-1$
- private TabFolder tabFolder;
-
- private TabItem currentTab;
-
- private TabItem newTab;
+ /** The display mode */
+ private DisplayMode displayMode;
+ /** The associated entry for binding */
private IEntry entry;
+ /** The current password */
private Password currentPassword;
- private Composite currentPasswordContainer;
+ /** The new password */
+ private Password newPassword;
- private Text currentPasswordText;
+ /** The return password */
+ private byte[] returnPassword;
+ // UI widgets
+ private Button okButton;
+ private TabFolder tabFolder;
+ private TabItem currentPasswordTab;
+ private Composite currentPasswordComposite;
+ private Text currentPasswordText;
private Text currentPasswordHashMethodText;
-
private Text currentPasswordValueHexText;
-
private Text currentPasswordSaltHexText;
-
private Button showCurrentPasswordDetailsButton;
-
private Text testPasswordText;
-
private Text testBindDnText;
-
private Button showTestPasswordDetailsButton;
-
private Button verifyPasswordButton;
-
private Button bindPasswordButton;
-
- private Password newPassword;
-
- private Composite newPasswordContainer;
-
+ private TabItem newPasswordTab;
+ private Composite newPasswordComposite;
private Text newPasswordText;
-
private Combo newPasswordHashMethodCombo;
-
private Text newPasswordPreviewText;
-
private Text newPasswordPreviewValueHexText;
-
private Text newPasswordPreviewSaltHexText;
-
private Button newSaltButton;
-
private Button showNewPasswordDetailsButton;
- private byte[] returnPassword;
-
- private Button okButton;
-
/**
* Creates a new instance of PasswordDialog.
@@ -164,6 +153,7 @@ public class PasswordDialog extends Dial
catch ( IllegalArgumentException e )
{
}
+
this.entry = entry;
this.returnPassword = null;
@@ -223,7 +213,7 @@ public class PasswordDialog extends Dial
*/
protected void createButtonsForButtonBar( Composite parent )
{
- okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false );
+ okButton = createButton( parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true );
createButton( parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false );
// load dialog settings
@@ -263,12 +253,14 @@ public class PasswordDialog extends Dial
*/
protected Control createDialogArea( Composite parent )
{
+ // Composite
Composite composite = ( Composite ) super.createDialogArea( parent );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 3 / 2;
gd.heightHint = convertVerticalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH ) * 2 / 3;
composite.setLayoutData( gd );
+ // Tab folder
tabFolder = new TabFolder( composite, SWT.TOP );
tabFolder.setLayoutData( new GridData( GridData.FILL_BOTH ) );
tabFolder.addSelectionListener( new SelectionAdapter()
@@ -279,36 +271,179 @@ public class PasswordDialog extends Dial
}
} );
- // current password
+ // Checking the current password
if ( currentPassword != null && currentPassword.toBytes().length > 0 )
{
- currentPasswordContainer = new Composite( tabFolder, SWT.NONE );
- GridLayout currentLayout = new GridLayout( 2, false );
- currentLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
- currentLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
- currentLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
- currentLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
- currentPasswordContainer.setLayout( currentLayout );
- currentPasswordContainer.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
-
- BaseWidgetUtils.createLabel( currentPasswordContainer, Messages
- .getString( "PasswordDialog.CurrentPassword" ) + ":", 1 ); //$NON-NLS-1$//$NON-NLS-2$
- currentPasswordText = BaseWidgetUtils.createReadonlyText( currentPasswordContainer, "", 1 ); //$NON-NLS-1$
-
- new Label( currentPasswordContainer, SWT.NONE );
- Composite currentPasswordDetailContainer = BaseWidgetUtils.createColumnContainer( currentPasswordContainer,
- 2, 1 );
- BaseWidgetUtils.createLabel( currentPasswordDetailContainer, Messages
- .getString( "PasswordDialog.HashMethod" ), 1 ); //$NON-NLS-1$
- currentPasswordHashMethodText = BaseWidgetUtils.createLabeledText( currentPasswordDetailContainer, "", 1 ); //$NON-NLS-1$
- BaseWidgetUtils.createLabel( currentPasswordDetailContainer, Messages
- .getString( "PasswordDialog.PasswordHex" ), 1 ); //$NON-NLS-1$
- currentPasswordValueHexText = BaseWidgetUtils.createLabeledText( currentPasswordDetailContainer, "", 1 ); //$NON-NLS-1$
- BaseWidgetUtils.createLabel( currentPasswordDetailContainer,
- Messages.getString( "PasswordDialog.SaltHex" ), 1 ); //$NON-NLS-1$
- currentPasswordSaltHexText = BaseWidgetUtils.createLabeledText( currentPasswordDetailContainer, "", 1 ); //$NON-NLS-1$
- showCurrentPasswordDetailsButton = BaseWidgetUtils.createCheckbox( currentPasswordDetailContainer, Messages
- .getString( "PasswordDialog.ShowCurrentPasswordDetails" ), 1 ); //$NON-NLS-1$
+ // Setting the display mode
+ displayMode = DisplayMode.CURRENT_AND_NEW_PASSWORD;
+
+ // Creating the current password tab
+ createCurrentPasswordTab();
+ }
+ else
+ {
+ // Setting the display mode
+ displayMode = DisplayMode.NEW_PASSWORD_ONLY;
+ }
+
+ // Creating the new password tab
+ createNewPasswordTab();
+
+ addListeners();
+
+ applyDialogFont( composite );
+ return composite;
+ }
+
+
+ /**
+ * Creates the current password tab.
+ */
+ private void createCurrentPasswordTab()
+ {
+ // Current password composite
+ currentPasswordComposite = new Composite( tabFolder, SWT.NONE );
+ GridLayout currentLayout = new GridLayout( 2, false );
+ currentLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
+ currentLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
+ currentLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
+ currentLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
+ currentPasswordComposite.setLayout( currentLayout );
+ currentPasswordComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+ // Current password text
+ BaseWidgetUtils.createLabel( currentPasswordComposite, Messages
+ .getString( "PasswordDialog.CurrentPassword" ) + ":", 1 ); //$NON-NLS-1$//$NON-NLS-2$
+ currentPasswordText = BaseWidgetUtils.createReadonlyText( currentPasswordComposite, "", 1 ); //$NON-NLS-1$
+
+ // Current password details composite
+ new Label( currentPasswordComposite, SWT.NONE );
+ Composite currentPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer( currentPasswordComposite,
+ 2, 1 );
+
+ // Current password hash method label
+ BaseWidgetUtils.createLabel( currentPasswordDetailsComposite,
+ Messages.getString( "PasswordDialog.HashMethod" ), 1 ); //$NON-NLS-1$
+ currentPasswordHashMethodText = BaseWidgetUtils.createLabeledText( currentPasswordDetailsComposite, "", 1 ); //$NON-NLS-1$
+
+ // Current password hex label
+ BaseWidgetUtils.createLabel( currentPasswordDetailsComposite, Messages
+ .getString( "PasswordDialog.PasswordHex" ), 1 ); //$NON-NLS-1$
+ currentPasswordValueHexText = BaseWidgetUtils.createLabeledText( currentPasswordDetailsComposite, "", 1 ); //$NON-NLS-1$
+
+ // Current password salt hex label
+ BaseWidgetUtils.createLabel( currentPasswordDetailsComposite,
+ Messages.getString( "PasswordDialog.SaltHex" ), 1 ); //$NON-NLS-1$
+ currentPasswordSaltHexText = BaseWidgetUtils.createLabeledText( currentPasswordDetailsComposite, "", 1 ); //$NON-NLS-1$
+
+ // Show current password details button
+ showCurrentPasswordDetailsButton = BaseWidgetUtils.createCheckbox( currentPasswordDetailsComposite, Messages
+ .getString( "PasswordDialog.ShowCurrentPasswordDetails" ), 1 ); //$NON-NLS-1$
+
+ // Verify password text
+ BaseWidgetUtils
+ .createLabel( currentPasswordComposite, Messages.getString( "PasswordDialog.VerifyPassword" ), 1 ); //$NON-NLS-1$
+ testPasswordText = BaseWidgetUtils.createText( currentPasswordComposite, "", 1 ); //$NON-NLS-1$
+
+ // Verify password details composite
+ new Label( currentPasswordComposite, SWT.NONE );
+ Composite testPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer( currentPasswordComposite, 2,
+ 1 );
+
+ // Bind DN label
+ BaseWidgetUtils.createLabel( testPasswordDetailsComposite, Messages.getString( "PasswordDialog.BindDn" ), 1 ); //$NON-NLS-1$
+ testBindDnText = BaseWidgetUtils.createLabeledText( testPasswordDetailsComposite, "", 1 ); //$NON-NLS-1$
+
+ // Show verify password details button
+ showTestPasswordDetailsButton = BaseWidgetUtils.createCheckbox( testPasswordDetailsComposite, Messages
+ .getString( "PasswordDialog.ShowTestPasswordDetails" ), 2 ); //$NON-NLS-1$
+
+ // Verify password buttons composite
+ new Label( currentPasswordComposite, SWT.NONE );
+ Composite verifyPasswordButtonsComposite = BaseWidgetUtils.createColumnContainer( currentPasswordComposite,
+ 2, 1 );
+
+ // Verify button
+ verifyPasswordButton = BaseWidgetUtils.createButton( verifyPasswordButtonsComposite, Messages
+ .getString( "PasswordDialog.Verify" ), 1 ); //$NON-NLS-1$
+ verifyPasswordButton.setEnabled( false );
+
+ // Bind button
+ bindPasswordButton = BaseWidgetUtils.createButton( verifyPasswordButtonsComposite, Messages
+ .getString( "PasswordDialog.Bind" ), 1 ); //$NON-NLS-1$
+ bindPasswordButton.setEnabled( false );
+
+ // Current password tab
+ currentPasswordTab = new TabItem( tabFolder, SWT.NONE );
+ currentPasswordTab.setText( Messages.getString( "PasswordDialog.CurrentPassword" ) ); //$NON-NLS-1$
+ currentPasswordTab.setControl( currentPasswordComposite );
+ }
+
+
+ /**
+ * Creates the new password tab.
+ */
+ private void createNewPasswordTab()
+ {
+ // New password composite
+ newPasswordComposite = new Composite( tabFolder, SWT.NONE );
+ GridLayout newLayout = new GridLayout( 2, false );
+ newLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
+ newLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
+ newLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
+ newLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
+ newPasswordComposite.setLayout( newLayout );
+
+ // New password text
+ BaseWidgetUtils.createLabel( newPasswordComposite, Messages.getString( "PasswordDialog.EnterNewPassword" ), 1 ); //$NON-NLS-1$
+ newPasswordText = BaseWidgetUtils.createText( newPasswordComposite, "", 1 ); //$NON-NLS-1$
+
+ // New password hashing method combo
+ BaseWidgetUtils.createLabel( newPasswordComposite, Messages.getString( "PasswordDialog.SelectHashMethod" ), 1 ); //$NON-NLS-1$
+ newPasswordHashMethodCombo = BaseWidgetUtils.createReadonlyCombo( newPasswordComposite, HASH_METHODS, 0, 1 );
+
+ // New password preview text
+ BaseWidgetUtils.createLabel( newPasswordComposite, Messages.getString( "PasswordDialog.PasswordPreview" ), 1 ); //$NON-NLS-1$
+ newPasswordPreviewText = BaseWidgetUtils.createReadonlyText( newPasswordComposite, "", 1 ); //$NON-NLS-1$
+
+ // New salt button
+ newSaltButton = BaseWidgetUtils.createButton( newPasswordComposite, Messages
+ .getString( "PasswordDialog.NewSalt" ), 1 ); //$NON-NLS-1$
+ newSaltButton.setLayoutData( new GridData() );
+ newSaltButton.setEnabled( false );
+
+ // New password preview details composite
+ Composite newPasswordPreviewDetailsComposite = BaseWidgetUtils.createColumnContainer( newPasswordComposite, 2,
+ 1 );
+
+ // New password preview hex label
+ BaseWidgetUtils.createLabel( newPasswordPreviewDetailsComposite,
+ Messages.getString( "PasswordDialog.PasswordHex" ), 1 ); //$NON-NLS-1$
+ newPasswordPreviewValueHexText = BaseWidgetUtils.createLabeledText( newPasswordPreviewDetailsComposite, ":", 1 ); //$NON-NLS-1$
+
+ // New password preview salt hex label
+ BaseWidgetUtils.createLabel( newPasswordPreviewDetailsComposite,
+ Messages.getString( "PasswordDialog.SaltHex" ), 1 ); //$NON-NLS-1$
+ newPasswordPreviewSaltHexText = BaseWidgetUtils.createLabeledText( newPasswordPreviewDetailsComposite, "", 1 ); //$NON-NLS-1$
+
+ // Show new password details button
+ showNewPasswordDetailsButton = BaseWidgetUtils.createCheckbox( newPasswordPreviewDetailsComposite, Messages
+ .getString( "PasswordDialog.ShowNewPasswordDetails" ), 1 ); //$NON-NLS-1$
+
+ // New password tab
+ newPasswordTab = new TabItem( tabFolder, SWT.NONE );
+ newPasswordTab.setText( Messages.getString( "PasswordDialog.NewPassword" ) ); //$NON-NLS-1$
+ newPasswordTab.setControl( newPasswordComposite );
+ }
+
+
+ /**
+ * Adds the listeners.
+ */
+ private void addListeners()
+ {
+ if ( displayMode == DisplayMode.CURRENT_AND_NEW_PASSWORD )
+ {
showCurrentPasswordDetailsButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent arg0 )
@@ -316,10 +451,7 @@ public class PasswordDialog extends Dial
updateCurrentPasswordGroup();
}
} );
-
- BaseWidgetUtils.createLabel( currentPasswordContainer,
- Messages.getString( "PasswordDialog.VerifyPassword" ), 1 ); //$NON-NLS-1$
- testPasswordText = BaseWidgetUtils.createText( currentPasswordContainer, "", 1 ); //$NON-NLS-1$
+
testPasswordText.addModifyListener( new ModifyListener()
{
public void modifyText( ModifyEvent e )
@@ -327,13 +459,7 @@ public class PasswordDialog extends Dial
updateCurrentPasswordGroup();
}
} );
- new Label( currentPasswordContainer, SWT.NONE );
- Composite testPasswordDetailContainer = BaseWidgetUtils.createColumnContainer( currentPasswordContainer, 2,
- 1 );
- BaseWidgetUtils.createLabel( testPasswordDetailContainer, Messages.getString( "PasswordDialog.BindDn" ), 1 ); //$NON-NLS-1$
- testBindDnText = BaseWidgetUtils.createLabeledText( testPasswordDetailContainer, "", 1 ); //$NON-NLS-1$
- showTestPasswordDetailsButton = BaseWidgetUtils.createCheckbox( testPasswordDetailContainer, Messages
- .getString( "PasswordDialog.ShowTestPasswordDetails" ), 2 ); //$NON-NLS-1$
+
showTestPasswordDetailsButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent arg0 )
@@ -342,12 +468,6 @@ public class PasswordDialog extends Dial
}
} );
- new Label( currentPasswordContainer, SWT.NONE );
- Composite verifyPasswordButtonContainer = BaseWidgetUtils.createColumnContainer( currentPasswordContainer,
- 2, 1 );
- verifyPasswordButton = BaseWidgetUtils.createButton( verifyPasswordButtonContainer, Messages
- .getString( "PasswordDialog.Verify" ), 1 ); //$NON-NLS-1$
- verifyPasswordButton.setEnabled( false );
verifyPasswordButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
@@ -355,9 +475,7 @@ public class PasswordDialog extends Dial
verifyCurrentPassword();
}
} );
- bindPasswordButton = BaseWidgetUtils.createButton( verifyPasswordButtonContainer, Messages
- .getString( "PasswordDialog.Bind" ), 1 ); //$NON-NLS-1$
- bindPasswordButton.setEnabled( false );
+
bindPasswordButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
@@ -365,23 +483,8 @@ public class PasswordDialog extends Dial
bindCurrentPassword();
}
} );
-
- currentTab = new TabItem( tabFolder, SWT.NONE );
- currentTab.setText( Messages.getString( "PasswordDialog.CurrentPassword" ) ); //$NON-NLS-1$
- currentTab.setControl( currentPasswordContainer );
}
- // new password
- newPasswordContainer = new Composite( tabFolder, SWT.NONE );
- GridLayout newLayout = new GridLayout( 2, false );
- newLayout.marginHeight = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_MARGIN );
- newLayout.marginWidth = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_MARGIN );
- newLayout.verticalSpacing = convertVerticalDLUsToPixels( IDialogConstants.VERTICAL_SPACING );
- newLayout.horizontalSpacing = convertHorizontalDLUsToPixels( IDialogConstants.HORIZONTAL_SPACING );
- newPasswordContainer.setLayout( newLayout );
-
- BaseWidgetUtils.createLabel( newPasswordContainer, Messages.getString( "PasswordDialog.EnterNewPassword" ), 1 ); //$NON-NLS-1$
- newPasswordText = BaseWidgetUtils.createText( newPasswordContainer, "", 1 ); //$NON-NLS-1$
newPasswordText.addModifyListener( new ModifyListener()
{
public void modifyText( ModifyEvent e )
@@ -390,8 +493,6 @@ public class PasswordDialog extends Dial
}
} );
- BaseWidgetUtils.createLabel( newPasswordContainer, Messages.getString( "PasswordDialog.SelectHashMethod" ), 1 ); //$NON-NLS-1$
- newPasswordHashMethodCombo = BaseWidgetUtils.createReadonlyCombo( newPasswordContainer, HASH_METHODS, 0, 1 );
newPasswordHashMethodCombo.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
@@ -400,13 +501,6 @@ public class PasswordDialog extends Dial
}
} );
- BaseWidgetUtils.createLabel( newPasswordContainer, Messages.getString( "PasswordDialog.PasswordPreview" ), 1 ); //$NON-NLS-1$
- newPasswordPreviewText = BaseWidgetUtils.createReadonlyText( newPasswordContainer, "", 1 ); //$NON-NLS-1$
-
- newSaltButton = BaseWidgetUtils.createButton( newPasswordContainer, Messages
- .getString( "PasswordDialog.NewSalt" ), 1 ); //$NON-NLS-1$
- newSaltButton.setLayoutData( new GridData() );
- newSaltButton.setEnabled( false );
newSaltButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
@@ -414,16 +508,7 @@ public class PasswordDialog extends Dial
updateNewPasswordGroup();
}
} );
- Composite newPasswordPreviewDetailContainer = BaseWidgetUtils
- .createColumnContainer( newPasswordContainer, 2, 1 );
- BaseWidgetUtils.createLabel( newPasswordPreviewDetailContainer, Messages
- .getString( "PasswordDialog.PasswordHex" ), 1 ); //$NON-NLS-1$
- newPasswordPreviewValueHexText = BaseWidgetUtils.createLabeledText( newPasswordPreviewDetailContainer, ":", 1 ); //$NON-NLS-1$
- BaseWidgetUtils.createLabel( newPasswordPreviewDetailContainer,
- Messages.getString( "PasswordDialog.SaltHex" ), 1 ); //$NON-NLS-1$
- newPasswordPreviewSaltHexText = BaseWidgetUtils.createLabeledText( newPasswordPreviewDetailContainer, "", 1 ); //$NON-NLS-1$
- showNewPasswordDetailsButton = BaseWidgetUtils.createCheckbox( newPasswordPreviewDetailContainer, Messages
- .getString( "PasswordDialog.ShowNewPasswordDetails" ), 1 ); //$NON-NLS-1$
+
showNewPasswordDetailsButton.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent arg0 )
@@ -431,13 +516,6 @@ public class PasswordDialog extends Dial
updateNewPasswordGroup();
}
} );
-
- newTab = new TabItem( tabFolder, SWT.NONE );
- newTab.setText( Messages.getString( "PasswordDialog.NewPassword" ) ); //$NON-NLS-1$
- newTab.setControl( newPasswordContainer );
-
- applyDialogFont( composite );
- return composite;
}
@@ -496,6 +574,8 @@ public class PasswordDialog extends Dial
{
getShell().setDefaultButton( okButton );
}
+
+ okButton.setEnabled( false );
}
@@ -612,14 +692,14 @@ public class PasswordDialog extends Dial
{
if ( tabFolder.getSelectionIndex() == CURRENT_TAB )
{
+ updateCurrentPasswordGroup();
testPasswordText.setFocus();
}
else if ( tabFolder.getSelectionIndex() == NEW_TAB )
{
+ updateNewPasswordGroup();
newPasswordText.setFocus();
}
- updateCurrentPasswordGroup();
- updateNewPasswordGroup();
}
}
@@ -635,4 +715,14 @@ public class PasswordDialog extends Dial
return returnPassword;
}
+ /**
+ * This enum contains the display modes for the dialog.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+ private enum DisplayMode
+ {
+ CURRENT_AND_NEW_PASSWORD,
+ NEW_PASSWORD_ONLY
+ }
}