Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 74361 Details for
Bug 165674
Ordering of Services in the New Connection Wizard is not always consistent
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to sort Subsystem Configurations by Id
bug165674_subSysSortById.diff.txt (text/plain), 6.22 KB, created by
Martin Oberhuber
on 2007-07-23 10:53:34 EDT
(
hide
)
Description:
Patch to sort Subsystem Configurations by Id
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2007-07-23 10:53:34 EDT
Size:
6.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.ui >Index: model/org/eclipse/rse/ui/internal/model/SystemRegistry.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java,v >retrieving revision 1.31 >diff -u -r1.31 SystemRegistry.java >--- model/org/eclipse/rse/ui/internal/model/SystemRegistry.java 20 Jul 2007 20:15:48 -0000 1.31 >+++ model/org/eclipse/rse/ui/internal/model/SystemRegistry.java 23 Jul 2007 14:51:20 -0000 >@@ -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 void setSubSystemConfigurationProxies(ISubSystemConfigurationProxy[] proxies) > { >- subsystemConfigurationProxies = proxies; >- //for (int idx=0; idx<proxies.length; idx++) >- // proxies[idx].setLogFile(logFile); >+ //[165674]: Sort proxies by ID in order to get deterministic results >+ //on all getSubSystemConfiguration*() queries >+ ISubSystemConfigurationProxy[] newProxies = (ISubSystemConfigurationProxy[])proxies.clone(); >+ Arrays.sort(newProxies, new Comparator(){ >+ public int compare(Object o1, Object o2) { >+ String t1 = ((ISubSystemConfigurationProxy) o1).getId(); >+ String t2 = ((ISubSystemConfigurationProxy) o2).getId(); >+ return t1.compareTo(t2); >+ } >+ }); >+ //for (int idx=0; idx<newProxies.length; idx++) >+ // newProxies[idx].setLogFile(logFile); >+ subsystemConfigurationProxies = newProxies; > } > /** > * Public method to retrieve list of subsystem factory proxies registered by extension points. >@@ -308,10 +320,9 @@ > > > >- /** >- * Return all subsystem factories which support the given system type. >- * If the type is null, returns all. >- * >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationsBySystemType(org.eclipse.rse.core.IRSESystemType, boolean) > */ > public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories) > { >@@ -360,28 +371,7 @@ > > v.addElement(ssFactory); > } >- else // for 165674 - fix the order to be deterministic >- { >- // replace with this one if this is first alphabetically >- // find the current one >- for (int i = 0; i < v.size(); i++) >- { >- if (v.get(i) instanceof IServiceSubSystemConfiguration) >- { >- IServiceSubSystemConfiguration addedConfig = (IServiceSubSystemConfiguration)v.get(i); >- if (addedConfig.getServiceType() == serviceType) >- { >- if (serviceFactory.getName().compareTo(addedConfig.getName()) <= 0) >- { >- v.remove(addedConfig); >- v.add(serviceFactory); > } >- } >- } >- } >- >- } >- } > else > { > v.addElement(ssFactory); >@@ -390,50 +380,10 @@ > } > } > } >- >- v = sortConfigurations(v); >- ISubSystemConfiguration[] factories = new ISubSystemConfiguration[v.size()]; >- >- for (int idx = 0; idx < v.size(); idx++) >- factories[idx] = (ISubSystemConfiguration) v.elementAt(idx); >+ ISubSystemConfiguration[] factories = (ISubSystemConfiguration[])v.toArray(new ISubSystemConfiguration[v.size()]); > return factories; > } > >- private Vector sortConfigurations(Vector v) >- { >- Vector sorted = new Vector(v.size()); >- while (v.size() > 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... >#P org.eclipse.rse.core >Index: src/org/eclipse/rse/core/model/ISystemRegistry.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java,v >retrieving revision 1.28 >diff -u -r1.28 ISystemRegistry.java >--- src/org/eclipse/rse/core/model/ISystemRegistry.java 5 Jun 2007 20:59:51 -0000 1.28 >+++ src/org/eclipse/rse/core/model/ISystemRegistry.java 23 Jul 2007 14:51:23 -0000 >@@ -97,12 +97,12 @@ > 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...
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 165674
: 74361 |
74368
|
74369