}
public void actionPerformed(final ActionEvent e) {
final GCDocument gcDocument = gcViewer.getSelectedGCDocument();
for (int i=0; i<gcDocument.getChartPanelViewCount(); i++) {
final ChartPanelView chartPanelView = gcDocument.getChartPanelView(i);
final File file = new File(chartPanelView.getModel().getURL().getFile());
saveDialog.setCurrentDirectory(file.getParentFile());
saveDialog.setSelectedFile(file);
final int val = saveDialog.showSaveDialog(gcViewer);
if (val == JFileChooser.APPROVE_OPTION) {
ExtensionFileFilter fileFilter = (ExtensionFileFilter) saveDialog.getFileFilter();
// On OS/X if you don't select one of the filters and just press "Save" the filter may be null. Use the CSV one then
if (fileFilter==null) {
fileFilter = (ExtensionFileFilter) saveDialog.getChoosableFileFilters()[0];
}
exportFile(chartPanelView.getModel(), saveDialog.getSelectedFile(), fileFilter.getExtension(),
fileFilter.getDataWriterType());
}
else if (val == JFileChooser.ERROR_OPTION) {
JOptionPane.showMessageDialog(gcViewer, LocalisationHelper.getString("fileexport_dialog_error_occured"), LocalisationHelper.getString("fileexport_dialog_write_file_failed"), JOptionPane.ERROR_MESSAGE);
}