* feature:支持双击文件后直接打开jadx-gui * additional checks --------- Co-authored-by: Skylot <skylot@gmail.com>
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package jadx.gui;
|
||||
|
||||
import java.awt.Desktop;
|
||||
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import jadx.cli.LogHelper;
|
||||
import jadx.core.utils.files.FileUtils;
|
||||
import jadx.gui.logs.LogCollector;
|
||||
import jadx.gui.settings.JadxSettings;
|
||||
import jadx.gui.settings.JadxSettingsAdapter;
|
||||
@@ -37,6 +40,7 @@ public class JadxGUI {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
MainWindow mw = new MainWindow(settings);
|
||||
mw.init();
|
||||
registerOpenFileHandler(mw);
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error: {}", e.getMessage(), e);
|
||||
@@ -44,6 +48,19 @@ public class JadxGUI {
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerOpenFileHandler(MainWindow mw) {
|
||||
try {
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
if (desktop.isSupported(Desktop.Action.APP_OPEN_FILE)) {
|
||||
desktop.setOpenFileHandler(e -> mw.open(FileUtils.toPaths(e.getFiles())));
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
LOG.error("Failed to register open file handler", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void printSystemInfo() {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Starting jadx-gui. Version: '{}'. JVM: {} {}. OS: {} {}",
|
||||
|
||||
Reference in New Issue
Block a user