Bug 539343 - Progress view has random order of entries

Use LinkedHashSet to keep the insertion order for entries in the
Progress view. This way the most recent jobs are shown at the bottom of
the view and not somewhere else. Same for the error dialog showing
multiple job error entries.

Change-Id: I9a47d4913b30e584413c875c91fffd273e084872
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
index 36eb240..e173c56 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/DetailedProgressViewer.java
@@ -14,7 +14,7 @@
 package org.eclipse.ui.internal.progress;
 
 import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 import org.eclipse.jface.dialogs.IDialogConstants;
@@ -156,7 +156,7 @@
 		ViewerComparator sorter = getComparator();
 
 		// Use a Set in case we are getting something added that exists
-		Set<JobTreeElement> newItems = new HashSet<>(elements.length);
+		Set<JobTreeElement> newItems = new LinkedHashSet<>(elements.length);
 
 		Control[] existingChildren = control.getChildren();
 		for (Control child : existingChildren) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
index 84488bb..1f20160 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/FinishedJobs.java
@@ -16,7 +16,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import org.eclipse.core.commands.common.EventManager;
@@ -55,7 +55,7 @@
 
 	private IJobProgressManagerListener listener;
 
-	private Set<JobTreeElement> keptjobinfos = new HashSet<>();
+	private Set<JobTreeElement> keptjobinfos = new LinkedHashSet<>();
 
 	private Map<JobTreeElement, Long> finishedTime = new HashMap<>();
 
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
index 090802a..883a98c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressViewerContentProvider.java
@@ -13,7 +13,6 @@
  *******************************************************************************/
 package org.eclipse.ui.internal.progress;
 
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
@@ -150,7 +149,7 @@
 			return elements;
 		}
 
-		Set<Object> all = new HashSet<>();
+		Set<Object> all = new LinkedHashSet<>();
 
 		for (Object element : elements) {
 			all.add(element);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
index 783a067..881bc08 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/statushandlers/WorkbenchStatusDialogManagerImpl.java
@@ -16,7 +16,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.core.runtime.IStatus;
@@ -157,7 +157,7 @@
 		dialogState.put(IStatusDialogConstants.HIDE_SUPPORT_BUTTON,
 				Boolean.FALSE);
 		dialogState.put(IStatusDialogConstants.STATUS_ADAPTERS, Collections
-				.synchronizedSet(new HashSet()));
+				.synchronizedSet(new LinkedHashSet()));
 		dialogState.put(IStatusDialogConstants.STATUS_MODALS, new HashMap());
 		dialogState.put(IStatusDialogConstants.LABEL_PROVIDER, new LabelProviderWrapper(
 				dialogState));