comparison org.eclipse.jface.examples.databinding/src/org/eclipse/jface/examples/databinding/snippets/Snippet014WizardDialog.d @ 100:e884642ad36e

more work on examples
author Frank Benoit <benoit@tionex.de>
date Thu, 23 Apr 2009 00:02:38 +0200
parents 5d5bd660917f
children
comparison
equal deleted inserted replaced
99:5d5bd660917f 100:e884642ad36e
42 /** 42 /**
43 * Creates and opens a wizard dialog with two simple wizard pages. 43 * Creates and opens a wizard dialog with two simple wizard pages.
44 */ 44 */
45 public class Snippet014WizardDialog { 45 public class Snippet014WizardDialog {
46 46
47 static class FirstWizardPage extends WizardPage { 47 static class FirstWizardPage : WizardPage {
48 private final class SingleDigitValidator implements IValidator { 48 private final class SingleDigitValidator : IValidator {
49 public IStatus validate(Object value) { 49 public IStatus validate(Object value) {
50 Integer i = (Integer) value; 50 Integer i = (Integer) value;
51 if (i == null) { 51 if (i is null) {
52 return ValidationStatus 52 return ValidationStatus
53 .info("Please enter a value."); 53 .info("Please enter a value.");
54 } 54 }
55 if (i.intValue() < 0 || i.intValue() > 9) { 55 if (i.intValue() < 0 || i.intValue() > 9) {
56 return ValidationStatus 56 return ValidationStatus
83 composite); 83 composite);
84 setControl(composite); 84 setControl(composite);
85 } 85 }
86 } 86 }
87 87
88 static class SecondWizardPage extends WizardPage { 88 static class SecondWizardPage : WizardPage {
89 protected SecondWizardPage() { 89 protected SecondWizardPage() {
90 super("Second", "Second Page", ImageDescriptor 90 super("Second", "Second Page", ImageDescriptor
91 .createFromImage(new Image(Display.getDefault(), 16, 16))); 91 .createFromImage(new Image(Display.getDefault(), 16, 16)));
92 } 92 }
93 93
112 static class SampleWizardModel { 112 static class SampleWizardModel {
113 IObservableValue intValue = new WritableValue(null, Integer.class); 113 IObservableValue intValue = new WritableValue(null, Integer.class);
114 IObservableValue dateValue = new WritableValue(null, Date.class); 114 IObservableValue dateValue = new WritableValue(null, Date.class);
115 } 115 }
116 116
117 static class SampleWizard extends Wizard { 117 static class SampleWizard : Wizard {
118 118
119 private SampleWizardModel model = new SampleWizardModel(); 119 private SampleWizardModel model = new SampleWizardModel();
120 120
121 public void addPages() { 121 public void addPages() {
122 addPage(new FirstWizardPage()); 122 addPage(new FirstWizardPage());
148 IWizard wizard = new SampleWizard(); 148 IWizard wizard = new SampleWizard();
149 WizardDialog dialog = new WizardDialog(null, wizard); 149 WizardDialog dialog = new WizardDialog(null, wizard);
150 dialog.open(); 150 dialog.open();
151 // The SWT event loop 151 // The SWT event loop
152 Display display = Display.getCurrent(); 152 Display display = Display.getCurrent();
153 while (dialog.getShell() != null 153 while (dialog.getShell() !is null
154 && !dialog.getShell().isDisposed()) { 154 && !dialog.getShell().isDisposed()) {
155 if (!display.readAndDispatch()) { 155 if (!display.readAndDispatch()) {
156 display.sleep(); 156 display.sleep();
157 } 157 }
158 } 158 }