diff options
| author | Pierre-Charles David | 2017-08-11 08:30:59 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2017-08-30 12:07:36 +0000 |
| commit | a769a57844001a171b5b8b944e0fff0c1e53c293 (patch) | |
| tree | 85bf9fa8ff00f2210476654d6cfa9f3ef7fdfc33 | |
| parent | c0f82b784766cf1fdf7896edcf367cb43f1f8702 (diff) | |
| download | org.eclipse.sirius-a769a57844001a171b5b8b944e0fff0c1e53c293.tar.gz org.eclipse.sirius-a769a57844001a171b5b8b944e0fff0c1e53c293.tar.xz org.eclipse.sirius-a769a57844001a171b5b8b944e0fff0c1e53c293.zip | |
[519117] Do not flush layout data on intermediate sub-transactions
Bug: 519117
Change-Id: Ib1463dd0caf497b5d393170e322e45962acdcb03
Cherr-picked-from: 519278
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.java | 25 |
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())) { |
