1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-28 10:43:31 +02:00

[189749] removed extraneous methods from ISystemProfileManager, migrated all validators that used Vector arguments to use List

This commit is contained in:
David Dykstal 2007-05-29 22:16:07 +00:00
parent a924ffced5
commit 5ac50e575d
22 changed files with 80 additions and 177 deletions

View file

@ -16,9 +16,6 @@
package org.eclipse.rse.core.model;
import java.util.List;
import java.util.Vector;
/**
* Manages a list of SystemProfile objects. System profiles
* should be created, deleted, restored, activated, and deactivated though
@ -60,11 +57,6 @@ public interface ISystemProfileManager {
*/
public String[] getSystemProfileNames();
/**
* @return a vector of all existing profile names.
*/
public Vector getSystemProfileNamesVector();
/**
* Get a profile given its name.
* @param name the name of the profile
@ -82,13 +74,6 @@ public interface ISystemProfileManager {
*/
public String[] getActiveSystemProfileNames();
/**
* Get the index of a profile given its name.
* @param profileName the name of the profile to look for.
* @return 0-based position of the given active profile within the list of active profiles.
*/
public int getActiveSystemProfilePosition(String profileName);
/**
* @return the default private profile created at first touch.
* Will return null if it has been renamed.
@ -132,29 +117,10 @@ public interface ISystemProfileManager {
*/
public boolean isSystemProfileActive(String profileName);
/**
* @return The list of profiles known to this manager. This list is generated
* at the point of this call and may thus be manipulated by the caller.
*/
public List getProfiles();
/**
* Adds a system profile to this profile manager.
* @param profile The system profile to add.
*/
public void addSystemProfile(ISystemProfile profile);
// /**
// * Reusable method to return a name validator for renaming a profile.
// * @param the current profile name on updates. Can be null for new profiles. Used
// * to remove from the existing name list the current connection.
// */
// public ISystemValidator getProfileNameValidator(String profileName);
// /**
// * Reusable method to return a name validator for renaming a profile.
// * @param the current profile object on updates. Can be null for new profiles. Used
// * to remove from the existing name list the current connection.
// */
// public ISystemValidator getProfileNameValidator(ISystemProfile profile);
}

View file

