mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 00:38:52 -05:00
* cleanup
This commit is contained in:
parent
3af7e217a0
commit
9c05de570b
@ -52,40 +52,36 @@ public class MacAppUtilities {
|
|||||||
final SecondaryLoop secondaryLoop = eventQueue.createSecondaryLoop();
|
final SecondaryLoop secondaryLoop = eventQueue.createSecondaryLoop();
|
||||||
|
|
||||||
// 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)
|
// 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() {
|
dispatch_async(() -> {
|
||||||
|
Pointer pool = createAutoreleasePool();
|
||||||
|
Proxy peer = objc().sendProxy("NSOpenPanel", "openPanel");
|
||||||
|
peer.send("retain");
|
||||||
|
|
||||||
@Override
|
peer.send("setTitle:", title);
|
||||||
public void run() {
|
peer.send("setAllowsMultipleSelection:", multipleMode ? 1 : 0);
|
||||||
Pointer pool = createAutoreleasePool();
|
peer.send("setCanChooseDirectories:", canChooseDirectories ? 1 : 0);
|
||||||
Proxy peer = objc().sendProxy("NSOpenPanel", "openPanel");
|
peer.send("setCanChooseFiles:", canChooseFiles ? 1 : 0);
|
||||||
peer.send("retain");
|
|
||||||
|
|
||||||
peer.send("setTitle:", title);
|
if (allowedFileTypes != null) {
|
||||||
peer.send("setAllowsMultipleSelection:", multipleMode ? 1 : 0);
|
Proxy mutableArray = objc().sendProxy("NSMutableArray", "arrayWithCapacity:", allowedFileTypes.length);
|
||||||
peer.send("setCanChooseDirectories:", canChooseDirectories ? 1 : 0);
|
for (String type : allowedFileTypes) {
|
||||||
peer.send("setCanChooseFiles:", canChooseFiles ? 1 : 0);
|
mutableArray.send("addObject:", type);
|
||||||
|
|
||||||
if (allowedFileTypes != null) {
|
|
||||||
Proxy mutableArray = objc().sendProxy("NSMutableArray", "arrayWithCapacity:", allowedFileTypes.length);
|
|
||||||
for (String type : allowedFileTypes) {
|
|
||||||
mutableArray.send("addObject:", type);
|
|
||||||
}
|
|
||||||
peer.send("setAllowedFileTypes:", mutableArray);
|
|
||||||
}
|
}
|
||||||
|
peer.send("setAllowedFileTypes:", mutableArray);
|
||||||
if (peer.sendInt("runModal") != 0) {
|
|
||||||
Proxy nsArray = peer.getProxy("URLs");
|
|
||||||
int size = nsArray.sendInt("count");
|
|
||||||
for (int i = 0; i < size; i++) {
|
|
||||||
Proxy url = nsArray.sendProxy("objectAtIndex:", i);
|
|
||||||
String path = url.sendString("path");
|
|
||||||
result.add(new File(path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drainAutoreleasePool(pool);
|
|
||||||
secondaryLoop.exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (peer.sendInt("runModal") != 0) {
|
||||||
|
Proxy nsArray = peer.getProxy("URLs");
|
||||||
|
int size = nsArray.sendInt("count");
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
Proxy url = nsArray.sendProxy("objectAtIndex:", i);
|
||||||
|
String path = url.sendString("path");
|
||||||
|
result.add(new File(path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drainAutoreleasePool(pool);
|
||||||
|
secondaryLoop.exit();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enter the loop to block the current event handler, but leave UI responsive
|
// Enter the loop to block the current event handler, but leave UI responsive
|
||||||
|
Loading…
Reference in New Issue
Block a user