JMenuItem saveAsDatastoreItem = new JMenuItem("As datastore");
saveAsDatastoreItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String datastoreName = JOptionPane.showInputDialog("Datastore name");
OutputWriter writer = DatastoreOutputWriterFactory.getWriter(datastoreName, "DATASET", _inputColumns);
performWrite(writer);
UsageLogger.getInstance().log("Save DataSet as datastore");
}
});
JMenuItem saveAsCsvItem = new JMenuItem("As CSV file");
saveAsCsvItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DCFileChooser fileChooser = new DCFileChooser(_userPreferences.getAnalysisJobDirectory());
fileChooser.addChoosableFileFilter(FileFilters.CSV);
if (fileChooser.showSaveDialog((Component) event.getSource()) == JFileChooser.APPROVE_OPTION) {
File selectedFile = fileChooser.getSelectedFile();
if (selectedFile.getName().indexOf('.') == -1) {
selectedFile = new File(selectedFile.getPath() + ".csv");
}
OutputWriter writer = CsvOutputWriterFactory.getWriter(selectedFile.getAbsolutePath(), _inputColumns);
performWrite(writer);
File dir = selectedFile.getParentFile();
_userPreferences.setAnalysisJobDirectory(dir);