Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2011-07-21 02:41:07 -0400
committerMilos Kleint2011-07-21 02:41:07 -0400
commite043662934bb501c6e6190a74be224bbd8b01034 (patch)
tree9a3f6f613ba6e54a26122cb12c7654f7330b8f27
parentc1012f37d83403f4c147e489f383ddc6166fd39f (diff)
downloadm2e-core-e043662934bb501c6e6190a74be224bbd8b01034.tar.gz
m2e-core-e043662934bb501c6e6190a74be224bbd8b01034.tar.xz
m2e-core-e043662934bb501c6e6190a74be224bbd8b01034.zip
minor api addition to allow forcing save of files/documents after performing operations
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
index 50bae0f4..e68e5293 100644
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
+++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/editing/PomEdits.java
@@ -416,9 +416,9 @@ public class PomEdits {
if (tuple.isReadOnly()) {
domModel.releaseFromRead();
} else {
- //for ducuments saving shall only happen when the model is not held elsewhere (eg. in opened view)
+ //for ducuments saving shall generally only happen when the model is not held elsewhere (eg. in opened view)
//for files, save always
- if(tuple.getFile() != null || domModel.getReferenceCountForEdit() == 1) {
+ if(tuple.isForceSave() || domModel.getReferenceCountForEdit() == 1) {
domModel.save();
}
domModel.releaseFromEdit();
@@ -434,6 +434,7 @@ public class PomEdits {
private final IDocument document;
private final IDOMModel model;
private boolean readOnly = false;
+ private boolean forceSave = false;
/**
* operation on top of IFile is always saved
@@ -447,6 +448,7 @@ public class PomEdits {
this.operation = operation;
document = null;
model = null;
+ forceSave = true;
}
/**
* operation on top of IDocument is only saved when noone else is editing the document.
@@ -484,6 +486,17 @@ public class PomEdits {
}
/**
+ * force saving the document after performing the operation
+ */
+ public void setForceSave() {
+ forceSave = true;
+ }
+
+ public boolean isForceSave() {
+ return forceSave;
+ }
+
+ /**
* @return Returns the readOnly.
*/
public boolean isReadOnly() {

Back to the top