private void createAndSavePresetPackage(PresetContext pc, Integer[] indexes, String name, String notes, boolean is, AudioFileFormat.Type format, boolean im, boolean imm) throws CommandFailedException {
PresetPackage pkg = null;
try {
pkg = PackageFactory.createPresetPackage(pc, indexes, true, name, notes, im, imm, is, format, null);
} catch (PackageGenerationException e) {
throw new CommandFailedException("Error saving preset package: " + e.getMessage());
}
File extFile = null;
synchronized (this.getClass()) {
assertChooser();
fc.setSelectedFile(new File(name));
int retval = fc.showSaveDialog(ZoeosFrame.getInstance());
if (retval == JFileChooser.APPROVE_OPTION) {
File f = fc.getSelectedFile();
//File extFile = new File(f.getAbsolutePath() + "." + PresetPackage.PRESET_PKG_EXT);
extFile = ZUtilities.replaceExtension(f, PresetPackage.PRESET_PKG_EXT);
if (extFile.exists() && JOptionPane.showConfirmDialog(ZoeosFrame.getInstance(), "Overwrite " + extFile.getName() + " ?", "File Already Exists", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 1)
return;
ZPREF_lastDir.putValue(extFile.getAbsolutePath());
}
}
if (extFile != null) {
try {
PackageFactory.savePresetPackage(pkg, extFile);
} catch (PackageGenerationException e) {
throw new CommandFailedException("Error saving preset package: " + e.getMessage());
} finally {
try {
pc.getDeviceContext().sampleMemoryDefrag(false);
} catch (ZDeviceNotRunningException e) {
} catch (RemoteUnreachableException e) {