show close confirmation

This commit is contained in:
honfika@gmail.com
2014-12-22 18:50:46 +01:00
parent 11af78ad3d
commit 04ca818045
7 changed files with 53 additions and 0 deletions

View File

@@ -657,6 +657,21 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
public void closeAll() {
boolean modified = false;
for (SWFList swfList: swfs) {
for (SWF swf : swfList) {
if (swf.isModified()) {
modified = true;
}
}
}
if (modified) {
if (View.showConfirmDialog(this, translate("message.confirm.closeAll"), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.OK_OPTION) == JOptionPane.CANCEL_OPTION) {
return;
}
}
swfs.clear();
oldItem = null;
previewPanel.clear();
@@ -672,6 +687,19 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
}
public void close(SWFList swfList) {
boolean modified = false;
for (SWF swf : swfList) {
if (swf.isModified()) {
modified = true;
}
}
if (modified) {
if (View.showConfirmDialog(this, translate("message.confirm.close").replace("{swfName}",swfList.name), translate("message.warning"), JOptionPane.OK_CANCEL_OPTION, Configuration.showCloseConfirmation, JOptionPane.CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
return;
}
}
swfs.remove(swfList);
if (abcPanel != null) {
for (SWF swf : swfList) {