mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Fix bug 142446. Ensure that no profile (including the Team and default private profiles) are not placed in the active profiles list more than once.
This commit is contained in:
parent
0adf8745e1
commit
94ee293c61
1 changed files with 9 additions and 7 deletions
|
@ -15,9 +15,11 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.core;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.rse.model.IHost;
|
||||
import org.eclipse.rse.model.ISystemRegistry;
|
||||
|
@ -112,15 +114,15 @@ public class SystemPreferencesManager
|
|||
RemoteSystemsPreferencePage.setActiveProfiles(names);
|
||||
}
|
||||
/**
|
||||
* Add a name to the active profile list
|
||||
* Add a name to the active profile list. A name already in the list is not added again.
|
||||
* The list remains sorted in the natural order.
|
||||
*/
|
||||
public void addActiveProfile(String newName)
|
||||
{
|
||||
String[] names = getActiveProfileNames();
|
||||
String[] newNames = new String[names.length+1];
|
||||
for (int idx=0; idx<names.length; idx++)
|
||||
newNames[idx] = names[idx];
|
||||
newNames[names.length] = newName;
|
||||
SortedSet names = new TreeSet(Arrays.asList(getActiveProfileNames()));
|
||||
names.add(newName);
|
||||
String[] newNames = new String[names.size()];
|
||||
names.toArray(newNames);
|
||||
RemoteSystemsPreferencePage.setActiveProfiles(newNames);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue