Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Barbin2015-01-12 08:59:59 +0000
committerFlorian Barbin2015-01-28 08:24:07 +0000
commitd260c41686331bfe6d419fda1865e19d623ae260 (patch)
tree11845fd821316cea68852e5180f19d18a1e83630
parentfb41a5ac8902f246d1258920bafec42d43c05c4d (diff)
downloadorg.eclipse.sirius-d260c41686331bfe6d419fda1865e19d623ae260.tar.gz
org.eclipse.sirius-d260c41686331bfe6d419fda1865e19d623ae260.tar.xz
org.eclipse.sirius-d260c41686331bfe6d419fda1865e19d623ae260.zip
[444261] Reloads the resources when changes are canceled.
* Instead of undoing changes to retrieve the state before the user modified the resource, we now reload resources. * Creates a new resource status to handle this case. * Removes the RestoreToLastSavePointListener which is not necessary anymore. Bug: 444261 Change-Id: Id814706367282b1da53ff8497b1c7d406d2c69d6 Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/resource/ResourceSetSync.java2
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.html6
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release Notes.textile1
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CloseWithoutSavingTest.java94
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java1
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java53
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java167
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/ReloadingPolicyImpl.java8
-rw-r--r--plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SessionResourcesSynchronizer.java3
9 files changed, 152 insertions, 183 deletions
diff --git a/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/resource/ResourceSetSync.java b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/resource/ResourceSetSync.java
index 9ebb8945cf..8740f26443 100644
--- a/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/resource/ResourceSetSync.java
+++ b/plugins/org.eclipse.sirius.common/src/org/eclipse/sirius/common/tools/api/resource/ResourceSetSync.java
@@ -97,7 +97,7 @@ public final class ResourceSetSync extends ResourceSetListenerImpl implements Re
/**
* The resource in-memory status in regard of the physical data.
*/
- CHANGED, EXTERNAL_CHANGED, CONFLICTING_CHANGED, CONFLICTING_DELETED, DELETED, SYNC, UNKNOWN
+ CHANGED, EXTERNAL_CHANGED, CONFLICTING_CHANGED, CONFLICTING_DELETED, DELETED, SYNC, CHANGES_CANCELED, UNKNOWN
}
/**
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
index a809e5820e..1fb5d13cea 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html
@@ -105,6 +105,10 @@
<li>The static method
<code>org.eclipse.sirius.common.tools.api.util.ReflectionHelper.getFieldValueWithoutException(Class&lt;?&gt;, String)</code> has been added to return an internal static value of a class.
</li>
+ <li>
+ <code>org.eclipse.sirius.common.tools.api.resource.ResourceSetSync</code> has a new state
+ <code>CHANGES_CANCELED</code> used to define the state where the user canceled its changes.
+ </li>
</ul>
<h4 id="Changesinorg.eclipse.sirius.ecore.extender">Changes in
<code>org.eclipse.sirius.ecore.extender</code>
@@ -2188,4 +2192,4 @@ void removeSelectedView(DView view);
<li>The ability to print table representations has been disabled for the 0.9 release due to an external dependency issue (see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=422223" target="_blank">bug #422223</a>: for the details). It should be re-introduced in 1.0.</li>
</ul>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
index c7488cbcba..7e68bf2886 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile
@@ -33,6 +33,7 @@ h4. Changes in @org.eclipse.sirius.common@
* @org.eclipse.sirius.common.tools.api.util.ECrossReferenceAdapterWithUnproxyCapability@ is a specific kind of ECrossReferenceAdapter. It provides the capability to resolve all proxy cross references to a given resource. It is now used by the Session as semantic cross referencer. This type is exposed as API but it is not intended to be used/referenced/extended by user code (as the below @LazyCrossReferencer@ type).
* @org.eclipse.sirius.common.tools.api.util.LazyCrossReferencer@ now extends @ECrossReferenceAdapterWithUnproxyCapability@ and implements @resolveProxyCrossReferences(Resource)@.
* The static method @org.eclipse.sirius.common.tools.api.util.ReflectionHelper.getFieldValueWithoutException(Class<?>, String)@ has been added to return an internal static value of a class.
+* @org.eclipse.sirius.common.tools.api.resource.ResourceSetSync@ has a new state @CHANGES_CANCELED@ used to define the state where the user canceled its changes.
h4. Changes in @org.eclipse.sirius.ecore.extender@
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CloseWithoutSavingTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CloseWithoutSavingTest.java
new file mode 100644
index 0000000000..8718ccaea9
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CloseWithoutSavingTest.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
+import org.eclipse.sirius.tests.swtbot.support.api.condition.ItemEnabledCondition;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper;
+import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
+import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler;
+import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+/**
+ * Tests that the session modifications are properly canceled when the user
+ * chooses to don't save the changes.
+ *
+ * @author Florian Barbin
+ */
+public class CloseWithoutSavingTest extends AbstractSiriusSwtBotGefTestCase implements EcoreModeler {
+
+ private static final String MODEL = "blank.ecore";
+
+ private static final String DATA_UNIT_DIR = "data/unit/blankEcore/";
+
+ private UILocalSession localSession;
+
+ private DDiagram diagram;
+
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL);
+ }
+
+ @Override
+ protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
+ UIResource semanticModel = new UIResource(designerProject, "/", MODEL);
+ localSession = designerPerspective.openSessionCreationWizardFromSemanticResource(semanticModel).fromAlreadySelectedSemanticResource().withDefaultSessionName().finish()
+ .selectViewpoints(DESIGN_VIEWPOINT_NAME);
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), ENTITIES_DESC_NAME, "root" + " package entities", DDiagram.class);
+ editor.save();
+ diagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), ENTITIES_DESC_NAME, "root" + " package entities");
+ }
+
+ /**
+ * This test creates multiple EPackages and make sure the restore to the
+ * last save point works properly.
+ */
+ public void testCreateMultipleElementsAndCloseWithoutSaving() {
+ assertEquals("The diagram should be empty", 0, diagram.getOwnedDiagramElements().size());
+ for (int i = 0; i < 35; i++) {
+ editor.activateTool("Package");
+ editor.click(new Point(2, 2));
+ SWTBotUtils.waitAllUiEvents();
+ }
+
+ // Closes the editor without saving.
+ SWTBotSiriusHelper.close(editor, true);
+ bot.waitUntilWidgetAppears(Conditions.shellIsActive("Save"));
+ final SWTBotShell uncontrolShell = bot.shell("Save");
+ uncontrolShell.activate();
+ SWTBotButton no = bot.button("No");
+ bot.waitUntilWidgetAppears(new ItemEnabledCondition(no));
+ no.click();
+
+ SWTBotUtils.waitAllUiEvents();
+
+ // Retrieves the diagram and makes sure it's empty.
+ diagram = (DDiagram) getRepresentationWithName(localSession.getOpenedSession(), ENTITIES_DESC_NAME, "root" + " package entities");
+ assertEquals("The diagram should be empty after having closed without saving.", 0, diagram.getDiagramElements().size());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ localSession = null;
+ diagram = null;
+ editor = null;
+ super.tearDown();
+ }
+
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index 4244b23f40..7c7e164182 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -170,6 +170,7 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(NodeCreationWithSnapToGridTest.class);
suite.addTestSuite(GenericClipboardSupportTest.class);
suite.addTestSuite(MultiSessionCopyPasteTest.class);
+ suite.addTestSuite(CloseWithoutSavingTest.class);
}
/**
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
index 38fc72e9ef..6a624fd06f 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/EditingSession.java
@@ -28,12 +28,16 @@ import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSession;
import org.eclipse.sirius.business.internal.session.ReloadingPolicyImpl;
+import org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.ResourceStatus;
+import org.eclipse.sirius.common.tools.api.resource.ResourceSyncClient;
+import org.eclipse.sirius.common.tools.api.resource.ResourceSyncClient.ResourceStatusChange;
import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil;
import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil;
import org.eclipse.sirius.tools.api.command.ui.RefreshFilter;
import org.eclipse.sirius.tools.api.command.ui.RefreshFilterManager;
import org.eclipse.sirius.ui.business.api.dialect.DialectEditor;
import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager;
+import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys;
import org.eclipse.sirius.ui.business.api.session.EditingSessionEvent;
import org.eclipse.sirius.ui.business.api.session.EditorNameAdapter;
import org.eclipse.sirius.ui.business.api.session.IEditingSession;
@@ -86,8 +90,6 @@ public class EditingSession implements IEditingSession, ISaveablesSource, Refres
*/
private EditorNameAdapter editorNameAdapter;
- private RestoreToLastSavePointListener restoreToSavePointListener;
-
private SaveSessionWhenNoDialectEditorsListener saveSessionListener;
/**
@@ -104,18 +106,11 @@ public class EditingSession implements IEditingSession, ISaveablesSource, Refres
}
private void initListeners() {
- this.restoreToSavePointListener = new RestoreToLastSavePointListener(session);
- this.restoreToSavePointListener.register();
this.saveSessionListener = new SaveSessionWhenNoDialectEditorsListener(session);
this.saveSessionListener.register();
}
private void removeListeners() {
- if (restoreToSavePointListener != null) {
- restoreToSavePointListener.unregister();
- restoreToSavePointListener.dispose();
- restoreToSavePointListener = null;
- }
if (this.saveSessionListener != null) {
this.saveSessionListener.unregister();
@@ -239,21 +234,53 @@ public class EditingSession implements IEditingSession, ISaveablesSource, Refres
int choice = ISaveablePart2.DEFAULT;
if (saveable != null) {
boolean stillOpenElsewhere = getEditors().size() > 1 && !closeAllDetected();
- boolean promptStandardDialog = !RestoreToLastSavePointListener.isAllowedToReturnToSyncState();
+ boolean promptStandardDialog = !isAllowedToReturnToSyncState();
choice = SWTUtil.showSaveDialog(session, saveable.getName(), true, stillOpenElsewhere, promptStandardDialog);
if (choice == ISaveablePart2.CANCEL) {
needSaveOnCloseDetec.reInit();
} else if (choice == ISaveablePart2.NO && (getEditors().size() == 1 || closeAllDetected())) {
- if (restoreToSavePointListener != null) {
- restoreToSavePointListener.returnToSyncState();
- }
+ returnToSyncState();
}
}
return choice;
}
+ /**
+ * Notifies the session that the changes have been canceled by user. That
+ * will cause the reloading of "changed" resources.
+ */
+ private void returnToSyncState() {
+ if (isAllowedToReturnToSyncState()) {
+ List<ResourceStatusChange> changes = new ArrayList<ResourceStatusChange>();
+ for (Resource currentResource : session.getAllSessionResources()) {
+ if (currentResource.isModified()) {
+ changes.add(new ResourceStatusChange(currentResource, ResourceStatus.CHANGES_CANCELED, ResourceStatus.CHANGED));
+ }
+ }
+ for (Resource currentResource : session.getSemanticResources()) {
+ if (currentResource.isModified()) {
+ changes.add(new ResourceStatusChange(currentResource, ResourceStatus.CHANGES_CANCELED, ResourceStatus.CHANGED));
+ }
+ }
+ if (session instanceof ResourceSyncClient) {
+ ((ResourceSyncClient) session).statusesChanged(changes);
+ }
+ }
+ }
+
+ /**
+ * Check the DesignerUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE
+ * preference state.
+ *
+ * @return the preference value.
+ */
+ private boolean isAllowedToReturnToSyncState() {
+ IPreferenceStore preferenceStore = SiriusEditPlugin.getPlugin().getPreferenceStore();
+ return preferenceStore != null && preferenceStore.getBoolean(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name());
+ }
+
private boolean closeAllDetected() {
return needSaveOnCloseDetec.closeAllDetected();
}
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java
deleted file mode 100644
index 89d25b9c5f..0000000000
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.sirius.ui.business.internal.session;
-
-import java.util.Collection;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.ObjectUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.sirius.business.api.session.Session;
-import org.eclipse.sirius.business.api.session.SessionStatus;
-import org.eclipse.sirius.common.tools.api.resource.ResourceSetSync;
-import org.eclipse.sirius.common.tools.api.resource.ResourceSetSync.ResourceStatus;
-import org.eclipse.sirius.common.tools.api.resource.ResourceSyncClient;
-import org.eclipse.sirius.ext.base.Option;
-import org.eclipse.sirius.tools.api.command.EditingDomainUndoContext;
-import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys;
-import org.eclipse.sirius.viewpoint.SiriusPlugin;
-import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin;
-
-/**
- * Marker able to restore the command stack to the last save point.
- *
- * @author mporhel
- */
-public class RestoreToLastSavePointListener implements ResourceSyncClient, IOperationHistoryListener {
-
- private IUndoableOperation marker;
-
- private Session session;
-
- /**
- * Create a new instance.
- *
- * @param session
- * the session to listen
- */
- public RestoreToLastSavePointListener(Session session) {
- this.session = session;
- }
-
- /**
- * Register this listener.
- */
- public void register() {
- OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(this);
- ResourceSetSync.getOrInstallResourceSetSync(session.getTransactionalEditingDomain()).registerClient(this);
- }
-
- /**
- * Unregister this listener.
- */
- public void unregister() {
- OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(this);
- // Do not call ResourceSetSync.getOrInstallResourceSetSync as the
- // ResourceSetSync could already have been removed.
- Option<ResourceSetSync> resourceSetSync = ResourceSetSync.getResourceSetSync(session.getTransactionalEditingDomain());
- if (resourceSetSync.some()) {
- resourceSetSync.get().unregisterClient(this);
- }
- }
-
- /**
- * Return to the last save point.
- */
- public void returnToSyncState() {
- if (isAllowedToReturnToSyncState()) {
- IProgressMonitor pm = new NullProgressMonitor();
- try {
- IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory();
- IUndoContext undoCtx;
- if (session.getTransactionalEditingDomain() != null) {
- if (session.getTransactionalEditingDomain().getCommandStack() instanceof IWorkspaceCommandStack) {
- undoCtx = ((IWorkspaceCommandStack) session.getTransactionalEditingDomain().getCommandStack()).getDefaultUndoContext();
- } else {
- undoCtx = new EditingDomainUndoContext(session.getTransactionalEditingDomain());
- }
- } else {
- undoCtx = new ObjectUndoContext(this);
- }
- while (operationHistory != null && operationHistory.canUndo(undoCtx) && session.getStatus() != SessionStatus.SYNC) {
- IUndoableOperation toUndo = operationHistory.getUndoOperation(undoCtx);
-
- operationHistory.undoOperation(toUndo, new NullProgressMonitor(), null);
-
- if (marker == toUndo) {
- break;
- }
- }
- session.save(pm);
- } catch (ExecutionException e) {
- // Session could not be reloaded, close it.
- session.close(pm);
- String sessionLabel = SiriusEditPlugin.getPlugin().getUiCallback().getSessionNameToDisplayWhileSaving(session);
- SiriusPlugin.getDefault().warning(sessionLabel + " were closed. An error occurs while attempting to cancel all modifications. No modification were saved.", e);
- }
- }
- }
-
- /**
- * Check the DesignerUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE
- * preference state.
- *
- * @return the preference value.
- */
- public static boolean isAllowedToReturnToSyncState() {
- IPreferenceStore preferenceStore = SiriusEditPlugin.getPlugin().getPreferenceStore();
- return preferenceStore != null && preferenceStore.getBoolean(SiriusUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE.name());
- }
-
- /**
- * Dispose this listener.
- */
- public void dispose() {
- session = null;
- marker = null;
- }
-
- /**
- * {@inheritDoc}
- */
- public void statusChanged(Resource resource, ResourceStatus oldStatus, ResourceStatus newStatus) {
- // Do nothing while processing,
- // see statusesChanged(Collection<ReResourceStatusChange>)
- }
-
- /**
- * {@inheritDoc}
- */
- public void statusesChanged(Collection<ResourceStatusChange> changes) {
- /* this may be call in a async thread */
- if (session != null) {
- if (SessionStatus.SYNC.equals(session.getStatus())) {
- marker = null;
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void historyNotification(OperationHistoryEvent event) {
- if (session != null && SessionStatus.DIRTY.equals(session.getStatus())) {
- if (marker == null) {
- marker = event.getOperation();
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/ReloadingPolicyImpl.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/ReloadingPolicyImpl.java
index bf6139b985..95fc4690ec 100644
--- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/ReloadingPolicyImpl.java
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/ReloadingPolicyImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.business.internal.session;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.emf.ecore.resource.Resource;
@@ -71,6 +72,9 @@ public class ReloadingPolicyImpl implements ReloadingPolicy {
case CONFLICTING_DELETED:
actions = handleExternalDeleteConflict(session, resource, newStatus);
break;
+ case CHANGES_CANCELED:
+ actions = handleChangesCanceled(session, resource, newStatus);
+ break;
default:
break;
}
@@ -78,6 +82,10 @@ public class ReloadingPolicyImpl implements ReloadingPolicy {
return actions;
}
+ private List<Action> handleChangesCanceled(Session session, Resource resource, ResourceStatus newStatus) {
+ return Arrays.asList(Action.RELOAD);
+ }
+
private List<Action> handleExternalChangeConflict(final Session session, final Resource resource, final ResourceStatus newStatus) {
final List<Action> actions = Lists.newArrayList();
if (shouldReload(resource)) {
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SessionResourcesSynchronizer.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SessionResourcesSynchronizer.java
index 746d820da7..a0be802f98 100644
--- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SessionResourcesSynchronizer.java
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/SessionResourcesSynchronizer.java
@@ -91,6 +91,7 @@ public class SessionResourcesSynchronizer implements ResourceSyncClient {
case CONFLICTING_CHANGED:
case CONFLICTING_DELETED:
case DELETED:
+ case CHANGES_CANCELED:
IProgressMonitor pm = new NullProgressMonitor();
for (Resource resource : newStatuses.get(newStatus)) {
try {
@@ -175,7 +176,7 @@ public class SessionResourcesSynchronizer implements ResourceSyncClient {
break;
}
}
-
+
private void reloadResource(final Resource resource) throws IOException {
session.notifyListeners(SessionListener.ABOUT_TO_BE_REPLACED);
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();

Back to the top