mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[189749] migrate all validators that to Collection arguments
This commit is contained in:
parent
4740813d65
commit
6f97d36fad
16 changed files with 75 additions and 61 deletions
|
@ -16,12 +16,12 @@
|
|||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* This interface is implemented by any validator that
|
||||
* does uniqueness checking. Allows common code that will set the
|
||||
* list of string to check against.
|
||||
* does uniqueness checking. Allows common code that will set the
|
||||
* list of string to check against.
|
||||
*/
|
||||
public interface ISystemValidatorUniqueString
|
||||
{
|
||||
|
@ -36,10 +36,13 @@ public interface ISystemValidatorUniqueString
|
|||
public void setExistingNamesList(String[] existingList);
|
||||
/**
|
||||
* Reset the existing names list.
|
||||
* The collection used here is to be treated as
|
||||
* read-only by any implementer of this interface.
|
||||
*/
|
||||
public void setExistingNamesList(List existingList);
|
||||
public void setExistingNamesList(Collection existingList);
|
||||
/**
|
||||
* Return the existing names list. This will be a case-normalized and sorted list.
|
||||
* Return the existing names list.
|
||||
* This will be a case-normalized and sorted list.
|
||||
*/
|
||||
public String[] getExistingNamesList();
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
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(List existingNameList) {
|
||||
public ValidatorArchiveName(Collection existingNameList) {
|
||||
super(existingNameList);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -38,8 +38,9 @@ public class ValidatorCompileCommandLabel extends ValidatorUniqueString
|
|||
|
||||
/**
|
||||
* Use this constructor when you have a list of existing labels.
|
||||
* The collection will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorCompileCommandLabel(List existingLabelList)
|
||||
public ValidatorCompileCommandLabel(Collection existingLabelList)
|
||||
{
|
||||
super(existingLabelList, CASE_INSENSITIVE); // case insensitive uniqueness
|
||||
init();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
|
@ -41,7 +41,7 @@ public class ValidatorConnectionName extends ValidatorUniqueString implements IS
|
|||
* Constructor.
|
||||
* @param existingNameList list of existing names (strings) in owning profile. Can be null if not a rename operation.
|
||||
*/
|
||||
public ValidatorConnectionName(List existingNameList)
|
||||
public ValidatorConnectionName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, CASE_SENSITIVE);
|
||||
setErrorMessages(
|
||||
|
|
|
@ -13,7 +13,7 @@ package org.eclipse.rse.ui.validators;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.model.ISystemProfileManager;
|
||||
|
@ -32,7 +32,7 @@ public class ValidatorFactory {
|
|||
public static ISystemValidator getProfileNameValidator(String profileName) {
|
||||
ISystemProfileManager manager = RSECorePlugin.getTheSystemRegistry().getSystemProfileManager();
|
||||
String[] nameArray = manager.getSystemProfileNames();
|
||||
List names = new ArrayList(Arrays.asList(nameArray));
|
||||
Collection names = Arrays.asList(nameArray);
|
||||
if (profileName != null) names.remove(profileName);
|
||||
ISystemValidator nameValidator = new ValidatorProfileName(names);
|
||||
return nameValidator;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
|
@ -44,9 +44,10 @@ public class ValidatorFileName
|
|||
|
||||
/**
|
||||
* Use this constructor when the name must be unique.
|
||||
* @param existingNameList a list of existing names to compare against.
|
||||
* @param existingNameList a collection of existing names to compare against.
|
||||
* This will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorFileName(List existingNameList)
|
||||
public ValidatorFileName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, false); // case insensitive uniqueness
|
||||
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
@ -37,11 +37,12 @@ public class ValidatorFilterName
|
|||
//public static final boolean CASE_INSENSITIVE = false;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Constructor accepting a Collection.
|
||||
* @param existingList a collection of existing filter names to compare against.
|
||||
* The collection will not be modified by the validator.
|
||||
* Note that toString() is used to get the string from each item.
|
||||
*/
|
||||
public ValidatorFilterName(List existingList)
|
||||
public ValidatorFilterName(Collection existingList)
|
||||
{
|
||||
super(existingList, CASE_SENSITIVE);
|
||||
init();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
@ -34,18 +34,19 @@ public class ValidatorFilterPoolName
|
|||
public static final int MAX_FILTERPOOLNAME_LENGTH = 50;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Constructor accepting a Collection.
|
||||
* @param existingList a collection of existing filter names to compare against.
|
||||
* This will not be modified by the validator.
|
||||
* Note that toString() is used to get the string from each item.
|
||||
*/
|
||||
public ValidatorFilterPoolName(List existingList)
|
||||
public ValidatorFilterPoolName(Collection existingList)
|
||||
{
|
||||
super(existingList, CASE_SENSITIVE);
|
||||
init();
|
||||
}
|
||||
/**
|
||||
* Constructor accepting an Array.
|
||||
* @param existingList An array containing list of existing strings to compare against.
|
||||
* @param existingList An array containing a list of existing strings to compare against.
|
||||
*/
|
||||
public ValidatorFilterPoolName(String[] existingList)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.core.filters.ISystemFilterString;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
@ -39,11 +39,12 @@ public class ValidatorFilterString
|
|||
protected SystemMessage msg_Invalid;
|
||||
|
||||
/**
|
||||
* Constructor accepting a list of existing strings, as simple strings.
|
||||
* @param existingList A list of strings to compare against.
|
||||
* Constructor accepting a collection of existing strings, as simple strings.
|
||||
* @param existingList A collection of strings to compare against.
|
||||
* This will not be modified by the validator.
|
||||
* @param caseSensitive true if comparisons are to be case sensitive, false if case insensitive.
|
||||
*/
|
||||
public ValidatorFilterString(List existingList, boolean caseSensitive)
|
||||
public ValidatorFilterString(Collection existingList, boolean caseSensitive)
|
||||
{
|
||||
super(existingList, caseSensitive); // case sensitive uniqueness
|
||||
init();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
|
@ -44,9 +44,10 @@ public class ValidatorFolderName
|
|||
|
||||
/**
|
||||
* Use this constructor when the name must be unique. Give the
|
||||
* @param existingNameList a list of existing names to compare against.
|
||||
* @param existingNameList a collection of existing names to compare against.
|
||||
* This will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorFolderName(List existingNameList)
|
||||
public ValidatorFolderName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
|
||||
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
|
||||
|
@ -56,7 +57,7 @@ public class ValidatorFolderName
|
|||
}
|
||||
/**
|
||||
* Use this constructor when the name must be unique. Give the
|
||||
* ctor a string array of existing names to compare against.
|
||||
* constructor a string array of existing names to compare against.
|
||||
*/
|
||||
public ValidatorFolderName(String existingNameList[])
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class ValidatorLocalPath extends ValidatorPathName
|
|||
/**
|
||||
* Constructor for ValidatorLocalPath
|
||||
*/
|
||||
public ValidatorLocalPath(List existingNameList)
|
||||
public ValidatorLocalPath(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -40,16 +40,17 @@ public class ValidatorPathName
|
|||
|
||||
/**
|
||||
* Use this constructor when the name must be unique.
|
||||
* @param existingNameList a list of existing names to compare against.
|
||||
* @param existingNameList a collection of existing names to compare against.
|
||||
* This will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorPathName(List existingNameList)
|
||||
public ValidatorPathName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, CASE_INSENSITIVE); // case insensitive uniqueness
|
||||
init();
|
||||
}
|
||||
/**
|
||||
* Use this constructor when the name must be unique. Give the
|
||||
* ctor a string array of existing names to compare against.
|
||||
* constructor a string array of existing names to compare against.
|
||||
*/
|
||||
public ValidatorPathName(String existingNameList[])
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -36,10 +36,11 @@ public class ValidatorProfileName
|
|||
private SystemMessage reservedNameMsg;
|
||||
|
||||
/**
|
||||
* The list of existing names can be null if this is not a rename operation.
|
||||
* @param existingNameList the list of names to compare against
|
||||
* The collection of existing names can be null if this is not a rename operation.
|
||||
* @param existingNameList the collection of names to compare against.
|
||||
* This will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorProfileName(List existingNameList)
|
||||
public ValidatorProfileName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList);
|
||||
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_PROFILENAME_EMPTY),
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -42,9 +42,10 @@ public class ValidatorSystemName
|
|||
|
||||
/**
|
||||
* Use this constructor when the name must be unique.
|
||||
* @param existingNameList a list of existing names to compare against.
|
||||
* @param existingNameList a collection of existing names to compare against.
|
||||
* This collection will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorSystemName(List existingNameList)
|
||||
public ValidatorSystemName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, true); // case sensitive uniqueness
|
||||
super.setErrorMessages(RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_NAME_EMPTY),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -49,11 +49,11 @@ public class ValidatorUniqueString
|
|||
protected SystemMessage currentMessage;
|
||||
|
||||
/**
|
||||
* @param existingList a list of existing strings to compare against.
|
||||
* Note that toString() is used to get the string from each item.
|
||||
* @param existingList a collection 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(List existingList, boolean caseSensitive)
|
||||
public ValidatorUniqueString(Collection existingList, boolean caseSensitive)
|
||||
{
|
||||
this.caseSensitive = caseSensitive;
|
||||
setExistingNamesList(existingList);
|
||||
|
@ -75,15 +75,15 @@ public class ValidatorUniqueString
|
|||
RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_VALIDATE_ENTRY_NOTUNIQUE));
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
* Constructor accepting a collection and another validator to use for the syntax checking.
|
||||
* @param existingList A collection 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(List existingList, boolean caseSensitive,
|
||||
public ValidatorUniqueString(Collection existingList, boolean caseSensitive,
|
||||
ISystemValidator syntaxValidator)
|
||||
{
|
||||
this(existingList, caseSensitive);
|
||||
|
@ -121,9 +121,10 @@ public class ValidatorUniqueString
|
|||
}
|
||||
|
||||
/**
|
||||
* Reset the existing names list.
|
||||
* Reset the collection of existing names.
|
||||
* The collection will not be modified by the validator.
|
||||
*/
|
||||
public void setExistingNamesList(List newList)
|
||||
public void setExistingNamesList(Collection newList)
|
||||
{
|
||||
if (newList == null)
|
||||
existingList = null;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.validators;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -38,9 +38,10 @@ public class ValidatorUserActionName extends ValidatorUniqueString
|
|||
|
||||
/**
|
||||
* Use this constructor when the name must be unique.
|
||||
* @param existingNameList a list of existing names to compare against.
|
||||
* @param existingNameList a collection of existing names to compare against.
|
||||
* The collection will not be modified by the validator.
|
||||
*/
|
||||
public ValidatorUserActionName(List existingNameList)
|
||||
public ValidatorUserActionName(Collection existingNameList)
|
||||
{
|
||||
super(existingNameList, CASE_SENSITIVE); // case sensitive uniqueness
|
||||
init();
|
||||
|
|
Loading…
Add table
Reference in a new issue