Changeset 162:cc2a8879c8b7

Show
Ignore:
Timestamp:
09/01/08 16:36:47 (3 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

InputValidator?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • jface/user/PopUp.d

    r149 r162  
    3131import dwtx.jface.dialogs.IMessageProvider; 
    3232import dwtx.jface.dialogs.DialogTray; 
     33import dwtx.jface.dialogs.IInputValidator; 
    3334 
    3435import dwtx.jface.window.ApplicationWindow; 
     
    116117            getShell(), 
    117118            "Title", 
    118             "Dialog message", 
     119            "Enter a positive number", 
    119120            "42", 
    120             null ); 
     121            new class() IInputValidator{ 
     122                String isValid( String newText ){ 
     123                    try{ 
     124                        Integer.parseInt( newText ); 
     125                        return null; 
     126                    } 
     127                    catch( Exception e ){ 
     128                        return "Not a valid number"; 
     129                    } 
     130                } 
     131            } ); 
    121132        dlg.open(); 
    122133    }