]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/chart/property/TimeInputValidator.java
Externalize strings
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / chart / property / TimeInputValidator.java
index dd7bf1f8a7255e2e193986f58e74b401ce04aacd..d8d48ca2ca5fad9319a34a8521564e5576a814ef 100644 (file)
@@ -16,6 +16,7 @@ import java.text.Format;
 import java.text.ParseException;
 
 import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.osgi.util.NLS;
 import org.simantics.utils.format.TimeFormat;
 
 /**
@@ -23,7 +24,7 @@ import org.simantics.utils.format.TimeFormat;
  */
 public class TimeInputValidator implements IInputValidator {
        
-       Format decimalFormat = new DecimalFormat("0");
+       Format decimalFormat = new DecimalFormat("0"); //$NON-NLS-1$
 
        Format timeFormat = new TimeFormat(100, 0);
        
@@ -36,7 +37,7 @@ public class TimeInputValidator implements IInputValidator {
        public Double parse(String text) {
                if (text==null) return null;
                text = text.trim();
-               if (text.equals("")) return null;
+               if (text.equals("")) return null; //$NON-NLS-1$
 
                try {
                        return (Double) timeFormat.parseObject(text);
@@ -55,26 +56,28 @@ public class TimeInputValidator implements IInputValidator {
 
        @Override
        public String isValid(String text) {
-               if (text==null) return "Null";
+               if (text == null)
+                       return "Null"; //$NON-NLS-1$
                text = text.trim();
-               if (text.equals("")) return null;
+               if (text.equals("")) //$NON-NLS-1$
+                       return null;
 
                try {
                        Double d = (Double) timeFormat.parseObject(text);
-                       
-                       if (d != null && d.doubleValue()<minValue)
-                               return "The value must be at least "+minValue+" seconds.";
+
+                       if (d != null && d.doubleValue() < minValue)
+                               return NLS.bind(Messages.TimeInputValidator_ValueRange, minValue);
                        return null;
                } catch (ParseException e) {
                }
-               
+
                try {
                        Number n = (Number) decimalFormat.parseObject(text);
-                       if (n != null && n.doubleValue()<minValue)
-                               return "The value must be at least "+minValue+" seconds.";
+                       if (n != null && n.doubleValue() < minValue)
+                               return NLS.bind(Messages.TimeInputValidator_ValueRange, minValue); 
                        return null;
                } catch (ParseException e) {
-                       return "Unable to parse specified value as a measure of time.";
+                       return "Unable to parse specified value as a measure of time."; //$NON-NLS-1$
                }
        }