/** * This function is called when the user wants to close the current tileset. If the tileset is not * saved, we propose to save it. * * @return false if the user cancelled */ public boolean checkCurrentFileSaved() { boolean result = true; if (tileset != null && !tileset.isSaved()) { int answer = JOptionPane.showConfirmDialog( this, "The tileset has been modified. Do you want to save it?", "Save the modifications", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (answer == JOptionPane.YES_OPTION) { save(); } else if (answer == JOptionPane.CANCEL_OPTION) { result = false; } } return result; }