/** Saves the current resource. */ public void save() { try { tileset.save(); } catch (QuestEditorException ex) { GuiTools.errorDialog("Could not save the tileset: " + ex.getMessage()); } }
/** Closes this editor without confirmation. */ @Override public void close() { tileset.deleteObservers(); // Notify the children views. tilePatternsView.setTileset(null); tilesetImageView.setTileset(null); }
/** * 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; }
/** * Give the name of the resource opened in the editor * * @return the name of the map */ public String getTitle() { return tileset == null ? "" : "Tileset " + tileset.getName(); }