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 | |
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')
12 files changed, 398 insertions, 71 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramEditor.java index 06d8e5078a6..d9a4786a9a2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.activity.part; import java.util.EventObject;
-import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -41,7 +41,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;
@@ -94,7 +94,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -300,16 +300,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();
}
/**
@@ -330,6 +351,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramEditor.java index 9edb8c98532..0423e82ddf5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/part/UMLDiagramEditor.java @@ -13,7 +13,7 @@ package org.eclipse.papyrus.uml.diagram.clazz.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; @@ -37,7 +37,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; @@ -89,7 +89,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /** * @generated */ - private IUndoableOperation savedOperation = null; + private OperationHistoryDirtyState dirtyState; /** * @generated @@ -271,15 +271,37 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */ 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(); } /** @@ -300,6 +322,11 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh // remove preference listener PapyrusPaletteService.getInstance().removeProviderChangeListener(this); + if(dirtyState != null) { + dirtyState.dispose(); + dirtyState = null; + } + super.dispose(); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java index 60aa9faba71..ccdfff4c97e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src/org/eclipse/papyrus/uml/diagram/communication/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.communication.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;
@@ -92,7 +92,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -288,16 +288,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();
}
/**
@@ -318,6 +339,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java index 9956d936c37..d3af918e99d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/part/UMLDiagramEditor.java @@ -14,7 +14,7 @@ package org.eclipse.papyrus.uml.diagram.component.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;
@@ -36,7 +36,7 @@ import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentPro import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
-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;
@@ -86,7 +86,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -255,16 +255,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();
}
/**
@@ -285,6 +306,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java index d6d08a4f07d..f77d63f6f79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.composite.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;
@@ -37,7 +37,7 @@ import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentPro import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
-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;
@@ -87,7 +87,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -253,15 +253,37 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */
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();
}
/**
@@ -281,6 +303,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java index 2a524c0589b..ed934e0946d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramEditor.java @@ -5,7 +5,7 @@ package org.eclipse.papyrus.uml.diagram.deployment.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;
@@ -27,7 +27,7 @@ import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentPro import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
-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;
@@ -77,7 +77,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -250,16 +250,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();
}
/**
@@ -281,6 +302,11 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh // remove preference listener
PapyrusPaletteService.getInstance().removeProviderChangeListener(this);
+ if(dirtyState != null) {
+ dirtyState.dispose();
+ dirtyState = null;
+ }
+
super.dispose();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/part/InteractionOverviewDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/part/InteractionOverviewDiagramEditor.java index bd44e69646e..242b485a5d5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/part/InteractionOverviewDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/part/InteractionOverviewDiagramEditor.java @@ -13,7 +13,7 @@ package org.eclipse.papyrus.uml.diagram.interactionoverview.part; import java.util.EventObject; import java.util.Set; -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; @@ -36,7 +36,7 @@ import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentPro import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.ISelection; -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; @@ -82,7 +82,7 @@ public class InteractionOverviewDiagramEditor extends UmlGmfDiagramEditor implem /** * @generated */ - private IUndoableOperation savedOperation = null; + private OperationHistoryDirtyState dirtyState; /** * @generated @@ -251,16 +251,37 @@ public class InteractionOverviewDiagramEditor extends UmlGmfDiagramEditor implem @Override public void doSave(final 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() { - final IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext()); - return savedOperation != op && OperationUtils.anyDirtyingAfter(getOperationHistory().getUndoHistory(getUndoContext()), savedOperation); + return getDirtyState().isDirty(); } /** @@ -282,6 +303,11 @@ public class InteractionOverviewDiagramEditor extends UmlGmfDiagramEditor implem // remove preference listener PapyrusPaletteService.getInstance().removeProviderChangeListener(this); + if(dirtyState != null) { + dirtyState.dispose(); + dirtyState = null; + } + super.dispose(); } 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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java index d1fe20534ed..8deefe4168a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src/org/eclipse/papyrus/uml/diagram/sequence/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.part; import java.util.EventObject;
-import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -41,7 +41,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;
@@ -94,7 +94,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -296,15 +296,37 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */
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();
}
/**
@@ -325,6 +347,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java index cf4ec8df06d..0c538db2e8e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/src/org/eclipse/papyrus/uml/diagram/statemachine/part/UMLDiagramEditor.java @@ -2,7 +2,7 @@ package org.eclipse.papyrus.uml.diagram.statemachine.part; import java.util.EventObject;
-import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -28,7 +28,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;
@@ -81,7 +81,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -296,6 +296,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();
}
@@ -305,7 +311,30 @@ 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);
}
/**
@@ -448,8 +477,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh */
@Override
public boolean isDirty() {
- IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op && OperationUtils.anyDirtyingAfter(getOperationHistory().getUndoHistory(getUndoContext()), savedOperation);
+ return getDirtyState().isDirty();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java index 3e0d0b16e95..fb409915420 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src/org/eclipse/papyrus/uml/diagram/timing/part/UMLDiagramEditor.java @@ -10,6 +10,8 @@ package org.eclipse.papyrus.uml.diagram.timing.part; import java.util.EventObject;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -34,6 +36,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.OperationHistoryDirtyState;
import org.eclipse.papyrus.commands.util.OperationUtils;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -88,7 +91,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -285,16 +288,37 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh @Override
public void doSave(final IProgressMonitor progressMonitor) {
// The saving of the resource is done by the CoreMultiDiagramEditor
- this.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() {
- final IUndoableOperation op = getOperationHistory().getUndoOperation(getUndoContext());
- return savedOperation != op && OperationUtils.anyDirtyingAfter(getOperationHistory().getUndoHistory(getUndoContext()), savedOperation);
+ return getDirtyState().isDirty();
}
/**
@@ -315,7 +339,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();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLDiagramEditor.java index e25fa848344..56862ac392d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/src/org/eclipse/papyrus/uml/diagram/usecase/part/UMLDiagramEditor.java @@ -15,7 +15,7 @@ package org.eclipse.papyrus.uml.diagram.usecase.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;
@@ -40,7 +40,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;
@@ -92,7 +92,7 @@ public class UMLDiagramEditor extends UmlGmfDiagramEditor implements IProviderCh /**
* @generated
*/
- private IUndoableOperation savedOperation = null;
+ private OperationHistoryDirtyState dirtyState;
/**
* @generated
@@ -288,16 +288,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();
}
/**
@@ -318,6 +339,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();
}
|