summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorTomas O'Connor <toconnor@openoffice.org>2003-06-17 11:17:16 +0000
committerTomas O'Connor <toconnor@openoffice.org>2003-06-17 11:17:16 +0000
commitc4a95b943dbca925cd4862b3859f0903e547aed4 (patch)
tree3e44677b164a6bb778b12ff0267c9fe0d2f1887c /scripting
parenta6d4a128364a943789fdc7aabd3af8994faa8288 (diff)
IssueZilla 11986 - Cannot rename java file after creating parcel recipe
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java
index d8676531aad2..dfdb09a95020 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/loader/ParcelContentsFolder.java
@@ -2,9 +2,9 @@
*
* $RCSfile: ParcelContentsFolder.java,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: toconnor $ $Date: 2003-06-12 11:31:26 $
+ * last change: $Author: toconnor $ $Date: 2003-06-17 12:17:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,6 +68,7 @@ import org.openide.NotifyDescriptor;
import org.openide.ErrorManager;
import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileLock;
import org.openide.filesystems.FileUtil;
import org.openide.filesystems.FileSystem;
import org.openide.filesystems.Repository;
@@ -141,12 +142,16 @@ public class ParcelContentsFolder extends DataFolder {
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
- fo.rename(fo.lock(), fo.getName(), fo.getExt());
+ lock = fo.lock();
+ if (lock != null) {
+ fo.rename(lock, fo.getName(), fo.getExt());
+ }
}
catch (IOException ioe) {
NotifyDescriptor d = new NotifyDescriptor.Message(
@@ -156,6 +161,11 @@ public class ParcelContentsFolder extends DataFolder {
"before building the Parcel Recipe");
TopManager.getDefault().notify(d);
}
+ finally {
+ if (lock != null) {
+ lock.releaseLock();
+ }
+ }
}
}
}