From e9ee543d107b3870faeb42c3513ff73b83dd809b Mon Sep 17 00:00:00 2001 From: Martin Oberhuber < martin.oberhuber@windriver.com> Date: Mon, 23 Jul 2007 14:55:17 +0000 Subject: [PATCH] [165674] Sort subsystem configurations by Id rather than name --- .../rse/core/model/ISystemRegistry.java | 6 +- .../rse/ui/internal/model/SystemRegistry.java | 88 ++++--------------- 2 files changed, 22 insertions(+), 72 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java index 03f428d5e8a..697dfa06e4d 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java @@ -97,12 +97,12 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable, ISystemVie public ISubSystemConfiguration getSubSystemConfiguration(String id); /** - * Return all subsystem factories which support the given system type. + * Return all subsystem configurations which support the given system type. * If the type is null, returns all. * @param systemType system type to filter - * @param filterDuplicateServiceSubSystemFactories set false by default + * @param filterDuplicateServiceSubSystemConfigurations set false by default */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories); + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemConfigurations); // ---------------------------------- // SYSTEMVIEWINPUTPROVIDER METHODS... diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java index 711517c780f..2ee219a62ac 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java @@ -33,11 +33,13 @@ * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core * Xuan Chen (IBM) - [194838] Move the code for comparing two objects by absolute name to a common location * David McKnight (IBM) - [165674] Sort subsystem configurations to be in deterministic order + * Martin Oberhuber (Wind River) - [165674] Sort subsystem configurations by Id rather than name ********************************************************************************/ package org.eclipse.rse.ui.internal.model; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Vector; @@ -258,9 +260,19 @@ public class SystemRegistry implements ISystemRegistry */ public void setSubSystemConfigurationProxies(ISubSystemConfigurationProxy[] proxies) { - subsystemConfigurationProxies = proxies; - //for (int idx=0; idx 0) - { - ISubSystemConfiguration first = firstConfiguration(v); - sorted.add(first); - v.remove(first); - } - return sorted; - } - - private ISubSystemConfiguration firstConfiguration(Vector v) - { - ISubSystemConfiguration first = null; - for (int i = 0; i < v.size(); i++) - { - ISubSystemConfiguration next = (ISubSystemConfiguration)v.get(i); - if (first == null) - { - first = next; - } - else - { - String name1 = first.getName(); - String name2 = next.getName(); - if (name2.compareTo(name1) <= 0) - { - first = next; - } - } - } - return first; - } - // ---------------------------- // USER PREFERENCE METHODS...