{
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
getPrefs().exportLocation = fileChooser.getSelectedFile();
String output = null;
JreepadWriter writer = null;
switch(exportFormat)
{
case FILE_FORMAT_HTML:
writer = new HtmlWriter(getPrefs().getEncoding(),
getPrefs().htmlExportArticleType,
getPrefs().htmlExportUrlsToLinks,
getPrefs().htmlExportAnchorLinkType);
break;
case FILE_FORMAT_XML:
writer= new XmlWriter();
break;
case FILE_FORMAT_HJT:
writer= new TreepadWriter(getPrefs().getEncoding());
break;
case FILE_FORMAT_TEXT:
output = theJreepad.getCurrentNode().getContent();
break;
case FILE_FORMAT_TEXTASLIST:
output = theJreepad.getCurrentNode().exportTitlesAsList();
break;
case FILE_FORMAT_ARTICLESTOTEXT:
int answer = JOptionPane.showConfirmDialog(this, lang.getString("PROMPT_INCLUDE_TITLES"),
lang.getString("TITLE_INCLUDE_TITLES") , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
boolean titlesToo = (answer == JOptionPane.YES_OPTION);
output = theJreepad.getCurrentNode().exportArticlesToText(titlesToo);
break;
default:
setCursor(Cursor.getDefaultCursor());
JOptionPane.showMessageDialog(this, "Unknown which format to export - coding error! Oops!",lang.getString("TITLE_MISC_ERROR") , JOptionPane.ERROR_MESSAGE);
return;
}
OutputStream fos = new FileOutputStream(getPrefs().exportLocation);
if (writer != null)
{
writer.write(fos, new JreepadTreeModel(theJreepad.getCurrentNode()));
fos.close();
}
else // assume (output != null)
{
OutputStreamWriter osw = new OutputStreamWriter(fos, getPrefs().getEncoding());