@ -183,7 +183,7 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable {
/**
* Return the profiles currently selected by the user as his "active" profiles
* @see ISystemProfileManager.getActiveSystemProfiles()
* @see ISystemProfileManager#getActiveSystemProfiles()
*/
public ISystemProfile[] getActiveSystemProfiles();
@ -207,13 +207,6 @@ public interface ISystemRegistry extends ISchedulingRule, IAdaptable {
*/
public String[] getAllSystemProfileNames();
/**
* Return all defined profile names as a vector
* @deprecated use getAllSystemProfileManager().getSystemProfiles()
* and process the array to get a vector
*/
public Vector getAllSystemProfileNamesVector();
/**
* Get a SystemProfile given its name
*/

View file

@ -18,10 +18,8 @@
package org.eclipse.rse.internal.core.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.RSEPreferencesManager;
@ -135,23 +133,6 @@ public class SystemProfileManager implements ISystemProfileManager {
// return profileNames;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getSystemProfileNamesVector()
*/
public Vector getSystemProfileNamesVector() {
List names = Arrays.asList(getSystemProfileNames());
Vector result = new Vector(names.size());
result.addAll(names);
return result;
// if (profileNamesVector == null) {
// ISystemProfile[] profiles = getSystemProfiles();
// profileNamesVector = new Vector(profiles.length);
// for (int idx = 0; idx < profiles.length; idx++)
// profileNamesVector.addElement(profiles[idx].getName());
// }
// return profileNamesVector;
}
// /**
// * Something changed so invalide cache of profiles so it will be regenerated
// */
@ -367,30 +348,6 @@ public class SystemProfileManager implements ISystemProfileManager {
return activeProfileNames;
}
/**
* @return the profile names currently selected by the user as "active" profiles
* @deprecated
*/
public Vector getActiveSystemProfileNamesVector() {
String[] profileNames = RSEPreferencesManager.getActiveProfiles();
Vector v = new Vector(profileNames.length);
for (int idx = 0; idx < profileNames.length; idx++)
v.addElement(profileNames[idx]);
return v;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfilePosition(java.lang.String)
*/
public int getActiveSystemProfilePosition(String profileName) {
String[] profiles = getActiveSystemProfileNames();
int pos = -1;
for (int idx = 0; (pos < 0) && (idx < profiles.length); idx++) {
if (profiles[idx].equals(profileName)) pos = idx;
}
return pos;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultPrivateSystemProfile()
*/
@ -405,15 +362,6 @@ public class SystemProfileManager implements ISystemProfileManager {
return getSystemProfile(RSEPreferencesManager.getDefaultTeamProfileName());
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getProfiles()
*/
public List getProfiles() {
List result = new ArrayList(_profiles.size());
result.addAll(_profiles);
return result;
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getSize()
*/

View file

@ -20,6 +20,7 @@
********************************************************************************/
package org.eclipse.rse.internal.ui.view.team;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
@ -379,7 +380,9 @@ public class SystemTeamViewProfileAdapter
*/
public ISystemValidator getNameValidator(Object element)
{
Vector names = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNamesVector();
String[] nameArray = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
Vector names = new Vector(nameArray.length);
names.addAll(Arrays.asList(nameArray));
ISystemValidator validator = new ValidatorProfileName(names);
return validator;
}

View file

@ -16,7 +16,7 @@
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
/**
* This interface is implemented by any validator that
@ -37,7 +37,7 @@ public interface ISystemValidatorUniqueString
/**
* Reset the existing names list.
*/
public void setExistingNamesList(Vector existingList);
public void setExistingNamesList(List existingList);
/**
* Return the existing names list. This will be a case-normalized and sorted list.
*/

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
@ -35,7 +35,7 @@ public class ValidatorArchiveName extends ValidatorFileName {
protected SystemMessage msg_NotRegisteredArchive;
public ValidatorArchiveName(Vector existingNameList) {
public ValidatorArchiveName(List existingNameList) {
super(existingNameList);
}

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@ -37,9 +37,9 @@ public class ValidatorCompileCommandLabel extends ValidatorUniqueString
protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
/**
* Use this constructor when you have a vector of existing labels.
* Use this constructor when you have a list of existing labels.
*/
public ValidatorCompileCommandLabel(Vector existingLabelList)
public ValidatorCompileCommandLabel(List existingLabelList)
{
super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
init();

View file

@ -15,8 +15,9 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -38,9 +39,9 @@ public class ValidatorConnectionName extends ValidatorUniqueString implements IS
/**
* Constructor.
* @param existingNameList Vector of existing names (strings) in owning profile. Can be null if not a rename operation.
* @param existingNameList list of existing names (strings) in owning profile. Can be null if not a rename operation.
*/
public ValidatorConnectionName(Vector existingNameList)
public ValidatorConnectionName(List existingNameList)
{
super(existingNameList, CASE_SENSITIVE);
setErrorMessages(
@ -60,11 +61,11 @@ public class ValidatorConnectionName extends ValidatorUniqueString implements IS
public static boolean validateNameNotInUse(String proposedName, Shell shell)
{
SystemMessage msg = null;
Vector profileNames = RSEUIPlugin.getTheSystemProfileManager().getSystemProfileNamesVector();
String profileName = null;
for (int idx=0; (msg==null)&& (idx<profileNames.size()); idx++)
String[] names = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager().getSystemProfileNames();
String profileName = null;
for (int idx = 0; (msg == null) && (idx < names.length); idx++)
{
profileName = (String)profileNames.elementAt(idx);
profileName = names[idx];
IHost[] conns = RSEUIPlugin.getTheSystemProfileManager().getSystemProfile(profileName).getHosts();
for (int jdx=0; (msg==null) && (jdx<conns.length); jdx++)
{

View file

@ -11,7 +11,9 @@
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.ISystemProfileManager;
@ -29,9 +31,10 @@ public class ValidatorFactory {
*/
public static ISystemValidator getProfileNameValidator(String profileName) {
ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
Vector profileNames = manager.getSystemProfileNamesVector();
if (profileName != null) profileNames.remove(profileName);
ISystemValidator nameValidator = new ValidatorProfileName(profileNames);
String[] nameArray = manager.getSystemProfileNames();
List names = new ArrayList(Arrays.asList(nameArray));
if (profileName != null) names.remove(profileName);
ISystemValidator nameValidator = new ValidatorProfileName(names);
return nameValidator;
}

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
@ -43,10 +43,10 @@ public class ValidatorFileName
protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
/**
* Use this constructor when the name must be unique. Give the
* ctor a vector containing a list of existing names to compare against.
* Use this constructor when the name must be unique.
* @param existingNameList a list of existing names to compare against.
*/
public ValidatorFileName(Vector existingNameList)
public ValidatorFileName(List existingNameList)
{
super(existingNameList, false); // case insensitive uniqueness
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
@ -37,11 +37,11 @@ public class ValidatorFilterName
//public static final boolean CASE_INSENSITIVE = false;
/**
* Constructor accepting a Vector.
* @param existingList A vector containing list of existing filter names to compare against.
* Constructor accepting a List.
* @param existingList a list of existing filter names to compare against.
* Note that toString() is used to get the string from each item.
*/
public ValidatorFilterName(Vector existingList)
public ValidatorFilterName(List existingList)
{
super(existingList, CASE_SENSITIVE);
init();

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
@ -34,11 +34,11 @@ public class ValidatorFilterPoolName
public static final int MAX_FILTERPOOLNAME_LENGTH = 50;
/**
* Constructor accepting a Vector.
* @param existingList vector containing list of existing filter names to compare against.
* Constructor accepting a list.
* @param existingList a list of existing filter names to compare against.
* Note that toString() is used to get the string from each item.
*/
public ValidatorFilterPoolName(Vector existingList)
public ValidatorFilterPoolName(List existingList)
{
super(existingList, CASE_SENSITIVE);
init();

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.core.filters.ISystemFilterString;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
@ -39,11 +39,11 @@ public class ValidatorFilterString
protected SystemMessage msg_Invalid;
/**
* Constructor accepting a Vector for the list of existing strings, as simple strings.
* @param existingList A vector of strings to compare against.
* Constructor accepting a list of existing strings, as simple strings.
* @param existingList A list of strings to compare against.
* @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
*/
public ValidatorFilterString(Vector existingList, boolean caseSensitive)
public ValidatorFilterString(List existingList, boolean caseSensitive)
{
super(existingList, caseSensitive); // case sensitive uniqueness
init();

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
@ -44,9 +44,9 @@ public class ValidatorFolderName
/**
* Use this constructor when the name must be unique. Give the
* ctor a vector containing a list of existing names to compare against.
* @param existingNameList a list of existing names to compare against.
*/
public ValidatorFolderName(Vector existingNameList)
public ValidatorFolderName(List existingNameList)
{
super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),

View file

@ -16,7 +16,7 @@
package org.eclipse.rse.ui.validators;
import java.io.File;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
@ -37,7 +37,7 @@ public class ValidatorLocalPath extends ValidatorPathName
/**
* Constructor for ValidatorLocalPath
*/
public ValidatorLocalPath(Vector existingNameList)
public ValidatorLocalPath(List existingNameList)
{
super(existingNameList);
}

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -39,10 +39,10 @@ public class ValidatorPathName
private int nbrSpecialChars;
/**
* Use this constructor when the name must be unique. Give the
* ctor a vector containing a list of existing names to compare against.
* Use this constructor when the name must be unique.
* @param existingNameList a list of existing names to compare against.
*/
public ValidatorPathName(Vector existingNameList)
public ValidatorPathName(List existingNameList)
{
super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
init();

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -36,9 +36,10 @@ public class ValidatorProfileName
private SystemMessage reservedNameMsg;
/**
* Constructor. The list of existing names can be null if this is not a rename operation.
* The list of existing names can be null if this is not a rename operation.
* @param existingNameList the list of names to compare against
*/
public ValidatorProfileName(Vector existingNameList)
public ValidatorProfileName(List existingNameList)
{
super(existingNameList);
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_EMPTY),

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -41,10 +41,10 @@ public class ValidatorSystemName
protected SystemMessage msg_Invalid;
/**
* Use this constructor when the name must be unique. Give the
* ctor a vector containing a list of existing names to compare against.
* Use this constructor when the name must be unique.
* @param existingNameList a list of existing names to compare against.
*/
public ValidatorSystemName(Vector existingNameList)
public ValidatorSystemName(List existingNameList)
{
super(existingNameList, true); // case sensitive uniqueness
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),

View file

@ -16,7 +16,7 @@
package org.eclipse.rse.ui.validators;
import java.util.Arrays;
import java.util.Vector;
import java.util.List;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@ -29,7 +29,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
* IInputValidator as input, no syntax checking is done other than checking
* the input is non-empty and unique.
*
* The IInputValidator interface is implelemented by our parent and it
* The IInputValidator interface is implemented by our parent and it
* is used by jface's InputDialog class and property sheet window.
*/
public class ValidatorUniqueString
@ -49,12 +49,11 @@ public class ValidatorUniqueString
protected SystemMessage currentMessage;
/**
* Constructor accepting a Vector.
* @param existingList A vector containing list of existing strings to compare against.
* @param existingList a list of existing strings to compare against.
* Note that toString() is used to get the string from each item.
* @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
*/
public ValidatorUniqueString(Vector existingList, boolean caseSensitive)
public ValidatorUniqueString(List existingList, boolean caseSensitive)
{
this.caseSensitive = caseSensitive;
setExistingNamesList(existingList);
@ -76,15 +75,15 @@ public class ValidatorUniqueString
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTUNIQUE));
}
/**
* Constructor accepting a Vector and another validator to use for the syntax checking.
* @param existingList A vector containing list of existing strings to compare against.
* Constructor accepting a List and another validator to use for the syntax checking.
* @param existingList A list of existing strings to compare against.
* Note that toString() is used to get the string from each item.
* @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
* @param syntaxValidator Another IInputValidator who does the job of checking the syntax. After
* checking for non-nullness and uniqueness, this validator is used to
* check for syntax.
*/
public ValidatorUniqueString(Vector existingList, boolean caseSensitive,
public ValidatorUniqueString(List existingList, boolean caseSensitive,
ISystemValidator syntaxValidator)
{
this(existingList, caseSensitive);
@ -124,7 +123,7 @@ public class ValidatorUniqueString
/**
* Reset the existing names list.
*/
public void setExistingNamesList(Vector newList)
public void setExistingNamesList(List newList)
{
if (newList == null)
existingList = null;

View file

@ -15,7 +15,7 @@
********************************************************************************/
package org.eclipse.rse.ui.validators;
import java.util.Vector;
import java.util.List;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@ -37,10 +37,10 @@ public class ValidatorUserActionName extends ValidatorUniqueString
protected IWorkspace workspace = ResourcesPlugin.getWorkspace();
/**
* Use this constructor when the name must be unique. Give the
* ctor a vector containing a list of existing names to compare against.
* Use this constructor when the name must be unique.
* @param existingNameList a list of existing names to compare against.
*/
public ValidatorUserActionName(Vector existingNameList)
public ValidatorUserActionName(List existingNameList)
{
super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
init();

View file

@ -519,14 +519,6 @@ public class SystemRegistry implements ISystemRegistry
{
return getSystemProfileManager().getSystemProfileNames();
}
/**
* Return all defined profile names as a vector
*/
public Vector getAllSystemProfileNamesVector()
{
Vector v = getSystemProfileManager().getSystemProfileNamesVector();
return v;
}
/**
* Get a SystemProfile given its name

View file

@ -13,9 +13,6 @@
package org.eclipse.rse.tests.persistence;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
@ -74,15 +71,15 @@ public class PersistenceTest extends RSECoreTestCase {
/*
* There should be three profiles
*/
List profiles = registry.getSystemProfileManager().getProfiles();
assertEquals(3, profiles.size());
ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles();
assertEquals(3, profiles.length);
/*
* One should be default private profile
*/
boolean found = false;
for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
ISystemProfile p = (ISystemProfile) z.next();
for (int i = 0; i < profiles.length && !found; i++) {
ISystemProfile p = profiles[i];
found = p.isDefaultPrivate();
}
assertTrue("Default private profile not found", found);
@ -91,8 +88,8 @@ public class PersistenceTest extends RSECoreTestCase {
* One should be the team profile
*/
found = false;
for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
ISystemProfile p = (ISystemProfile) z.next();
for (int i = 0; i < profiles.length && !found; i++) {
ISystemProfile p = profiles[i];
found = p.getName().equals("Team");
}
assertTrue("Team profile not found", found);
@ -101,8 +98,8 @@ public class PersistenceTest extends RSECoreTestCase {
* One should be the test profile
*/
found = false;
for (Iterator z = profiles.iterator(); z.hasNext() && !found;) {
ISystemProfile p = (ISystemProfile) z.next();
for (int i = 0; i < profiles.length && !found; i++) {
ISystemProfile p = profiles[i];
found = p.getName().equals("bogus");
}
assertTrue("bogus profile not found", found);