Mercurial > projects > dwt-addons
diff dwtx/jface/operation/ModalContext.d @ 167:862b05e0334a
Add a wrapper for Thread
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 09 Sep 2008 15:59:16 +0200 |
parents | 7ffeace6c47f |
children |
line wrap: on
line diff
--- a/dwtx/jface/operation/ModalContext.d Mon Sep 08 01:01:30 2008 +0200 +++ b/dwtx/jface/operation/ModalContext.d Tue Sep 09 15:59:16 2008 +0200 @@ -27,7 +27,7 @@ import dwt.dwthelper.utils; import dwt.dwthelper.Runnable; -import tango.core.Thread; +import dwtx.dwtxhelper.JThread; import tango.io.Stdout; /** @@ -67,7 +67,7 @@ /** * Thread which runs the modal context. */ - private static class ModalContextThread : Thread { + private static class ModalContextThread : JThread { /** * The operation to be run. */ @@ -98,7 +98,7 @@ * * @since 3.1 */ - private Thread callingThread; + private JThread callingThread; /** * Creates a new modal context. @@ -113,18 +113,18 @@ */ private this(IRunnableWithProgress operation, IProgressMonitor monitor, Display display) { - super(&run2); //$NON-NLS-1$ + super(); //$NON-NLS-1$ Assert.isTrue(monitor !is null && display !is null); runnable = operation; progressMonitor = new AccumulatingProgressMonitor(monitor, display); this.display = display; - this.callingThread = Thread.getThis(); + this.callingThread = JThread.currentThread(); } /* * (non-Javadoc) Method declared on Thread. */ - public /+override+/ void run2() { + public override void run() { try { if (runnable !is null) { runnable.run(progressMonitor); @@ -156,11 +156,9 @@ // Make sure that all events in the asynchronous event queue // are dispatched. - display.syncExec(new class() Runnable { - public void run() { - // do nothing - } - }); + display.syncExec(dgRunnable( { + // do nothing + } )); // Stop event dispatching continueEventDispatching = false; @@ -276,7 +274,7 @@ * context is active. */ private static ModalContextThread getCurrentModalContextThread() { - Thread t = Thread.getThis(); + JThread t = JThread.currentThread(); if ( auto r = cast(ModalContextThread)t ) { return r; } @@ -307,7 +305,7 @@ * @return <code>true</code> if the given thread is running a modal * context, <code>false</code> if not */ - public static bool isModalContextThread(Thread thread) { + public static bool isModalContextThread(JThread thread) { return (cast(ModalContextThread)thread) !is null; } @@ -428,7 +426,7 @@ * the {@link Thread} being switched to */ static Exception invokeThreadListener(IThreadListener listener, - Thread switchingThread) { + JThread switchingThread) { try { listener.threadChange(switchingThread); // } catch (ThreadDeath e) {