Commit ac1d1a58 authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

fix(gui): disable all components on saving the settings (PR #586)

parent 74a72a5c
......@@ -83,18 +83,22 @@ public class JadxSettingsWindow extends JDialog {
JButton saveBtn = new JButton(NLS.str("preferences.save"));
saveBtn.addActionListener(event -> {
settings.sync();
if (needReload) {
mainWindow.reOpenFile();
}
if (!settings.getLangLocale().equals(prevLang)) {
JOptionPane.showMessageDialog(
this,
NLS.str("msg.language_changed", settings.getLangLocale()),
NLS.str("msg.language_changed_title", settings.getLangLocale()),
JOptionPane.INFORMATION_MESSAGE
);
}
dispose();
enableComponents(this, false);
SwingUtilities.invokeLater(() -> {
if (needReload) {
mainWindow.reOpenFile();
}
if (!settings.getLangLocale().equals(prevLang)) {
JOptionPane.showMessageDialog(
this,
NLS.str("msg.language_changed", settings.getLangLocale()),
NLS.str("msg.language_changed_title", settings.getLangLocale()),
JOptionPane.INFORMATION_MESSAGE
);
}
dispose();
});
});
JButton cancelButton = new JButton(NLS.str("preferences.cancel"));
cancelButton.addActionListener(event -> {
......@@ -139,6 +143,15 @@ public class JadxSettingsWindow extends JDialog {
getRootPane().setDefaultButton(saveBtn);
}
private static void enableComponents(Container container, boolean enable) {
for (Component component : container.getComponents()) {
if (component instanceof Container) {
enableComponents((Container) component, enable);
}
component.setEnabled(enable);
}
}
private SettingsGroup makeDeobfuscationGroup() {
JCheckBox deobfOn = new JCheckBox();
deobfOn.setSelected(settings.isDeobfuscationOn());
......
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