diff --git a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java index 687fcf649..037876f1b 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java @@ -26,7 +26,7 @@ public class JadxSettings extends JadxCLIArgs { private static final String USER_HOME = System.getProperty("user.home"); private static final int RECENT_FILES_COUNT = 15; - private static final int CURRENT_SETTINGS_VERSION = 4; + private static final int CURRENT_SETTINGS_VERSION = 5; private static final Font DEFAULT_FONT = FONT_HACK != null ? FONT_HACK : new RSyntaxTextArea().getFont(); @@ -206,6 +206,10 @@ public class JadxSettings extends JadxCLIArgs { this.replaceConsts = replaceConsts; } + public void setUseImports(boolean useImports) { + this.useImports = useImports; + } + public boolean isAutoStartJobs() { return autoStartJobs; } @@ -274,6 +278,10 @@ public class JadxSettings extends JadxCLIArgs { } if (fromVersion == 3) { setLangLocale(NLS.defaultLocale()); + fromVersion++; + } + if (fromVersion == 4) { + setUseImports(true); } settingsVersion = CURRENT_SETTINGS_VERSION; sync(); diff --git a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java index e814bcc5d..1090c391e 100644 --- a/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java +++ b/jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsWindow.java @@ -260,12 +260,20 @@ public class JadxSettingsWindow extends JDialog { needReload(); }); + JCheckBox useImports = new JCheckBox(); + useImports.setSelected(settings.isUseImports()); + useImports.addItemListener(e -> { + settings.setUseImports(e.getStateChange() == ItemEvent.SELECTED); + needReload(); + }); + SettingsGroup other = new SettingsGroup(NLS.str("preferences.decompile")); other.addRow(NLS.str("preferences.threads"), threadsCount); other.addRow(NLS.str("preferences.start_jobs"), autoStartJobs); other.addRow(NLS.str("preferences.showInconsistentCode"), showInconsistentCode); other.addRow(NLS.str("preferences.escapeUnicode"), escapeUnicode); other.addRow(NLS.str("preferences.replaceConsts"), replaceConsts); + other.addRow(NLS.str("preferences.useImports"), useImports); other.addRow(NLS.str("preferences.fallback"), fallback); other.addRow(NLS.str("preferences.skipResourcesDecode"), resourceDecode); return other; diff --git a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties index 4093935a9..a0705904d 100644 --- a/jadx-gui/src/main/resources/i18n/Messages_en_US.properties +++ b/jadx-gui/src/main/resources/i18n/Messages_en_US.properties @@ -81,6 +81,7 @@ preferences.fallback=Fallback mode (simple dump) preferences.showInconsistentCode=Show inconsistent code preferences.escapeUnicode=Escape unicode preferences.replaceConsts=Replace constants +preferences.useImports=Use import statements preferences.skipResourcesDecode=Don't decode resources preferences.threads=Processing threads count preferences.cfg=Generate methods CFG graphs (in 'dot' format)