|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.ui.validators.ValidatorUniqueString
public class ValidatorUniqueString
This class is used in dialogs that prompt for a string that has to be unique. Unless you use the constructor that takes another IInputValidator as input, no syntax checking is done other than checking the input is non-empty and unique. The IInputValidator interface is implemented by our parent and it is used by jface's InputDialog class and property sheet window.
Field Summary | |
---|---|
static boolean |
CASE_INSENSITIVE
|
static boolean |
CASE_SENSITIVE
|
protected boolean |
caseSensitive
|
protected SystemMessage |
currentMessage
|
protected String[] |
existingList
|
protected SystemMessage |
msg_Empty
|
protected SystemMessage |
msg_NonUnique
|
static char |
QUOTE
|
protected ISystemValidator |
syntaxValidator
|
protected boolean |
useUpperCase
|
Constructor Summary | |
---|---|
ValidatorUniqueString(Collection existingList,
boolean caseSensitive)
|
|
ValidatorUniqueString(Collection existingList,
boolean caseSensitive,
ISystemValidator syntaxValidator)
Constructor accepting a collection and another validator to use for the syntax checking. |
|
ValidatorUniqueString(String[] existingList,
boolean caseSensitive)
Constructor accepting an Array. |
|
ValidatorUniqueString(String[] existingList,
boolean caseSensitive,
ISystemValidator syntaxValidator)
Constructor accepting an Array and another validator to use for the syntax checking. |
Method Summary | |
---|---|
protected String |
doMessageSubstitution(SystemMessage msg,
String substitution)
Helper method to substitute data into a message |
String[] |
getExistingNamesList()
Return the existing names list. |
int |
getMaximumNameLength()
Return the max length for this name, or -1 if no max |
SystemMessage |
getSystemMessage()
When isValid returns non-null, call this to get the SystemMessage object for the error versus the simple string message. |
protected String |
getSystemMessageText(SystemMessage msg)
Helper method to set the current system message and return its level one text |
SystemMessage |
isSyntaxOk(String newText)
Override in child to do your own syntax checking. |
String |
isValid(Object newValue)
As required by ICellEditor |
String |
isValid(String newText)
Deprecated. You should be using validate(String) and SystemMessage objects |
static String |
quotedToLowerCase(String input)
Special-case way to fold non-quoted parts of a string to lowercase |
void |
setCaseSensitive(boolean caseSensitive)
Reset whether this is a case-sensitive list or not |
void |
setErrorMessages(SystemMessage msg_Empty,
SystemMessage msg_NonUnique)
Supply your own error message text. |
void |
setExistingNamesList(Collection newList)
Reset the collection of existing names. |
void |
setExistingNamesList(String[] existingList)
Reset the existing names list. |
void |
setUseUpperCase()
For case-insensitive, we typically fold to lowercase, affecting what this user sees in the substitution value of error messages. |
String |
toString()
|
SystemMessage |
validate(String text)
For convenience, this is a shortcut to calling:
if (isValid(text) ! |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean CASE_SENSITIVE
public static final boolean CASE_INSENSITIVE
public static final char QUOTE
protected ISystemValidator syntaxValidator
protected boolean caseSensitive
protected boolean useUpperCase
protected String[] existingList
protected SystemMessage msg_Empty
protected SystemMessage msg_NonUnique
protected SystemMessage currentMessage
Constructor Detail |
---|
public ValidatorUniqueString(Collection existingList, boolean caseSensitive)
existingList
- a collection of existing strings to compare against.
Note that toString() is used to get the string from each item.caseSensitive
- true if comparisons are to be case sensitive, false if case insensitive.public ValidatorUniqueString(String[] existingList, boolean caseSensitive)
existingList
- An array containing list of existing strings to compare against.caseSensitive
- true if comparisons are to be case sensitive, false if case insensitive.public ValidatorUniqueString(Collection existingList, boolean caseSensitive, ISystemValidator syntaxValidator)
existingList
- A collection of existing strings to compare against.
Note that toString() is used to get the string from each item.caseSensitive
- true if comparisons are to be case sensitive, false if case insensitive.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(String[] existingList, boolean caseSensitive, ISystemValidator syntaxValidator)
existingList
- An array containing list of existing strings to compare against.caseSensitive
- true if comparisons are to be case sensitive, false if case insensitive.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.Method Detail |
---|
public void setCaseSensitive(boolean caseSensitive)
setCaseSensitive
in interface ISystemValidatorUniqueString
public void setUseUpperCase()
public void setExistingNamesList(Collection newList)
setExistingNamesList
in interface ISystemValidatorUniqueString
public void setExistingNamesList(String[] existingList)
setExistingNamesList
in interface ISystemValidatorUniqueString
public String[] getExistingNamesList()
getExistingNamesList
in interface ISystemValidatorUniqueString
public static String quotedToLowerCase(String input)
public void setErrorMessages(SystemMessage msg_Empty, SystemMessage msg_NonUnique)
msg_Empty
- error message when entry field is empty or null if to keep the defaultmsg_NonUnique
- error message when value entered is not unique or null if to keep the defaultpublic SystemMessage isSyntaxOk(String newText)
public String toString()
toString
in class Object
protected String doMessageSubstitution(SystemMessage msg, String substitution)
protected String getSystemMessageText(SystemMessage msg)
public String isValid(String newText)
validate(String)
and SystemMessage objects
null
or a string of length zero indicates
that the value is valid.
Note this is called per keystroke, by the platform.
isValid
in interface IInputValidator
public String isValid(Object newValue)
isValid
in interface ICellEditorValidator
public int getMaximumNameLength()
getMaximumNameLength
in interface ISystemValidator
public SystemMessage getSystemMessage()
getSystemMessage
in interface ISystemValidator
public SystemMessage validate(String text)
if (isValid(text) != null)
msg = getSystemMessage();
validate
in interface ISystemValidator
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |