Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-24 20:46:54 +0000
committerChristian W. Damus2014-03-24 21:13:13 +0000
commit88a320ee08fe0d1f4546dbb247dbbeb2eab61e22 (patch)
treeaabf4f827239611bdd9638f433d5320bcd27f61a /plugins/developer/org.eclipse.papyrus.def/xtend
parent0854125d2b6a152fccd3dc021d77408c1d341468 (diff)
downloadorg.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/developer/org.eclipse.papyrus.def/xtend')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend39
1 files changed, 35 insertions, 4 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
index dcac9804228..dea7757c0f4 100644
--- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
+++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend
@@ -11,6 +11,7 @@
* Michael Golubev (Montages) - #386838 - migrate to Xtend2
* Emilien Perico (Atos Origin) - add code to refactor some classes
* Christian W. Damus (CEA) - bug 430648
+ * Christian W. Damus (CEA) - bug 431023
*/
package aspects.xpt.editor
@@ -43,7 +44,7 @@ public static final String CONTEXT_ID = "«contextID»"; «nonNLS»
««« Helps to handle correctly the dirty state
«generatedMemberComment»
- private org.eclipse.core.commands.operations.IUndoableOperation savedOperation = null;
+ private org.eclipse.papyrus.commands.util.OperationHistoryDirtyState dirtyState;
«generatedMemberComment»
private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
@@ -103,6 +104,10 @@ override additions (GenEditorView it)'''
« doSave(it)»
+ « getDirtyState(it)»
+
+ « setUndoContext(it)»
+
« isDirty(it)»
«««Documentation. adds method to handle palette changes
@@ -152,6 +157,11 @@ def dispose(GenEditorView it)'''
// remove preference listener
org.eclipse.papyrus.uml.diagram.common.service.PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
super.dispose();
}
'''
@@ -360,16 +370,37 @@ def doSave (GenEditorView it)'''
«generatedMemberComment»
public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
// The saving of the resource is done by the CoreMultiDiagramEditor
- savedOperation = getOperationHistory().getUndoOperation(getUndoContext());
+ getDirtyState().saved();
}
'''
+def getDirtyState (GenEditorView it)'''
+«generatedMemberComment»
+ protected org.eclipse.papyrus.commands.util.OperationHistoryDirtyState getDirtyState() {
+ if(dirtyState == null) {
+ dirtyState = org.eclipse.papyrus.commands.util.OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory());
+ }
+ return dirtyState;
+ }
+'''
+
+def setUndoContext (GenEditorView it)'''
+«generatedMemberComment»
+ protected void setUndoContext(org.eclipse.core.commands.operations.IUndoContext context) {
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
+ super.setUndoContext(context);
+ }
+'''
+
//Fix the dirty state
def isDirty (GenEditorView it)'''
«generatedMemberComment»
public boolean isDirty() {
- org.eclipse.core.commands.operations.IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op && org.eclipse.papyrus.commands.util.OperationUtils.anyDirtyingAfter(getOperationHistory().getUndoHistory(getUndoContext()), savedOperation);
+ return getDirtyState().isDirty();
}
'''

Back to the top