This commit is contained in:
Reinhard Pointner 2015-11-14 15:47:20 +00:00
parent 2f61d6c858
commit 0474d73c97
1 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,8 @@ import javax.swing.UIManager;
import ca.weblite.objc.Client;
import ca.weblite.objc.Proxy;
import com.sun.jna.Pointer;
public class MacAppUtilities {
private static Client _objc;
@ -52,9 +54,11 @@ public class MacAppUtilities {
// WARNING: dispatch_sync seems to work on most Mac always causes a deadlock and freezes the application on others (in particular MBP with 2 graphics chips)
dispatch_async(new Runnable() {
@Override
public void run() {
Pointer pool = createAutoreleasePool();
Proxy peer = objc().sendProxy("NSOpenPanel", "openPanel");
peer.send("retain");
peer.send("setTitle:", title);
peer.send("setAllowsMultipleSelection:", multipleMode ? 1 : 0);
peer.send("setCanChooseDirectories:", canChooseDirectories ? 1 : 0);
@ -78,6 +82,7 @@ public class MacAppUtilities {
}
}
drainAutoreleasePool(pool);
secondaryLoop.exit();
}
});