Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2017-08-11 08:30:59 +0000
committerPierre-Charles David2017-08-21 13:17:24 +0000
commit4d6250b153073d1ea29c88b331785a1bf2f46725 (patch)
tree06817be74ab6ef3ea3d058c70ecfe9d1252bd2c8
parentbcac2420f782b54113be9d47701836078fe18e5f (diff)
downloadorg.eclipse.sirius-4d6250b153073d1ea29c88b331785a1bf2f46725.tar.gz
org.eclipse.sirius-4d6250b153073d1ea29c88b331785a1bf2f46725.tar.xz
org.eclipse.sirius-4d6250b153073d1ea29c88b331785a1bf2f46725.zip
[519278] Do not flush layout data on intermediate sub-transactions
Bug: 519278 Change-Id: I44cf1e451fadac57f1c0fc58676c13a6173f0680 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataFlusher.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataFlusher.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataFlusher.java
index 3f35b57edd..bcb2ee5c33 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataFlusher.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/view/SiriusLayoutDataFlusher.java
@@ -16,14 +16,14 @@ import java.util.Set;
import org.eclipse.core.commands.operations.IOperationHistoryListener;
import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.EMFCommandOperation;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.View;
/**
- * The SiriusLayoutDataFlusher which listens IOperationHistory events to
- * flush the list of {@link RootLayoutData} of the
- * {@link SiriusLayoutDataManagerImpl} after a
- * {@link OperationHistoryEvent#DONE} event.
+ * The SiriusLayoutDataFlusher which listens IOperationHistory events to flush the list of {@link RootLayoutData} of the
+ * {@link SiriusLayoutDataManagerImpl} after a {@link OperationHistoryEvent#DONE} event.
*
* @author edugueperoux
*/
@@ -35,21 +35,30 @@ public class SiriusLayoutDataFlusher implements IOperationHistoryListener {
* Default constructor for the SiriusLayoutDataFlusher.
*
* @param viewPointLayoutDataManagerImpl
- * the {@link SiriusLayoutDataManagerImpl} on which to flush
- * the list of {@link RootLayoutData}
+ * the {@link SiriusLayoutDataManagerImpl} on which to flush the list of {@link RootLayoutData}
*/
public SiriusLayoutDataFlusher(SiriusLayoutDataManagerImpl viewPointLayoutDataManagerImpl) {
this.viewPointLayoutDataManagerImpl = viewPointLayoutDataManagerImpl;
}
/**
- * Overridden to flush the list of {@link RootLayoutData} of the
- * {@link SiriusLayoutDataManagerImpl}.
+ * Overridden to flush the list of {@link RootLayoutData} of the {@link SiriusLayoutDataManagerImpl}.
*
* {@inheritDoc}
*/
public void historyNotification(OperationHistoryEvent event) {
if (event.getEventType() == OperationHistoryEvent.DONE || event.getEventType() == OperationHistoryEvent.OPERATION_NOT_OK) {
+ if (event.getOperation() instanceof EMFCommandOperation) {
+ EMFCommandOperation oper = (EMFCommandOperation) event.getOperation();
+ TransactionalEditingDomain domain = oper.getEditingDomain();
+ if (domain instanceof org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl
+ && ((org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl) domain).getActiveTransaction() != null) {
+ // Ignore operations which corresponds to intermediate sub-transactions: the layout data should be
+ // kept around until the full end of the top-level user interaction.
+ return;
+ }
+ }
+
viewPointLayoutDataManagerImpl.flushRootLayoutDatas();
Map<Diagram, Set<View>> createdViewsToLayout = viewPointLayoutDataManagerImpl.getCreatedViewsToLayout();
for (Diagram diagram : new ArrayList<Diagram>(createdViewsToLayout.keySet())) {

Back to the top