Don't clear config listeners on document undo

This commit is contained in:
SiboVG 2023-01-08 23:36:06 +01:00
parent 7ea17b01d2
commit b2d19181b1
2 changed files with 3 additions and 1 deletions

View File

@ -46,7 +46,7 @@ public class ComponentConfigDialog extends JDialog implements ComponentChangeLis
private RocketComponentConfig configurator = null;
private boolean isModified = false;
private final boolean isNewComponent;
protected static boolean clearConfigListeners = true;
public static boolean clearConfigListeners = true;
private static String previousSelectedTab = null; // Name of the previous selected tab

View File

@ -277,6 +277,7 @@ public class RocketComponentConfig extends JPanel {
@Override
public void actionPerformed(ActionEvent arg0) {
if (preferences.getBoolean(IGNORE_DISCARD_EDITING_WARNING, false)) {
ComponentConfigDialog.clearConfigListeners = false; // Undo action => config listeners of new component will be cleared
ComponentConfigDialog.disposeDialog();
document.undo();
return;
@ -291,6 +292,7 @@ public class RocketComponentConfig extends JPanel {
int resultYesNo = JOptionPane.showConfirmDialog(RocketComponentConfig.this, msg,
trans.get("RocketCompCfg.CancelOperation.title"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
if (resultYesNo == JOptionPane.YES_OPTION) {
ComponentConfigDialog.clearConfigListeners = false; // Undo action => config listeners of new component will be cleared
ComponentConfigDialog.disposeDialog();
document.undo();
}