summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-04-10 17:00:37 (EDT)
committerpelder2006-04-10 17:00:37 (EDT)
commit810acd19103047c3a033c5c97ef48eb106c472db (patch)
tree1c99c3ef24b9fc045b1e9ce0543afc4e8822f74e
parent558dbe712a0bd76f642422fe8124f126ecbac342 (diff)
downloadorg.eclipse.jet-810acd19103047c3a033c5c97ef48eb106c472db.zip
org.eclipse.jet-810acd19103047c3a033c5c97ef48eb106c472db.tar.gz
org.eclipse.jet-810acd19103047c3a033c5c97ef48eb106c472db.tar.bz2
[136001] Ensure containing directory exists when 'pre-writing' files.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
index c94f8ba..5a6d594 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/ActionsUtil.java
@@ -128,13 +128,23 @@ public final class ActionsUtil
// Step 1: make sure file exists - necessary for proper encoding handling...
if (!file.exists())
{
+ // Step 1a: ensure containing folder exists...
+ if (file.getParent() instanceof IFolder)
+ {
+ ensureFolderExists((IFolder)file.getParent(), new SubProgressMonitor(monitor, 1));
+ }
+ else
+ {
+ monitor.worked(1);
+ }
+
// can't set encoding until the file exists, create the file with null-contents
// now, and set it's contents later.
file.create(new ByteArrayInputStream(new byte [0]), false, new SubProgressMonitor(monitor, 1));
}
else
{
- monitor.worked(1);
+ monitor.worked(2);
}
// Step 2: set the encoding...
@@ -160,16 +170,6 @@ public final class ActionsUtil
}
monitor.worked(1);
- // Step 4: ensure containing folder exists...
- if (file.getParent() instanceof IFolder)
- {
- ensureFolderExists((IFolder)file.getParent(), new SubProgressMonitor(monitor, 1));
- }
- else
- {
- monitor.worked(1);
- }
-
// Step 5: write the contents - we created the file in step 1, so we only need to set its proper contents
file.setContents(source, false, true, new SubProgressMonitor(monitor, 2));