65
|
|
private boolean onCloseWindow(String fileId) {
|
66
|
|
if (model.isFileModified(fileId)) {
|
67
|
|
int result = view.showConfirmationDialog(
|
68
|
|
"The file has modifications. Save before proceeding?",
|
69
|
|
fileId);
|
70
|
|
|
71
|
|
switch (result) {
|
72
|
|
case JOptionPane.YES_OPTION:
|
73
|
|
if (!onSave(fileId)) {
|
74
|
|
/* Saving was aborted or failed, so we don't proceed */
|
75
|
|
return false;
|
76
|
|
}
|
77
|
|
break;
|
78
|
|
case JOptionPane.NO_OPTION:
|
79
|
|
break;
|
80
|
|
case JOptionPane.CANCEL_OPTION:
|
81
|
|
/* Saving was aborted or failed, so we don't proceed */
|
82
|
|
return false;
|
83
|
|
}
|
84
|
|
}
|
85
|
|
|
86
|
|
view.closeWindow(fileId);
|
87
|
|
model.closeFile(fileId, true);
|
88
|
|
return true;
|
89
|
|
}
|