Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Miehe2014-07-28 07:52:11 -0400
committerFabian Miehe2014-07-28 14:08:49 -0400
commitdaa321b4793b4822c877cd085c08d8dbd092d6b9 (patch)
tree2df6a7183d1441fd0f8fe684e7039cc886e2a0ee
parentfc6811f8bcb8f40312917429a747d458898b186e (diff)
downloadorg.eclipse.e4.tools-daa321b4793b4822c877cd085c08d8dbd092d6b9.tar.gz
org.eclipse.e4.tools-daa321b4793b4822c877cd085c08d8dbd092d6b9.tar.xz
org.eclipse.e4.tools-daa321b4793b4822c877cd085c08d8dbd092d6b9.zip
Change-Id: I0e34f4433f789172e670ec29c9cfb79cfb5baecd Signed-off-by: Fabian Miehe <fabian.miehe@cassidian.com>
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
index 1695e22f..bdacafc4 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
@@ -45,7 +45,7 @@ public class XMIModelResource implements IModelResource {
private EditingDomain editingDomain;
private Resource resource;
private List<ModelListener> listeners = new ArrayList<IModelResource.ModelListener>();
- private boolean dirty;
+
private IObservableList list;
public XMIModelResource(URI uri) {
@@ -58,7 +58,6 @@ public class XMIModelResource implements IModelResource {
@Override
public void commandStackChanged(EventObject event) {
- dirty = true;
fireDirtyChanged();
fireCommandStackChanged();
}
@@ -126,7 +125,7 @@ public class XMIModelResource implements IModelResource {
@Override
public boolean isDirty() {
- return dirty && getEditingDomain().getCommandStack().canUndo();
+ return ((BasicCommandStack) getEditingDomain().getCommandStack()).isSaveNeeded();
}
private void fireDirtyChanged() {
@@ -146,10 +145,13 @@ public class XMIModelResource implements IModelResource {
Map<String, String> map = new HashMap<String, String>();
try {
resource.save(map);
- editingDomain.getCommandStack().flush();
- dirty = false;
+
+ BasicCommandStack commandStack = (BasicCommandStack) getEditingDomain().getCommandStack();
+ commandStack.saveIsDone();
+
fireDirtyChanged();
fireCommandStackChanged();
+
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
@@ -157,5 +159,4 @@ public class XMIModelResource implements IModelResource {
return Status.OK_STATUS;
}
-
}

Back to the top