[#2009] Check for unmodified component earlier on

This commit is contained in:
SiboVG 2023-02-01 20:48:49 +00:00
parent a7e094311b
commit 58a32c41f0

View File

@ -276,16 +276,18 @@ public class RocketComponentConfig extends JPanel {
cancelButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// Don't do anything on cancel if you are editing an existing component, and it is not modified
if (!isNewComponent && parent != null && !parent.isModified()) {
ComponentConfigDialog.disposeDialog();
return;
}
// Apply the cancel operation if set to auto discard in preferences
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;
}
if (!isNewComponent && parent != null && !parent.isModified()) {
ComponentConfigDialog.disposeDialog();
return;
}
// Yes/No dialog: Are you sure you want to discard your changes?
JPanel msg = createCancelOperationContent();