Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Kennedy2016-02-12 19:16:03 +0000
committerGerrit Code Review @ Eclipse.org2016-02-16 23:07:21 +0000
commit37236c56a7c204d4f34fab2be5b1f307d1af6e4b (patch)
treeb38a7012858f629a7ee2e29fb235b2e1087e0496 /org.eclipse.mylyn.tasks.ui
parentcc6f1b4b44f00e696f7f5aaecbedab9cd6baa869 (diff)
downloadorg.eclipse.mylyn.tasks-37236c56a7c204d4f34fab2be5b1f307d1af6e4b.tar.gz
org.eclipse.mylyn.tasks-37236c56a7c204d4f34fab2be5b1f307d1af6e4b.tar.xz
org.eclipse.mylyn.tasks-37236c56a7c204d4f34fab2be5b1f307d1af6e4b.zip
487761: Allow credential fields to be toggled
setNeedsRepositoryCredentials() now affects the editability of credentials fields after control creation. Change-Id: I1cc5c8f61f1274dd052c98e0d5ab993504e0dee9 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=487761 Signed-off-by: James Kennedy <james.kennedy@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
index 9c51e174e..bc808db4a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
@@ -1244,25 +1244,32 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
}
anonymousButton.setSelection(selected);
+ updateCredentialsEditors();
- if (selected) {
- oldUsername = repositoryUserNameEditor.getStringValue();
- oldPassword = (repositoryPasswordEditor).getStringValue();
- repositoryUserNameEditor.setStringValue(""); //$NON-NLS-1$
- repositoryPasswordEditor.setStringValue(""); //$NON-NLS-1$
- } else {
- repositoryUserNameEditor.setStringValue(oldUsername);
- repositoryPasswordEditor.setStringValue(oldPassword);
- }
-
- repositoryUserNameEditor.setEnabled(!selected, compositeContainer);
- repositoryPasswordEditor.setEnabled(!selected, compositeContainer);
- savePasswordButton.setEnabled(!selected);
if (getWizard() != null) {
getWizard().getContainer().updateButtons();
}
}
+ private void updateCredentialsEditors() {
+ if (repositoryUserNameEditor != null && repositoryPasswordEditor != null) {
+ boolean shouldEnable = needsRepositoryCredentials() && !isAnonymousAccess();
+ if (shouldEnable) {
+ repositoryUserNameEditor.setStringValue(oldUsername);
+ repositoryPasswordEditor.setStringValue(oldPassword);
+ } else {
+ oldUsername = repositoryUserNameEditor.getStringValue();
+ oldPassword = (repositoryPasswordEditor).getStringValue();
+ repositoryUserNameEditor.setStringValue(""); //$NON-NLS-1$
+ repositoryPasswordEditor.setStringValue(""); //$NON-NLS-1$
+ }
+
+ repositoryUserNameEditor.setEnabled(shouldEnable, compositeContainer);
+ repositoryPasswordEditor.setEnabled(shouldEnable, compositeContainer);
+ savePasswordButton.setEnabled(shouldEnable);
+ }
+ }
+
/**
* @since 2.0
*/
@@ -1937,6 +1944,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
*/
public void setNeedsRepositoryCredentials(boolean needsRepositoryCredentials) {
this.needsRepositoryCredentials = needsRepositoryCredentials;
+ updateCredentialsEditors();
}
public void setNeedsValidation(boolean needsValidation) {

Back to the top