diff options
author | Christian W. Damus | 2014-03-24 20:46:54 +0000 |
---|---|---|
committer | Christian W. Damus | 2014-03-24 21:13:13 +0000 |
commit | 88a320ee08fe0d1f4546dbb247dbbeb2eab61e22 (patch) | |
tree | aabf4f827239611bdd9638f433d5320bcd27f61a /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src | |
parent | 0854125d2b6a152fccd3dc021d77408c1d341468 (diff) | |
download | org.eclipse.papyrus-88a320ee08fe0d1f4546dbb247dbbeb2eab61e22.tar.gz org.eclipse.papyrus-88a320ee08fe0d1f4546dbb247dbbeb2eab61e22.tar.xz org.eclipse.papyrus-88a320ee08fe0d1f4546dbb247dbbeb2eab61e22.zip |
431023: [Resource Management] Model edits disappear in binary space
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431023
Fix gaps in the dirty-state computation for operation histories that have non-dirtying operations and enforce an undo/redo limit.
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLDiagramEditor.java | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLDiagramEditor.java index c26e0641afb..21ae68e821d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.profile.part; import java.util.EventObject;
-import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -39,7 +39,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.commands.util.OperationUtils;
+import org.eclipse.papyrus.commands.util.OperationHistoryDirtyState;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
@@ -91,7 +91,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -284,16 +284,37 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override
public void doSave(IProgressMonitor progressMonitor) {
// The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
+ getDirtyState().saved();
+ }
+
+ /**
+ * @generated
+ */
+ protected OperationHistoryDirtyState getDirtyState() {
+ if(dirtyState == null) {
+ dirtyState = OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
+ }
+ return dirtyState;
}
/**
* @generated
*/
@Override
+ protected void setUndoContext(IUndoContext context) {
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.setUndoContext(context);
+ }
+
+ /**
+ * @generated
+ */
public boolean isDirty() {
- IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op && OperationUtils.anyDirtyingAfter(getOperationHistory().getUndoHistory(getUndoContext()), savedOperation);
+ return getDirtyState().isDirty();
}
/**
@@ -314,6 +335,12 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh // remove palette service listener
// remove preference listener
PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
super.dispose();
}
|