# HG changeset patch # User Frank Benoit # Date 1220301407 -7200 # Node ID cc2a8879c8b7236f4febf854ae1ab9285fb53d92 # Parent eb84f9418bbf21938644323d5940e215ae5e4999 InputValidator diff -r eb84f9418bbf -r cc2a8879c8b7 jface/user/PopUp.d --- a/jface/user/PopUp.d Mon Sep 01 22:24:27 2008 +0200 +++ b/jface/user/PopUp.d Mon Sep 01 22:36:47 2008 +0200 @@ -30,6 +30,7 @@ import dwtx.jface.dialogs.InputDialog; import dwtx.jface.dialogs.IMessageProvider; import dwtx.jface.dialogs.DialogTray; +import dwtx.jface.dialogs.IInputValidator; import dwtx.jface.window.ApplicationWindow; import dwtx.core.runtime.IStatus; @@ -115,9 +116,19 @@ auto dlg = new InputDialog( getShell(), "Title", - "Dialog message", + "Enter a positive number", "42", - null ); + new class() IInputValidator{ + String isValid( String newText ){ + try{ + Integer.parseInt( newText ); + return null; + } + catch( Exception e ){ + return "Not a valid number"; + } + } + } ); dlg.open(); }