use of com.mucommander.ui.dialog.QuestionDialog in project mucommander by mucommander.
the class BinaryEditor method canClose.
/**
* Checks whether file can be closed and asks for confirmation if necessary.
*
* @return true if the file does not have any unsaved change or if the user opted to save the changes, false if the
* user canceled the dialog or the save failed.
*/
public boolean canClose() {
if (!saveNeeded) {
return true;
}
QuestionDialog dialog = new QuestionDialog(windowFrame, null, Translator.get("file_editor.save_warning"), binaryComponent, Arrays.asList(BinaryEditorAction.YES, BinaryEditorAction.NO, BinaryEditorAction.CANCEL), 0);
DialogAction ret = dialog.getActionValue();
if (ret == BinaryEditorAction.YES && trySave(currentFile) || ret == BinaryEditorAction.NO) {
setSaveNeeded(false);
return true;
}
// User canceled or the file couldn't be properly saved
return false;
}
use of com.mucommander.ui.dialog.QuestionDialog in project mucommander by mucommander.
the class BasicFileEditor method askSave.
// Returns true if the file does not have any unsaved change or if the user refused to save the changes,
// false if the user canceled the dialog or the save failed.
public boolean askSave() {
if (!saveNeeded) {
return true;
}
QuestionDialog dialog = new QuestionDialog(getFrame(), null, Translator.get("file_editor.save_warning"), getFrame(), Arrays.asList(BasicFileAction.YES, BasicFileAction.NO, BasicFileAction.CANCEL), 0);
DialogAction ret = dialog.getActionValue();
if (ret == BasicFileAction.YES && trySave(getCurrentFile()) || ret == BasicFileAction.NO) {
setSaveNeeded(false);
return true;
}
// User canceled or the file couldn't be properly saved
return false;
}
Aggregations