}
else if (language.toLowerCase().equals("beanshell")) {
sourceFile += ".bsh";
}
else {
NotifyDescriptor d = new NotifyDescriptor.Message(
"Language not defined for this Parcel Folder");
TopManager.getDefault().notify(d);
return;
}
FileSystem fs = Repository.getDefault().getDefaultFileSystem();
DataObject result = null;
try {
DataObject dObj = DataObject.find(fs.findResource(sourceFile));
result = dObj.createFromTemplate(parent);
}
catch (IOException ioe) {
ErrorManager.getDefault().notify(ioe);
}
FileObject fo = result.getPrimaryFile();
if (fo.getExt().equals("java")) {
FileLock lock = null;
try {
PackageRemover.removeDeclaration(FileUtil.toFile(fo));
// IssueZilla 11986 - rename the FileObject
// so the JavaNode is resynchronized
lock = fo.lock();
if (lock != null) {
fo.rename(lock, fo.getName(), fo.getExt());
}
}
catch (IOException ioe) {
NotifyDescriptor d = new NotifyDescriptor.Message(
"Error removing package declaration from file: " +
fo.getNameExt() +
". You should manually remove this declaration " +
"before building the Parcel Recipe");
TopManager.getDefault().notify(d);