diff options
author | Fabian Miehe | 2014-07-28 11:52:11 +0000 |
---|---|---|
committer | Fabian Miehe | 2014-07-28 18:08:49 +0000 |
commit | daa321b4793b4822c877cd085c08d8dbd092d6b9 (patch) | |
tree | 2df6a7183d1441fd0f8fe684e7039cc886e2a0ee | |
parent | fc6811f8bcb8f40312917429a747d458898b186e (diff) | |
download | org.eclipse.e4.tools-I20140731-2200.tar.gz org.eclipse.e4.tools-I20140731-2200.tar.xz org.eclipse.e4.tools-I20140731-2200.zip |
Bug 440533 - Undo/Redo should be possible after saveI20140804-2200I20140803-2200I20140802-2200I20140801-2200I20140731-2200I20140730-2200I20140730-0900I20140729-2200I20140728-2200
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.java | 13 |
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; } - } |