comparison dwtx/jface/util/SafeRunnable.d @ 104:04b47443bb01

Reworked the collection uses to make use of a wrapper collection that is compatible to the Java Collections. These new wrappers now use the tango.util.containers instead of the tango.util.collections.
author Frank Benoit <benoit@tionex.de>
date Thu, 07 Aug 2008 15:01:33 +0200
parents 46a6e0e6ccd4
children
comparison
equal deleted inserted replaced
103:2d6540440fe6 104:04b47443bb01
58 this.message = message; 58 this.message = message;
59 } 59 }
60 60
61 /* 61 /*
62 * (non-Javadoc) 62 * (non-Javadoc)
63 * 63 *
64 * @see dwtx.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) 64 * @see dwtx.core.runtime.ISafeRunnable#handleException(java.lang.Throwable)
65 */ 65 */
66 public void handleException(Exception e) { 66 public void handleException(Exception e) {
67 // Workaround to avoid interactive error dialogs during 67 // Workaround to avoid interactive error dialogs during
68 // automated testing 68 // automated testing
182 public static void run(ISafeRunnable runnable) { 182 public static void run(ISafeRunnable runnable) {
183 getRunner().run(runnable); 183 getRunner().run(runnable);
184 } 184 }
185 185
186 } 186 }
187
188 import tango.core.Tuple;
189 import tango.core.Traits;
190
191 class _DgSafeRunnableT(Dg,T...) : SafeRunnable {
192
193 alias ParameterTupleOf!(Dg) DgArgs;
194 static assert( is(DgArgs == Tuple!(T)),
195 "Delegate args not correct" );
196
197 Dg dg;
198 T t;
199
200 private this( Dg dg, T t ){
201 this.dg = dg;
202 static if( T.length > 0 ){
203 this.t = t;
204 }
205 }
206
207 public void run( ){
208 dg(t);
209 }
210 }
211
212 public _DgSafeRunnableT!(Dg,T) dgSafeRunnable(Dg,T...)( Dg dg, T args ){
213 return new _DgSafeRunnableT!(Dg,T)(dg,args);
214 }