From: lempinen Date: Mon, 28 Nov 2011 06:38:58 +0000 (+0000) Subject: Changed input validator for default value to allow also negative values X-Git-Tag: simantics-1.6~94 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=0a549722ceb257b318debc83e92a57adb36d701a;p=simantics%2Fsysdyn.git Changed input validator for default value to allow also negative values git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@23345 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java index 661be836..4ee58758 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/InputVariableTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 Association for Decentralized Information Management in + * Copyright (c) 2010, 2011 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 @@ -12,7 +12,6 @@ package org.simantics.sysdyn.ui.properties; -import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; @@ -30,7 +29,14 @@ import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyFactor import org.simantics.sysdyn.ui.properties.widgets.factories.DoublePropertyModifier; import org.simantics.sysdyn.ui.properties.widgets.factories.VariableNamePropertyModifier; import org.simantics.sysdyn.ui.properties.widgets.factories.VariableNameValidator; +import org.simantics.utils.ui.validators.DoubleValidator; +/** + * Properties for input variables: Name, default value, isOutput + * + * @author Teemu Lempinen + * + */ public class InputVariableTab extends LabelPropertyTabContributor { @@ -61,21 +67,4 @@ public class InputVariableTab extends LabelPropertyTabContributor { new IsOutputWidget(composite, support, SWT.NULL); } - - private class DoubleValidator implements IInputValidator { - - @Override - public String isValid(String newText) { - for(int i = 0; i < newText.length(); i++){ - if(!Character.isDigit(newText.charAt(i))){ - if(newText.charAt(i) != '.') { - return "Invalid character '" + newText.charAt(i) + "'"; - } else if(newText.indexOf('.') != newText.lastIndexOf('.')) { - return "There can be only one '.'"; - } - } - } - return null; - } - } }