Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-09-09 12:28:21 -0400
committerJeff Johnston2016-09-14 14:54:11 -0400
commitb821b51f9674b37ff3422c0fda8e524f45fe2d18 (patch)
tree2ab5a03d2bd8348266188ef1c9fc86b97266e194
parent8db7c6e64f524c92c219d0db6b96b21f71232645 (diff)
downloadorg.eclipse.linuxtools-b821b51f9674b37ff3422c0fda8e524f45fe2d18.tar.gz
org.eclipse.linuxtools-b821b51f9674b37ff3422c0fda8e524f45fe2d18.tar.xz
org.eclipse.linuxtools-b821b51f9674b37ff3422c0fda8e524f45fe2d18.zip
Bug 500969 - Duplicate registry info in combo after changing settings
Using a ocal copy of the registry accounts instead of the same list to avoid adding the new registry account twice (once upon dialog completion, once upon preference page completion) Change-Id: I551354cd4c6416cad992a2e9d9bf047f2aff79b1 Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/80831 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/RegistryAccountManager.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/preferences/DockerRegistryAccountPreferencePage.java5
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullPushPage.java2
3 files changed, 7 insertions, 3 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/RegistryAccountManager.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/RegistryAccountManager.java
index 602a037f20..5da02d77de 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/RegistryAccountManager.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/RegistryAccountManager.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.linuxtools.internal.docker.core;
+import java.util.Collections;
import java.util.List;
import org.eclipse.linuxtools.docker.core.IRegistryAccount;
@@ -65,7 +66,7 @@ public class RegistryAccountManager {
if (this.registryAccounts == null) {
this.registryAccounts = storageManager.getAccounts();
}
- return this.registryAccounts;
+ return Collections.unmodifiableList(this.registryAccounts);
}
public IRegistryAccount getAccount(final String serverAddress,
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/preferences/DockerRegistryAccountPreferencePage.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/preferences/DockerRegistryAccountPreferencePage.java
index 2bac7d5b95..3973046ddd 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/preferences/DockerRegistryAccountPreferencePage.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/preferences/DockerRegistryAccountPreferencePage.java
@@ -261,8 +261,9 @@ public class DockerRegistryAccountPreferencePage extends PreferencePage
*/
@Override
public void init(IWorkbench workbench) {
- // reinit passwords list
- passwords = RegistryAccountManager.getInstance().getAccounts();
+ // get a local copy of the accounts
+ passwords = new ArrayList<>(
+ RegistryAccountManager.getInstance().getAccounts());
// refresh password table
if (pwdTableViewer != null) {
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullPushPage.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullPushPage.java
index e3f61c628f..e4cd47bb18 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullPushPage.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/wizards/ImagePullPushPage.java
@@ -151,6 +151,8 @@ public abstract class ImagePullPushPage<M extends ImagePullPushPageModel>
* daemon.
*/
protected List<IRegistry> getRegistryAccounts() {
+ // get a local copy an insert an entry at the first position for Docker
+ // Hub with no credentials
final List<IRegistry> accounts = new ArrayList<>(
RegistryAccountManager.getInstance().getAccounts());
accounts.add(0, new RegistryInfo(DOCKER_DAEMON_DEFAULT, true));

Back to the top