final JMenuItem saveMI = new JMenuItem("Save File");
saveMI.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent ae) {
final SaveDialog chooser = new SaveDialog(System.getProperty("user.dir"));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setFileFilter(new FileNameExtensionFilter("JSON Save files", "json"));
if(chooser.showDialog(VisualRifEditor.this.that, "Save") == SaveDialog.APPROVE_OPTION) {
String fileName = chooser.getSelectedFile().getAbsolutePath();
if(!fileName.endsWith(".json")) {
fileName += ".json";
}
VisualRifEditor.this.that.saveLoader.save(fileName);
}
}
});
final JMenuItem importMI = new JMenuItem("Import Document");
importMI.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent ae) {
final JFileChooser chooser = new JFileChooser(System.getProperty("user.dir"));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setFileFilter(new FileNameExtensionFilter("rif document", "txt","rif"));
if(chooser.showDialog(VisualRifEditor.this.that, "Import") == JFileChooser.APPROVE_OPTION) {
final String fileName = chooser.getSelectedFile().getAbsolutePath();
VisualRifEditor.this.that.importNewDocument(FileHelper.fastReadFile(fileName));
}
}
});
final JMenuItem exportMI = new JMenuItem("Export Document");
exportMI.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent ae) {
final SaveDialog chooser = new SaveDialog(System.getProperty("user.dir"));
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setFileFilter(new FileNameExtensionFilter("rif document", "txt","rif"));
if(chooser.showDialog(VisualRifEditor.this.that, "Export") == SaveDialog.APPROVE_OPTION) {
String fileName = chooser.getSelectedFile().getAbsolutePath();
if(!fileName.endsWith(".rif")) {
fileName += ".rif";
}