}
}
}//GEN-LAST:event_uploadButtonActionPerformed
private void downloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadButtonActionPerformed
ContentResource selected = (ContentResource) getSelection();
JFileChooser chooser = new JFileChooser("Choose a directory");
chooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
return f.isDirectory();
}
@Override
public String getDescription() {
return "Directories";
}
});
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
int returnVal = chooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File out = new File(chooser.getSelectedFile(), selected.getName());
try {
selected.get(out);
} catch (ContentRepositoryException cre) {
logger.log(Level.WARNING, "Unable to download " + out, cre);
} catch (IOException ioe) {
logger.log(Level.WARNING, "Unable to write " + out, ioe);
}