Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-10-11 05:42:46 -0400
committerGerrit Code Review @ Eclipse.org2013-10-16 16:31:46 -0400
commit7c064e0d212f127c465f6c0db97c38f5d36b990f (patch)
tree0ffe91cda97fb3e6c35e2d20ae337d72f6e5d206
parent6f0257225562c016638ff723ead931794c2eb8ad (diff)
downloadorg.eclipse.mylyn.tasks-7c064e0d212f127c465f6c0db97c38f5d36b990f.tar.gz
org.eclipse.mylyn.tasks-7c064e0d212f127c465f6c0db97c38f5d36b990f.tar.xz
org.eclipse.mylyn.tasks-7c064e0d212f127c465f6c0db97c38f5d36b990f.zip
379619: clicking Validate Settings should temporarily disable Validate
on Finish Change-Id: I61f5a8c84cfbf5ad87dccf7be16f959eb56188bd Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=379619
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java51
1 files changed, 48 insertions, 3 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 fccefa236..26ab6ad49 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
@@ -18,8 +18,10 @@ import java.lang.reflect.InvocationTargetException;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.httpclient.URI;
@@ -248,6 +250,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
*/
protected SectionComposite innerComposite;
+ private TaskRepository validatedTaskRepository;
+
+ private final Map<AuthenticationType, AuthenticationCredentials> validatedAuthenticationCredentials = new HashMap<AuthenticationType, AuthenticationCredentials>();
+
/**
* @since 3.10
*/
@@ -652,7 +658,9 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
}
updateHyperlinks();
-
+ if (repository != null) {
+ saveToValidatedProperties(createTaskRepository());
+ }
GridLayout layout = new GridLayout(3, false);
compositeContainer.setLayout(layout);
}
@@ -1950,7 +1958,8 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
* @since 2.0
*/
protected void validateSettings() {
- final Validator validator = getValidator(createTaskRepository());
+ TaskRepository newTaskRepository = createTaskRepository();
+ final Validator validator = getValidator(newTaskRepository);
if (validator == null) {
return;
}
@@ -1990,6 +1999,9 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
getWizard().getContainer().updateButtons();
applyValidatorResult(validator);
+ if (isValid) {
+ saveToValidatedProperties(newTaskRepository);
+ }
}
/**
@@ -2102,7 +2114,7 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
@Override
public boolean preFinish(TaskRepository repository) {
- if (validateOnFinishButton != null && validateOnFinishButton.getSelection()) {
+ if (validateOnFinishButton != null && validateOnFinishButton.getSelection() && !propertiesUnchanged()) {
isValid = false;
validateSettings();
} else {
@@ -2138,4 +2150,37 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
return toolkit;
}
+ private boolean propertiesUnchanged() {
+ TaskRepository newRepository = createTaskRepository();
+ boolean propertiesUnchanged = false;
+ if (validatedTaskRepository != null) {
+ propertiesUnchanged = validatedTaskRepository.getProperties().equals(newRepository.getProperties());
+ if (propertiesUnchanged) {
+ for (AuthenticationType authenticationType : AuthenticationType.values()) {
+ AuthenticationCredentials credentialsOld = validatedAuthenticationCredentials.get(authenticationType);
+ AuthenticationCredentials credentialsNew = newRepository.getCredentials(authenticationType);
+ if (credentialsOld != null) {
+ propertiesUnchanged = credentialsOld.equals(credentialsNew);
+ if (!propertiesUnchanged) {
+ break;
+ }
+ } else if (credentialsNew != null) {
+ propertiesUnchanged = false;
+ break;
+ }
+ }
+ }
+ }
+ return propertiesUnchanged;
+ }
+
+ private void saveToValidatedProperties(TaskRepository taskRepository) {
+ validatedTaskRepository = taskRepository;
+ validatedAuthenticationCredentials.clear();
+ for (AuthenticationType authenticationType : AuthenticationType.values()) {
+ AuthenticationCredentials ra = validatedTaskRepository.getCredentials(authenticationType);
+ validatedAuthenticationCredentials.put(authenticationType, ra);
+ }
+ }
+
}

Back to the top