X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FPlatform.java;h=f773f71093a763d66046d0da7a25559aa145447b;hb=f8d15feced5c799c79a88b865ca1a85967c203ad;hp=8efe59aa9efe7b9c4d1c088e0bdba12717b4143b;hpb=3ea876879d32bb28b81d8a12f91323b636bb5199;p=org.ibex.core.git diff --git a/src/org/xwt/Platform.java b/src/org/xwt/Platform.java index 8efe59a..f773f71 100644 --- a/src/org/xwt/Platform.java +++ b/src/org/xwt/Platform.java @@ -178,7 +178,7 @@ public class Platform { /** Returns null if XWT should always use direct connection; otherwise returns a ProxyInfo object with proxy settings */ protected synchronized HTTP.ProxyInfo _detectProxy() { return null; } - /** displays a platform-specific "open file" dialog and returns the chosen filename */ + /** displays a platform-specific "open file" dialog and returns the chosen filename, or null if the user hit cancel */ protected String _fileDialog(String suggestedFileName, boolean write) { return null; } /** returns true iff the platform has a case-sensitive filesystem */ @@ -249,25 +249,13 @@ public class Platform { /** returns true iff the platform has a case-sensitive filesystem */ public static boolean isCaseSensitive() { return platform._isCaseSensitive(); } - /** displays a platform-specific "open file" dialog and returns the chosen filename */ + /** displays a platform-specific "open file" dialog and returns the chosen filename, or null if the user hit cancel */ public static String fileDialog(String suggestedFileName, boolean write) { - // put ourselves in the background - Thread thread = Thread.currentThread(); - if (!(thread instanceof ThreadMessage)) { - if (Log.on) Log.log(Platform.class, "xwt.openFile may only be called from background threads"); - return null; - } - ThreadMessage mythread = (ThreadMessage)thread; - mythread.setPriority(Thread.MIN_PRIORITY); - mythread.done.release(); - + if (!ThreadMessage.suspendThread()) return null; try { return platform._fileDialog(suggestedFileName, write); } finally { - // okay, let ourselves be brought to the foreground - MessageQueue.add(mythread); - mythread.setPriority(Thread.NORM_PRIORITY); - mythread.go.block(); + ThreadMessage.resumeThread(); } }