Commit bc629337 authored by Skylot's avatar Skylot

fix(gui): add "use imports" option to preferences

parent 58993b97
......@@ -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();
......
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment