sendResults(email.toString());
}
});
results.getExportButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
final FileSaverDescriptor descriptor = new FileSaverDescriptor("Save results to", "");
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
descriptor, javaPuzzlersGame.getProject());
VirtualFile base = javaPuzzlersGame.getProject().getBaseDir();
final VirtualFileWrapper fileWrapper = dialog.save(base, "results.html");
if (fileWrapper != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
final VirtualFile fileToSave = fileWrapper.getVirtualFile(true);
assert fileToSave != null;
try {
fileToSave.setBinaryContent(results.exportResultsToXML(login.getLogin()).getBytes());
} catch (IOException e) {
e.printStackTrace(System.err);
}
}
});
}
}
});
results.getXsltButton().addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
final FileSaverDescriptor descriptor = new FileSaverDescriptor("Choose xsl file", "xsl");
final FileChooserDialog dialog = FileChooserFactory.getInstance().createFileChooser(descriptor, javaPuzzlersGame.getProject());
VirtualFile[] xsl = dialog.choose(null, javaPuzzlersGame.getProject());
results.transformXML(javaPuzzlersGame.getProject(), login.getLogin(), xsl[0]);
}