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

This commit is contained in:
Skylot 2018-10-29 18:14:58 +03:00
parent 58993b9799
commit bc629337d6
3 changed files with 18 additions and 1 deletions

View File

@ -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();

View File

@ -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;

View File

@ -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)