Support Mac Drop-on-Dock file events
This commit is contained in:
parent
adda35edd4
commit
52e96f4890
|
@ -232,6 +232,7 @@ public class Main {
|
|||
MacAppUtilities.initializeApplication();
|
||||
MacAppUtilities.setWindowCanFullScreen(frame);
|
||||
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
||||
MacAppUtilities.setOpenFileHandler(openFiles -> eventBus.post(new FileTransferable(openFiles)));
|
||||
} else if (isUbuntuApp()) {
|
||||
// Ubuntu specific configuration
|
||||
String options = System.getenv("JAVA_TOOL_OPTIONS");
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
@ -135,6 +136,14 @@ public class MacAppUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setOpenFileHandler(Consumer<List<File>> handler) {
|
||||
try {
|
||||
Application.getApplication().setOpenFileHandler(evt -> handler.accept(evt.getFiles()));
|
||||
} catch (Throwable t) {
|
||||
debug.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initializeApplication() {
|
||||
// improved UI defaults
|
||||
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
|
||||
|
|
|
@ -179,7 +179,7 @@ public class MainFrame extends JFrame {
|
|||
if (builder != null) {
|
||||
if (builder.equals(selectedBuilder)) {
|
||||
selectedPanel = panel;
|
||||
} else {
|
||||
} else if (panel.isVisible()) {
|
||||
panel.setVisible(false);
|
||||
eventBus.unregister(panel);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue