comparison dwtx/jface/action/ActionContributionItem.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 c3583c6ec027
comparison
equal deleted inserted replaced
163:e5dd0081ccba 167:862b05e0334a
49 import dwtx.jface.util.Policy; 49 import dwtx.jface.util.Policy;
50 import dwtx.jface.util.PropertyChangeEvent; 50 import dwtx.jface.util.PropertyChangeEvent;
51 51
52 import dwt.dwthelper.utils; 52 import dwt.dwthelper.utils;
53 import dwt.dwthelper.Runnable; 53 import dwt.dwthelper.Runnable;
54 import tango.core.Thread; 54 import dwtx.dwtxhelper.JThread;
55 import tango.io.Stdout; 55 import tango.io.Stdout;
56 56
57 /** 57 /**
58 * A contribution item which delegates to an action. 58 * A contribution item which delegates to an action.
59 * <p> 59 * <p>
185 private void actionPropertyChange(PropertyChangeEvent e) { 185 private void actionPropertyChange(PropertyChangeEvent e) {
186 // This code should be removed. Avoid using free asyncExec 186 // This code should be removed. Avoid using free asyncExec
187 187
188 if (isVisible() && widget !is null) { 188 if (isVisible() && widget !is null) {
189 Display display = widget.getDisplay(); 189 Display display = widget.getDisplay();
190 if (display.getThread() is Thread.getThis()) { 190 if (display.getThread() is JThread.currentThread().nativeThread()) {
191 update(e.getProperty()); 191 update(e.getProperty());
192 } else { 192 } else {
193 display.asyncExec(new class(e) Runnable { 193 display.asyncExec(dgRunnable( (PropertyChangeEvent e_) {
194 PropertyChangeEvent e_; 194 update(e_.getProperty());
195 this(PropertyChangeEvent e__){ 195 }, e));
196 e_=e__;
197 }
198 public void run() {
199 update(e_.getProperty());
200 }
201 });
202 } 196 }
203 197
204 } 198 }
205 } 199 }
206 200