Changeset 162:cc2a8879c8b7
- 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
| r149 |
r162 |
|
| 31 | 31 | import dwtx.jface.dialogs.IMessageProvider; |
|---|
| 32 | 32 | import dwtx.jface.dialogs.DialogTray; |
|---|
| | 33 | import dwtx.jface.dialogs.IInputValidator; |
|---|
| 33 | 34 | |
|---|
| 34 | 35 | import dwtx.jface.window.ApplicationWindow; |
|---|
| … | … | |
| 116 | 117 | getShell(), |
|---|
| 117 | 118 | "Title", |
|---|
| 118 | | "Dialog message", |
|---|
| | 119 | "Enter a positive number", |
|---|
| 119 | 120 | "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 | } ); |
|---|
| 121 | 132 | dlg.open(); |
|---|
| 122 | 133 | } |
|---|