fix(gui): add "use imports" option to preferences
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user