public void actionPerformed(ActionEvent e) {
if (file == null)
saveAsDatabaseAction.actionPerformed(null);
else {
try {
FileActions.saveDatabase(database, metaData, file,
prefs, false, false);
undoManager.markUnchanged();
// (Only) after a successful save the following
// statement marks that the base is unchanged
// since last save:
baseChanged = false;
setTitle(GUIGlobals.baseTitle+file.getName());
output("Saved database '"+file.getPath()+"'.");
} catch (SaveException ex) {
if (ex.specificEntry()) {
// Error occured during processing of
// be. Highlight it:
int row = tableModel.getNumberFromName
(ex.getEntry().getId()),
topShow = Math.max(0, row-3);
//Util.pr(""+row);
entryTable.setRowSelectionInterval(row, row);
entryTable.setColumnSelectionInterval
(0, entryTable.getColumnCount()-1);
entryTable.scrollTo(topShow);
}
JOptionPane.showMessageDialog
(parent, "Could not save file.\n"+ex.getMessage(),
"Save database", JOptionPane.ERROR_MESSAGE);
}
}
}
|