comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet44.d @ 78:0a55d2d5a946

Added file for databinding
author Frank Benoit <benoit@tionex.de>
date Tue, 14 Apr 2009 11:35:29 +0200
parents 69b1fa94a4a8
children 9f4c18c268b2
comparison
equal deleted inserted replaced
76:f05e6e8b2f2d 78:0a55d2d5a946
26 import org.eclipse.swt.widgets.Listener; 26 import org.eclipse.swt.widgets.Listener;
27 import org.eclipse.swt.widgets.Shell; 27 import org.eclipse.swt.widgets.Shell;
28 28
29 import java.lang.all; 29 import java.lang.all;
30 30
31 import org.eclipse.core.runtime.jobs.Job;
32 import org.eclipse.core.runtime.IProgressMonitor;
33 import org.eclipse.core.runtime.IStatus;
34 import org.eclipse.core.runtime.Status;
35 import org.eclipse.core.runtime.jobs.IJobChangeListener;
36 import tango.io.Stdout;
37
38 class MyJob : Job {
39 this(char[] name) {
40 super(name);
41 }
42 public IStatus run(IProgressMonitor monitor) {
43 Stdout.formatln("doing job");
44 return Status.OK_STATUS;
45 }
46 }
47
48
31 void main (String [] args) { 49 void main (String [] args) {
32 Display display = new Display (); 50 Display display = new Display ();
33 Cursor cursor = new Cursor (display, SWT.CURSOR_HAND); 51 Cursor cursor = new Cursor (display, SWT.CURSOR_HAND);
34 Shell shell = new Shell (display); 52 Shell shell = new Shell (display);
35 shell.open (); 53 shell.open ();
36 Button b = new Button (shell, 0); 54 Button b = new Button (shell, 0);
37 b.setBounds (10, 10, 200, 200); 55 b.setBounds (10, 10, 200, 200);
38 b.addListener (SWT.Selection, new class() Listener{ 56 b.addListener (SWT.Selection, new class() Listener{
39 public void handleEvent (Event e) { 57 public void handleEvent (Event e) {
40 b.setCursor (cursor); 58 //b.setCursor (cursor);
59 auto job = new MyJob("test");
60 job.schedule();
61 job.join;
62 Stdout.formatln("job done");
41 } 63 }
42 }); 64 });
43 while (!shell.isDisposed ()) { 65 while (!shell.isDisposed ()) {
44 if (!display.readAndDispatch ()) display.sleep (); 66 if (!display.readAndDispatch ()) display.sleep ();
45 } 67 }