aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2012-01-10 07:41:33 (EST)
committerDariusz Luksza2012-01-14 09:53:42 (EST)
commit4845fa8082fdf718bbfc728c51806d256472da63 (patch)
treeeb57b537a14e5107be568ea140b9aede6e42aa9c
parent367f9c26ed6f283cdf5c9d0d5e8eda4920abdc56 (diff)
downloadegit-4845fa8082fdf718bbfc728c51806d256472da63.zip
egit-4845fa8082fdf718bbfc728c51806d256472da63.tar.gz
egit-4845fa8082fdf718bbfc728c51806d256472da63.tar.bz2
Make order predictable when pulling multiple projectsrefs/changes/37/4937/2
Before, the order was random because HashSet and HashMap were used. With this change, the Linked* variants are used. This makes order stay the same from user selection to result dialog, which improves usability. Change-Id: I52e1fd672931e64b16eb82ea274953271750f59a Signed-off-by: Robin Stocker <robin@nibor.org>
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/op/PullOperation.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/PullFromUpstreamActionHandler.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java12
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullOperationUI.java4
5 files changed, 14 insertions, 14 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PullOperation.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PullOperation.java
index 4f7c804..6e0a0cb 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PullOperation.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/op/PullOperation.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.core.op;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
@@ -47,7 +47,7 @@ import org.eclipse.osgi.util.NLS;
public class PullOperation implements IEGitOperation {
private final Repository[] repositories;
- private final Map<Repository, Object> results = new HashMap<Repository, Object>();
+ private final Map<Repository, Object> results = new LinkedHashMap<Repository, Object>();
private final int timeout;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/PullFromUpstreamActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/PullFromUpstreamActionHandler.java
index a95601c..6246034 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/PullFromUpstreamActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/PullFromUpstreamActionHandler.java
@@ -12,7 +12,7 @@ package org.eclipse.egit.ui.internal.actions;
import java.io.IOException;
import java.util.Arrays;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Set;
import org.eclipse.core.commands.ExecutionEvent;
@@ -30,7 +30,7 @@ public class PullFromUpstreamActionHandler extends RepositoryActionHandler {
Repository[] repos = getRepositories(event);
if (repos.length == 0)
return null;
- Set<Repository> repositories = new HashSet<Repository>(
+ Set<Repository> repositories = new LinkedHashSet<Repository>(
Arrays.asList(repos));
new PullOperationUI(repositories).start();
return null;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java
index e6c02c6..983dfa4 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/RepositoryActionHandler.java
@@ -16,8 +16,8 @@ import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.Set;
import org.eclipse.core.commands.AbstractHandler;
@@ -81,7 +81,7 @@ abstract class RepositoryActionHandler extends AbstractHandler {
*/
private IProject[] getProjectsForSelectedResources(
IStructuredSelection selection) {
- Set<IProject> ret = new HashSet<IProject>();
+ Set<IProject> ret = new LinkedHashSet<IProject>();
for (IResource resource : (IResource[]) getSelectedAdaptables(
selection, IResource.class))
ret.add(resource.getProject());
@@ -91,7 +91,7 @@ abstract class RepositoryActionHandler extends AbstractHandler {
}
private Set<IProject> extractProjectsFromMappings(IStructuredSelection selection) {
- Set<IProject> ret = new HashSet<IProject>();
+ Set<IProject> ret = new LinkedHashSet<IProject>();
for (ResourceMapping mapping : (ResourceMapping[]) getSelectedAdaptables(
selection, ResourceMapping.class)) {
IProject[] projects = mapping.getProjects();
@@ -122,7 +122,7 @@ abstract class RepositoryActionHandler extends AbstractHandler {
* @return the repositories that projects map to iff all projects are mapped
*/
protected Repository[] getRepositoriesFor(final IProject[] projects) {
- Set<Repository> ret = new HashSet<Repository>();
+ Set<Repository> ret = new LinkedHashSet<Repository>();
for (IProject project : projects) {
RepositoryMapping repositoryMapping = RepositoryMapping
.getMapping(project);
@@ -169,7 +169,7 @@ abstract class RepositoryActionHandler extends AbstractHandler {
*/
private IProject[] getProjectsInRepositoryOfSelectedResources(
IStructuredSelection selection) {
- Set<IProject> ret = new HashSet<IProject>();
+ Set<IProject> ret = new LinkedHashSet<IProject>();
Repository[] repositories = getRepositoriesFor(getProjectsForSelectedResources(selection));
final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
.getProjects();
@@ -455,7 +455,7 @@ abstract class RepositoryActionHandler extends AbstractHandler {
* @return the resources in the selection
*/
private IResource[] getSelectedResources(IStructuredSelection selection) {
- Set<IResource> result = new HashSet<IResource>();
+ Set<IResource> result = new LinkedHashSet<IResource>();
for (Object o : selection.toList()) {
IResource resource = (IResource) getAdapter(o, IResource.class);
if (resource != null)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
index 32c34a6..55cd406 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/MultiPullResultDialog.java
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.pull;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -60,7 +60,7 @@ public class MultiPullResultDialog extends Dialog {
private static final int DETAIL_BUTTON = 99;
// the value is either a PullResult or an IStatus
- private final Map<Repository, Object> results = new HashMap<Repository, Object>();
+ private final Map<Repository, Object> results = new LinkedHashMap<Repository, Object>();
private TableViewer tv;
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullOperationUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullOperationUI.java
index 3015371..8970e25 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullOperationUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/pull/PullOperationUI.java
@@ -11,7 +11,7 @@
package org.eclipse.egit.ui.internal.pull;
import java.io.IOException;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@@ -49,7 +49,7 @@ public class PullOperationUI extends JobChangeAdapter implements
private final Repository[] repositories;
- private final Map<Repository, Object> results = new HashMap<Repository, Object>();
+ private final Map<Repository, Object> results = new LinkedHashMap<Repository, Object>();
private final PullOperation pullOperation;