diff options
author | Jean Michel-Lemieux | 2004-04-14 15:55:57 +0000 |
---|---|---|
committer | Jean Michel-Lemieux | 2004-04-14 15:55:57 +0000 |
commit | ef57ecff243f5ac8bc54fedac35185e003940605 (patch) | |
tree | 52eabaf03c516386335de343f0067a574b02118c | |
parent | d0c4f12187d7411f2eed96d019acdbf266a974d3 (diff) | |
download | eclipse.platform.team-branch_20040413_CVSPasswordCaching.tar.gz eclipse.platform.team-branch_20040413_CVSPasswordCaching.tar.xz eclipse.platform.team-branch_20040413_CVSPasswordCaching.zip |
*** empty log message ***branch_20040413_CVSPasswordCaching
5 files changed, 136 insertions, 64 deletions
diff --git a/bundles/org.eclipse.team.cvs.ssh2/passwords.txt b/bundles/org.eclipse.team.cvs.ssh2/passwords.txt deleted file mode 100644 index 5685e8580..000000000 --- a/bundles/org.eclipse.team.cvs.ssh2/passwords.txt +++ /dev/null @@ -1,6 +0,0 @@ -- ask user to persist passwords and warn that this is not secure -- what happens when a password changes on the remote server, how is the persisted password cleared? -- manage passwords that are saved, and allow clearing -- how does this affect project set import -- retry count added to prompt dialog -- where are repos persisted, and how does this affect the caching of the passwords
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java index 0b016c07b..bfc21dd95 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/PasswordManagementPreferencePage.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.team.internal.ccvs.ui; -import java.util.ArrayList; +import java.util.*; import java.util.List; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; @@ -49,9 +49,8 @@ public class PasswordManagementPreferencePage extends PreferencePage implements } }; - public void init(IWorkbench workbench) { - setDescription("Password Management"); //$NON-NLS-1$ + setDescription(Policy.bind("PasswordManagementPreferencePage.2")); //$NON-NLS-1$ } /** @@ -71,12 +70,6 @@ public class PasswordManagementPreferencePage extends PreferencePage implements data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; parent.setLayoutData(data); - - Label l1 = new Label(parent, SWT.NULL); - l1.setText("The following CVS repository locations have saved passwords:"); - data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - data.horizontalSpan = 2; - l1.setLayoutData(data); viewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); Table table = viewer.getTable(); @@ -95,15 +88,15 @@ public class PasswordManagementPreferencePage extends PreferencePage implements table.setLayoutData(gd); table.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { - //handleSelection(); + handleSelection(); } }); // Create the table columns new TableColumn(table, SWT.NULL); new TableColumn(table, SWT.NULL); TableColumn[] columns = table.getColumns(); - columns[0].setText("Location"); //$NON-NLS-1$ - columns[1].setText("Username"); //$NON-NLS-1$ + columns[0].setText(Policy.bind("PasswordManagementPreferencePage.3")); //$NON-NLS-1$ + columns[1].setText(Policy.bind("PasswordManagementPreferencePage.4")); //$NON-NLS-1$ viewer.setColumnProperties(new String[] {"location", "username"}); //$NON-NLS-1$ //$NON-NLS-2$ viewer.setLabelProvider(new TableLabelProvider()); @@ -137,7 +130,7 @@ public class PasswordManagementPreferencePage extends PreferencePage implements buttons.setLayout(layout); removeButton = new Button(buttons, SWT.PUSH); - removeButton.setText("Remove"); + removeButton.setText(Policy.bind("PasswordManagementPreferencePage.5")); //$NON-NLS-1$ data = new GridData(); data.horizontalAlignment = GridData.FILL; data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); @@ -147,11 +140,11 @@ public class PasswordManagementPreferencePage extends PreferencePage implements removeButton.setEnabled(false); removeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { - removeIgnore(); + remove(); } }); removeAllButton = new Button(buttons, SWT.PUSH); - removeAllButton.setText("Remove All"); + removeAllButton.setText(Policy.bind("PasswordManagementPreferencePage.6")); //$NON-NLS-1$ data = new GridData(); data.horizontalAlignment = GridData.FILL; data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); @@ -161,18 +154,15 @@ public class PasswordManagementPreferencePage extends PreferencePage implements removeAllButton.setEnabled(true); removeAllButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { - removeAllIgnore(); + removeAll(); } }); Dialog.applyDialogFont(ancestor); viewer.setInput(KnownRepositories.getInstance()); + handleSelection(); return parent; } - /** - * Do anything necessary because the OK button has been pressed. - * - * @return whether it is okay to close the preference page - */ + public boolean performOk() { return true; } @@ -181,9 +171,17 @@ public class PasswordManagementPreferencePage extends PreferencePage implements super.performDefaults(); } - private void removeIgnore() { + private void remove() { + IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); + for (Iterator it = s.iterator(); it.hasNext();) { + ICVSRepositoryLocation location = (ICVSRepositoryLocation) it.next(); + location.flushUserInfo(); + } + viewer.refresh(); + handleSelection(); } - private void removeAllIgnore() { + + private void removeAll() { ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories(); List repos = new ArrayList(); for (int i = 0; i < locations.length; i++) { @@ -191,13 +189,16 @@ public class PasswordManagementPreferencePage extends PreferencePage implements if(l.getUserInfoCached()) l.flushUserInfo(); } - viewer.setInput(KnownRepositories.getInstance()); + viewer.refresh(); + handleSelection(); } + private void handleSelection() { if (viewer.getTable().getSelectionCount() > 0) { removeButton.setEnabled(true); } else { removeButton.setEnabled(false); } + removeAllButton.setEnabled(viewer.getTable().getItemCount() > 0); } } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java index cd871965f..b877f4bb3 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/UserValidationDialog.java @@ -13,17 +13,13 @@ package org.eclipse.team.internal.ccvs.ui; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; import org.eclipse.ui.help.WorkbenchHelp; /** @@ -86,45 +82,67 @@ public class UserValidationDialog extends Dialog { passwordField.setFocus(); } } + /** * @see Dialog#createDialogArea */ protected Control createDialogArea(Composite parent) { - Composite main = new Composite(parent, SWT.NONE); + Composite top = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); + layout.numColumns = 2; + + top.setLayout(layout); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Composite imageComposite = new Composite(top, SWT.NONE); + layout = new GridLayout(); + imageComposite.setLayout(layout); + imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + + Composite main = new Composite(top, SWT.NONE); + layout = new GridLayout(); layout.numColumns = 3; + layout.marginHeight = 0; + layout.marginHeight = 0; main.setLayout(layout); main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - + + Label imageLabel = new Label(imageComposite, SWT.NONE); + imageLabel.setImage(getImage(DLG_IMG_INFO)); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + imageLabel.setLayoutData(data); + if (message != null) { Label messageLabel = new Label(main, SWT.WRAP); messageLabel.setText(message); - messageLabel.setForeground(messageLabel.getDisplay().getSystemColor(SWT.COLOR_RED)); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 3; - data.widthHint = 400; + data.widthHint = 300; messageLabel.setLayoutData(data); } - if (domain != null) { + Label d = new Label(main, SWT.WRAP); + d.setText(Policy.bind("UserValidationDialog.5")); //$NON-NLS-1$ + data = new GridData(); + d.setLayoutData(data); Label label = new Label(main, SWT.WRAP); if (isUsernameMutable) { label.setText(Policy.bind("UserValidationDialog.labelUser", domain)); //$NON-NLS-1$ } else { label.setText(Policy.bind("UserValidationDialog.labelPassword", new Object[]{defaultUsername, domain})); //$NON-NLS-1$ } - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); - data.horizontalSpan = 3; - data.widthHint = 400; + data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + data.horizontalSpan = 2; + data.widthHint = 300; label.setLayoutData(data); } createUsernameFields(main); createPasswordFields(main); - + if(showAllowCachingButton) { allowCachingButton = new Button(main, SWT.CHECK); - allowCachingButton.setText("Remember this logon information and enter it automatically the next time it is needed."); - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$ + data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); data.horizontalSpan = 3; allowCachingButton.setLayoutData(data); allowCachingButton.addSelectionListener(new SelectionAdapter() { @@ -132,6 +150,23 @@ public class UserValidationDialog extends Dialog { allowCaching = allowCachingButton.getSelection(); } }); + Composite warningComposite = new Composite(main, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginHeight = 0; + layout.marginHeight = 0; + warningComposite.setLayout(layout); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 3; + warningComposite.setLayoutData(data); + Label warningLabel = new Label(warningComposite, SWT.NONE); + warningLabel.setImage(getImage(DLG_IMG_MESSAGE_WARNING)); + warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); + Label warningText = new Label(warningComposite, SWT.WRAP); + warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$ + data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 300; + warningText.setLayoutData(data); } Dialog.applyDialogFont(parent); @@ -139,6 +174,17 @@ public class UserValidationDialog extends Dialog { return main; } /** + * Create a spacer. + */ + protected void createSpacer(Composite top, int columnSpan, int vertSpan) { + Label l = new Label(top, SWT.NONE); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + data.horizontalSpan = columnSpan; + data.verticalSpan = vertSpan; + l.setLayoutData(data); + } + + /** * Creates the three widgets that represent the password entry area. * * @param parent the parent of the widgets @@ -166,6 +212,7 @@ public class UserValidationDialog extends Dialog { data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH); usernameField.setLayoutData(data); } + /** * Returns the password entered by the user, or null * if the user canceled. @@ -175,6 +222,7 @@ public class UserValidationDialog extends Dialog { public String getPassword() { return password; } + /** * Returns the username entered by the user, or null * if the user canceled. @@ -185,6 +233,11 @@ public class UserValidationDialog extends Dialog { return username; } + /** + * Returns <code>true</code> if the save password checkbox was selected. + * @return <code>true</code> if the save password checkbox was selected and <code>false</code> + * otherwise. + */ public boolean getAllowCaching() { return allowCaching; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties index ad0b152f4..e656ef707 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties @@ -8,6 +8,14 @@ # Contributors: # IBM Corporation - initial API and implementation ############################################################################### +PasswordManagementPreferencePage.2=The following CVS repository locations have saved passwords: +PasswordManagementPreferencePage.3=Location +PasswordManagementPreferencePage.4=Username +PasswordManagementPreferencePage.5=&Remove +PasswordManagementPreferencePage.6=Remove &All +UserValidationDialog.5=CVS Repository: +UserValidationDialog.6=Sa&ve Password +UserValidationDialog.7=Rememered passwords are unsafe. They are not encrypted when saved to disk. details=Press the details button for more information. simpleInternal=Internal error internal=An internal error has occurred, consult the error log for details. @@ -625,10 +633,10 @@ UpdateWizardPage.description=&Select a tag to update the project sharing to: UpdateWizardPage.overwrite=&Overwrite local changes UserValidationDialog.required=Password Required -UserValidationDialog.labelUser=Enter a user name and password for the following repository: {0} -UserValidationDialog.labelPassword=Enter a password for {0} in the following repository: {1} -UserValidationDialog.password=Password: -UserValidationDialog.user=User name: +UserValidationDialog.labelUser={0} +UserValidationDialog.labelPassword={1} +UserValidationDialog.password=&Password: +UserValidationDialog.user=&User name: KeyboradInteractiveDialog.message=Keyboard Interactive authentication for {0} KeyboardInteractiveDialog.labelRepository=Enter values for the following repository: {0} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java index 22692e07e..ed8ea5951 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/ConfigurationWizardMainPage.java @@ -13,7 +13,6 @@ package org.eclipse.team.internal.ccvs.ui.wizards; import java.util.*; import java.util.List; - import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.*; @@ -198,18 +197,6 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { portText = createTextField(portGroup); portText.addListener(SWT.Modify, listener); - allowCachingButton = new Button(composite, SWT.CHECK); - allowCachingButton.setText("Remember this logon information and enter it automatically the next time it is needed."); - data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); - data.horizontalSpan = 3; - allowCachingButton.setLayoutData(data); - allowCachingButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - allowCaching = allowCachingButton.getSelection(); - } - }); - - // create a composite to ensure the validate button is in its own tab group if (showValidate) { Composite validateButtonTabGroup = new Composite(composite, SWT.NONE); @@ -227,6 +214,35 @@ public class ConfigurationWizardMainPage extends CVSWizardPage { }); } + allowCachingButton = new Button(composite, SWT.CHECK); + allowCachingButton.setText(Policy.bind("UserValidationDialog.6")); //$NON-NLS-1$ + data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + data.horizontalSpan = 3; + allowCachingButton.setLayoutData(data); + allowCachingButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + allowCaching = allowCachingButton.getSelection(); + } + }); + + Composite warningComposite = new Composite(composite, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 2; + layout.marginHeight = 0; + layout.marginHeight = 0; + warningComposite.setLayout(layout); + data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 3; + warningComposite.setLayoutData(data); + Label warningLabel = new Label(warningComposite, SWT.NONE); + warningLabel.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING)); + warningLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_BEGINNING)); + Label warningText = new Label(warningComposite, SWT.WRAP); + warningText.setText(Policy.bind("UserValidationDialog.7")); //$NON-NLS-1$ + data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 300; + warningText.setLayoutData(data); + initializeValues(); updateWidgetEnablements(); hostCombo.setFocus(); |