]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/validators/MultiValidator.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.utils.ui / src / org / simantics / utils / ui / validators / MultiValidator.java
index dc985a6c2033b4c9f44a1f3e64c2e8ebd730162d..68f640bc9dcad2d4e018353e411b175f43426d16 100644 (file)
@@ -1,65 +1,65 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-/*\r
- * Created on 6.10.2005\r
- * @author Toni Kalajainen \r
- */\r
-package org.simantics.utils.ui.validators;\r
-\r
-import org.eclipse.jface.dialogs.IInputValidator;\r
-\r
-/**\r
- * Validator Multiplexer. Allows to combine multiple validators\r
- * \r
- */\r
-public class MultiValidator implements IInputValidator {\r
-\r
-    private final IInputValidator validators[];\r
-\r
-    private final AcceptType acceptType;\r
-\r
-    public enum AcceptType {\r
-        ALL_MUST_PASS, ONE_MUST_PASS\r
-    };\r
-\r
-    public MultiValidator(IInputValidator validators[], AcceptType acceptType) {\r
-        this.acceptType = acceptType;\r
-        this.validators = new IInputValidator[validators.length];\r
-        for (int i = 0; i < validators.length; i++)\r
-            this.validators[i] = validators[i];\r
-    }\r
-\r
-    public String isValid(String newText) {\r
-        if (acceptType == AcceptType.ALL_MUST_PASS) {\r
-            for (int i = 0; i < validators.length; i++) {\r
-                String result = validators[i].isValid(newText);\r
-                if (result != null)\r
-                    return result;\r
-            }\r
-            return null;\r
-        }\r
-        \r
-        if (acceptType == AcceptType.ONE_MUST_PASS) {\r
-            String error = null;\r
-            for (int i = 0; i < validators.length; i++) {\r
-                String result = validators[i].isValid(newText);                \r
-                if (result != null)\r
-                    error = result;\r
-                else\r
-                    return null;\r
-            }\r
-            return error;\r
-        }\r
-        return null;\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on 6.10.2005
+ * @author Toni Kalajainen 
+ */
+package org.simantics.utils.ui.validators;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * Validator Multiplexer. Allows to combine multiple validators
+ * 
+ */
+public class MultiValidator implements IInputValidator {
+
+    private final IInputValidator validators[];
+
+    private final AcceptType acceptType;
+
+    public enum AcceptType {
+        ALL_MUST_PASS, ONE_MUST_PASS
+    };
+
+    public MultiValidator(IInputValidator validators[], AcceptType acceptType) {
+        this.acceptType = acceptType;
+        this.validators = new IInputValidator[validators.length];
+        for (int i = 0; i < validators.length; i++)
+            this.validators[i] = validators[i];
+    }
+
+    public String isValid(String newText) {
+        if (acceptType == AcceptType.ALL_MUST_PASS) {
+            for (int i = 0; i < validators.length; i++) {
+                String result = validators[i].isValid(newText);
+                if (result != null)
+                    return result;
+            }
+            return null;
+        }
+        
+        if (acceptType == AcceptType.ONE_MUST_PASS) {
+            String error = null;
+            for (int i = 0; i < validators.length; i++) {
+                String result = validators[i].isValid(newText);                
+                if (result != null)
+                    error = result;
+                else
+                    return null;
+            }
+            return error;
+        }
+        return null;
+    }
+
+}