Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-05-07 11:15:03 +0000
committerTobias Schwarz2013-05-07 11:15:03 +0000
commita734f6827dc5b4708821bc664247e4181bb0e199 (patch)
treed14199b852217f5dd18b245fd7bc85fbb1e2ea17 /target_explorer
parent7ba0526e8cc7be7a941d577ffa4dbe1337b3c7c3 (diff)
downloadorg.eclipse.tcf-a734f6827dc5b4708821bc664247e4181bb0e199.tar.gz
org.eclipse.tcf-a734f6827dc5b4708821bc664247e4181bb0e199.tar.xz
org.eclipse.tcf-a734f6827dc5b4708821bc664247e4181bb0e199.zip
Target Explorer: add new validator attribute
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/HexValidator.java8
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/PortNumberValidator.java6
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/RegexValidator.java9
3 files changed, 15 insertions, 8 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/HexValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/HexValidator.java
index 0b9a1d211..b1fc5f7b7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/HexValidator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/HexValidator.java
@@ -21,19 +21,19 @@ public class HexValidator extends RegexValidator {
/**
* Allows entering decimal numbers.
*/
- public static final int ATTR_ALLOW_DECIMAL = 2;
+ public static final int ATTR_ALLOW_DECIMAL = 4;
/**
* Enables negative decimal numbers. Has effect only if {@link #ATTR_ALLOW_DECIMAL}
* is set as well.
*/
- public static final int ATTR_ALLOW_NEGATIVE_DECIMAL = 4;
+ public static final int ATTR_ALLOW_NEGATIVE_DECIMAL = 8;
/**
* Enables negative hexadecimal numbers.
*/
- public static final int ATTR_ALLOW_NEGATIVE_HEX = 8;
- // next attribute should start with 2^4
+ public static final int ATTR_ALLOW_NEGATIVE_HEX = 16;
+ // next attribute should start with 2^5
// keys for error messages
public static final String ERROR_INVALID_VALUE_RANGE = "HexValidator_Error_InvalidValueRange"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/PortNumberValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/PortNumberValidator.java
index fa1b402f4..ecf120392 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/PortNumberValidator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/PortNumberValidator.java
@@ -21,9 +21,9 @@ public class PortNumberValidator extends NumberValidator {
protected static final String PORT_REGEX_DEC = "([0-9]{1,5})"; //$NON-NLS-1$
protected static final String PORT_REGEX_HEX = "(0(x|X)[0-9a-fA-F]{1,4})"; //$NON-NLS-1$
- public static final int ATTR_HEX = 2;
- public static final int ATTR_DECIMAL = 4;
- // next attribute should start with 2^3
+ public static final int ATTR_HEX = 4;
+ public static final int ATTR_DECIMAL = 8;
+ // next attribute should start with 2^4
/**
* Constructor
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/RegexValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/RegexValidator.java
index 1cb5f1d13..68981542e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/RegexValidator.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.controls/src/org/eclipse/tcf/te/ui/controls/validator/RegexValidator.java
@@ -15,6 +15,12 @@ package org.eclipse.tcf.te.ui.controls.validator;
*/
public class RegexValidator extends Validator {
+ /**
+ * Attribute to check if the text to validate does not match the given regex.
+ */
+ public static final int ATTR_NOT_REGEX = 2;
+ // next attribute should start with 2^2
+
// keys for info messages
public static final String INFO_MISSING_VALUE = "RegexValidator_Information_MissingValue"; //$NON-NLS-1$
@@ -49,7 +55,8 @@ public class RegexValidator extends Validator {
return true;
}
- if (!newText.matches(regex)) {
+ boolean match = newText.matches(regex);
+ if ((!isAttribute(ATTR_NOT_REGEX) && !match) || (isAttribute(ATTR_NOT_REGEX) && match)) {
setMessage(getMessageText(ERROR_INVALID_VALUE), getMessageTextType(ERROR_INVALID_VALUE, ERROR));
return getMessageType() != ERROR;
}

Back to the top