}
}
public void saveAsSession() {
Session session = model.getSession();
JFileChooser chooser = new JFileChooser(model.getOptionsParam().getUserDirectory());
chooser.setFileFilter(new FileFilter() {
public boolean accept(File file) {
if (file.isDirectory()) {
return true;
} else if (file.isFile() && file.getName().endsWith(".session")) {
return true;
}
return false;
}
public String getDescription() {
return "Paros session";
}
});
File file = null;
int rc = chooser.showSaveDialog(view.getMainFrame());
if(rc == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
if (file == null) {
return;
}
model.getOptionsParam().setUserDirectory(chooser.getCurrentDirectory());
String fileName = file.getAbsolutePath();
if (!fileName.endsWith(".session")) {
fileName += ".session";
}
try {
waitMessageDialog = view.getWaitMessageDialog("Saving new session file. Please wait ...");
session.save(fileName, this);
log.info("save as session file " + session.getFileName());
waitMessageDialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}