diff options
author | Oleg Besedin | 2008-04-25 19:52:33 +0000 |
---|---|---|
committer | Oleg Besedin | 2008-04-25 19:52:33 +0000 |
commit | c8726d76b065f408ad30f094324ed7791abec619 (patch) | |
tree | 6b2458056a84e8ce11b2bfdb82bd3662802cd3ce /bundles/org.eclipse.equinox.security.ui/src/org | |
parent | 93a454ad5e38c991b3c588f6183a3688f4f02861 (diff) | |
download | rt.equinox.bundles-c8726d76b065f408ad30f094324ed7791abec619.tar.gz rt.equinox.bundles-c8726d76b065f408ad30f094324ed7791abec619.tar.xz rt.equinox.bundles-c8726d76b065f408ad30f094324ed7791abec619.zip |
Bug 228943 Alter Logout button depending on the state
Diffstat (limited to 'bundles/org.eclipse.equinox.security.ui/src/org')
3 files changed, 34 insertions, 11 deletions
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/messages.properties b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/messages.properties index e92b63afb..f1fdb0aac 100644 --- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/messages.properties +++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/nls/messages.properties @@ -45,7 +45,7 @@ selectCipher = &Select encryption algorithm to use in new storages: changePasswordButton = &Change recoverPasswordButton = &Recover deleteButton = D&elete -logoutButton = &Logout +logoutButton = &Logout All providersTable = Providers: enabledColumn = Enabled priorityColumn = Priority diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java index a14b42a51..a13e33549 100644 --- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java +++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StoragePreferencePage.java @@ -13,6 +13,8 @@ package org.eclipse.equinox.internal.security.ui.storage; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.*; @@ -37,12 +39,25 @@ public class StoragePreferencePage extends PreferencePage implements IWorkbenchP Composite pageArea = new Composite(parent, SWT.NONE); pageArea.setLayout(new RowLayout()); - TabFolder folder = new TabFolder(parent, SWT.TOP); + final TabFolder folder = new TabFolder(parent, SWT.TOP); passwordTab = new TabPassword(folder, 0, getShell()); contentsTab = new TabContents(folder, 1, getShell(), convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH)); advancedTab = new TabAdvanced(folder, 2, getShell()); folder.setSelection(0); folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + folder.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + // nothing to do + } + + public void widgetSelected(SelectionEvent e) { + int i = folder.getSelectionIndex(); + if (i == 0 && passwordTab != null) // password page + passwordTab.onActivated(); + } + }); return folder; } diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java index 9b1c9f4b5..9aece4fa6 100644 --- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java +++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/TabPassword.java @@ -21,8 +21,7 @@ import org.eclipse.equinox.security.storage.SecurePreferencesFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.jface.layout.LayoutConstants; import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.*; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; @@ -36,6 +35,7 @@ public class TabPassword { protected Table providerTable; + protected Button buttonClearPassword; protected Button buttonChangePassword; protected Button buttonRecoverPassword; @@ -78,17 +78,14 @@ public class TabPassword { Composite rightPart = new Composite(page, SWT.NONE); rightPart.setLayout(new GridLayout()); - Button buttonClearPassword = new Button(rightPart, SWT.NONE); + buttonClearPassword = new Button(rightPart, SWT.NONE); buttonClearPassword.setText(SecUIMessages.logoutButton); buttonClearPassword.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - buttonClearPassword.addSelectionListener(new SelectionListener() { - - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } + buttonClearPassword.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { - InternalExchangeUtils.passwordProvidersLogout(); + InternalExchangeUtils.passwordProvidersReset(); + enableLogout(); } }); @@ -106,6 +103,7 @@ public class TabPassword { ISecurePreferences rootNode = SecurePreferencesFactory.getDefault(); ChangePasswordWizardDialog dialog = new ChangePasswordWizardDialog(shell, rootNode, moduleID); dialog.open(); + enableLogout(); } }); @@ -126,6 +124,7 @@ public class TabPassword { return; // no password recovery questions were setup PasswordRecoveryDialog dialog = new PasswordRecoveryDialog(questions, shell, moduleID); dialog.open(); + enableLogout(); } }); @@ -185,6 +184,7 @@ public class TabPassword { boolean recoveryAvailable = rootNode.nodeExists(path); buttonRecoverPassword.setEnabled(recoveryAvailable); } + enableLogout(); } protected HashSet getDisabledModules() { @@ -244,4 +244,12 @@ public class TabPassword { InternalExchangeUtils.passwordProvidersReset(); } + public void onActivated() { + enableLogout(); + } + + protected void enableLogout() { + buttonClearPassword.setEnabled(InternalExchangeUtils.isLoggedIn()); + } + } |