Mercurial > projects > dwt2
comparison org.eclipse.jface.snippets/EclipseJfaceSnippets/org/eclipse/jface/snippets/wizard/Snippet047WizardWithLongRunningOperation.d @ 34:a8a838017920
All JFace snippets build on windows
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 23 Mar 2009 15:06:06 +0100 |
parents | c4b36186a9bc |
children |
comparison
equal
deleted
inserted
replaced
33:712f3c7f7660 | 34:a8a838017920 |
---|---|
30 import org.eclipse.swt.widgets.Composite; | 30 import org.eclipse.swt.widgets.Composite; |
31 import org.eclipse.swt.widgets.Display; | 31 import org.eclipse.swt.widgets.Display; |
32 import org.eclipse.swt.widgets.Label; | 32 import org.eclipse.swt.widgets.Label; |
33 import org.eclipse.swt.widgets.ProgressBar; | 33 import org.eclipse.swt.widgets.ProgressBar; |
34 import org.eclipse.swt.widgets.Shell; | 34 import org.eclipse.swt.widgets.Shell; |
35 | 35 import org.eclipse.jface.operation.IRunnableWithProgress; |
36 import java.lang.all; | 36 import java.lang.all; |
37 import java.utils.ArrayList; | 37 import java.util.ArrayList; |
38 | 38 |
39 import java.lang.Thread; | 39 import java.lang.Thread; |
40 import tango.text.convert.Format; | 40 import tango.text.convert.Format; |
41 | 41 |
42 import org.eclipse.jface.operation.ModalContext; | 42 import org.eclipse.jface.operation.ModalContext; |
145 if (loadingType == 2) { | 145 if (loadingType == 2) { |
146 mt.bar.setMaximum(10); | 146 mt.bar.setMaximum(10); |
147 } | 147 } |
148 | 148 |
149 setControl(mt.comp); | 149 setControl(mt.comp); |
150 | 150 dialog.run( true, true, dgIRunnableWithProgress(&mt.threadWork)); |
151 ModalContext.run( dgRunnable(&mt.threadWork), true, getProgressMonitor(), getShell().getDisplay() ); | |
152 | |
153 //Thread t = new Thread(&mt.threadWork); | |
154 | |
155 // t.start(); | |
156 } | 151 } |
157 class MyThread { | 152 class MyThread { |
158 private Composite parent; | 153 private Composite parent; |
159 private Composite barContainer; | 154 private Composite barContainer; |
160 private Composite comp; | 155 private Composite comp; |
238 return Format("Item-{}", index); | 233 return Format("Item-{}", index); |
239 } | 234 } |
240 } | 235 } |
241 | 236 |
242 static Shell shell; | 237 static Shell shell; |
238 static WizardDialog dialog; | |
243 public static void main(String[] args) { | 239 public static void main(String[] args) { |
244 Display display = new Display(); | 240 Display display = new Display(); |
245 | 241 |
246 shell = new Shell(display); | 242 shell = new Shell(display); |
247 shell.setLayout(new FillLayout()); | 243 shell.setLayout(new FillLayout()); |
249 Button b = new Button(shell, SWT.PUSH); | 245 Button b = new Button(shell, SWT.PUSH); |
250 b.setText("Load in one Chunk"); | 246 b.setText("Load in one Chunk"); |
251 b.addSelectionListener(new class SelectionAdapter { | 247 b.addSelectionListener(new class SelectionAdapter { |
252 | 248 |
253 public void widgetSelected(SelectionEvent e) { | 249 public void widgetSelected(SelectionEvent e) { |
254 WizardDialog dialog = new WizardDialog(shell, new MyWizard(1)); | 250 dialog = new WizardDialog(shell, new MyWizard(1)); |
255 dialog.open(); | 251 dialog.open(); |
256 } | 252 } |
257 | 253 |
258 }); | 254 }); |
259 | 255 |
260 b = new Button(shell, SWT.PUSH); | 256 b = new Button(shell, SWT.PUSH); |
261 b.setText("Load Item by Item"); | 257 b.setText("Load Item by Item"); |
262 b.addSelectionListener(new class SelectionAdapter { | 258 b.addSelectionListener(new class SelectionAdapter { |
263 | 259 |
264 public void widgetSelected(SelectionEvent e) { | 260 public void widgetSelected(SelectionEvent e) { |
265 WizardDialog dialog = new WizardDialog(shell, new MyWizard(2)); | 261 dialog = new WizardDialog(shell, new MyWizard(2)); |
266 dialog.open(); | 262 dialog.open(); |
267 } | 263 } |
268 | 264 |
269 }); | 265 }); |
270 | 266 |