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.initializeApplication();
|
||||||
MacAppUtilities.setWindowCanFullScreen(frame);
|
MacAppUtilities.setWindowCanFullScreen(frame);
|
||||||
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
MacAppUtilities.setDefaultMenuBar(FileBotMenuBar.createHelp());
|
||||||
|
MacAppUtilities.setOpenFileHandler(openFiles -> eventBus.post(new FileTransferable(openFiles)));
|
||||||
} else if (isUbuntuApp()) {
|
} else if (isUbuntuApp()) {
|
||||||
// Ubuntu specific configuration
|
// Ubuntu specific configuration
|
||||||
String options = System.getenv("JAVA_TOOL_OPTIONS");
|
String options = System.getenv("JAVA_TOOL_OPTIONS");
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.swing.JMenuBar;
|
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() {
|
public static void initializeApplication() {
|
||||||
// improved UI defaults
|
// improved UI defaults
|
||||||
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
|
UIManager.put("TitledBorder.border", UIManager.getBorder("InsetBorder.aquaVariant"));
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class MainFrame extends JFrame {
|
||||||
if (builder != null) {
|
if (builder != null) {
|
||||||
if (builder.equals(selectedBuilder)) {
|
if (builder.equals(selectedBuilder)) {
|
||||||
selectedPanel = panel;
|
selectedPanel = panel;
|
||||||
} else {
|
} else if (panel.isVisible()) {
|
||||||
panel.setVisible(false);
|
panel.setVisible(false);
|
||||||
eventBus.unregister(panel);
|
eventBus.unregister(panel);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue