summaryrefslogtreecommitdiff
path: root/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java')
-rw-r--r--scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java b/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java
index 7150ef81e541..4163ea1ea99f 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/utils/ZipMounter.java
@@ -27,8 +27,7 @@ import org.openide.filesystems.Repository;
import org.openoffice.netbeans.modules.office.filesystem.OpenOfficeDocFileSystem;
-public class ZipMounter
-{
+public class ZipMounter {
private static ZipMounter mounter = null;
private ZipMounter() {
@@ -37,25 +36,26 @@ public class ZipMounter
public static synchronized ZipMounter getZipMounter() {
if (mounter == null)
mounter = new ZipMounter();
+
return mounter;
}
public void mountZipFile(File zipfile)
- throws IOException, PropertyVetoException
- {
+ throws IOException, PropertyVetoException {
if (zipfile != null) {
addDocumentToRepository(zipfile, true);
}
}
private FileSystem addDocumentToRepository(File rootFile, boolean writeable)
- throws IOException, PropertyVetoException
- {
+ throws IOException, PropertyVetoException {
Repository repo = Repository.getDefault();
OpenOfficeDocFileSystem oofs;
oofs = (OpenOfficeDocFileSystem)getMountedDocument(rootFile);
- if(oofs != null)
+
+ if (oofs != null)
repo.removeFileSystem(oofs);
+
oofs = new OpenOfficeDocFileSystem();
oofs.setDocument(rootFile);
repo.addFileSystem(oofs);
@@ -64,16 +64,18 @@ public class ZipMounter
/** @return FileSystem which has given jar file as its root or
* null if no such file system could be found in repository */
- private FileSystem getMountedDocument(File rootFile)
- {
+ private FileSystem getMountedDocument(File rootFile) {
if (rootFile == null)
return null;
+
FileSystem oofs = null;
+
try {
oofs = Repository.getDefault().findFileSystem(
- OpenOfficeDocFileSystem.computeSystemName(rootFile));
- } catch(Exception exp) {
+ OpenOfficeDocFileSystem.computeSystemName(rootFile));
+ } catch (Exception exp) {
}
+
return oofs;
}
}