Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2016-09-09 12:28:21 -0400
committerJeff Johnston2016-09-14 15:14:39 -0400
commit1d6cf21f67d0d99811adf0fe05b465d49dc3219b (patch)
tree7fd2165bc96fa42de4b3013b3b1e0e443f6676d5
parent4431adc79aeae16503bc088d81e9d495a2898a05 (diff)
downloadorg.eclipse.linuxtools-stable-5.1.tar.gz
org.eclipse.linuxtools-stable-5.1.tar.xz
org.eclipse.linuxtools-stable-5.1.zip
Bug 500969 - Duplicate registry info in combo after changing settingsv5.1.0stable-5.1
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> (cherry picked from commit b821b51f9674b37ff3422c0fda8e524f45fe2d18) Reviewed-on: https://git.eclipse.org/r/81124
-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