Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2014-03-13 10:43:57 +0000
committerLaurent Redor2014-03-14 08:11:47 +0000
commit5636a359cfb651dd123389d81f33e86ddee93e8f (patch)
treed14211349c82a79d9c722389dbf5694615148885
parent361e0eccf42054b056fe5528392ac953be0714b4 (diff)
downloadorg.eclipse.sirius-5636a359cfb651dd123389d81f33e86ddee93e8f.tar.gz
org.eclipse.sirius-5636a359cfb651dd123389d81f33e86ddee93e8f.tar.xz
org.eclipse.sirius-5636a359cfb651dd123389d81f33e86ddee93e8f.zip
[430268] Reinit the gmfDiagramUpdater at each input changes
This avoids inconsistencies in DDiagram listeners after session reloading. Bug: 430268 Change-Id: I543e407831618596fe23b1ecd4db069925679fdd Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/DDiagramEditorImpl.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/DDiagramEditorImpl.java b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/DDiagramEditorImpl.java
index b39b59c38f..5cf0b2460b 100644
--- a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/DDiagramEditorImpl.java
+++ b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/tools/internal/editor/DDiagramEditorImpl.java
@@ -361,11 +361,6 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
super.init(site, correctedInput);
- EObject element = getDiagram().getElement();
- if (element instanceof DDiagram) {
- gmfDiagramUpdater = new GMFDiagramUpdater(getSession(), (DDiagram) element);
- }
-
if (getSession() != null) {
getSession().addListener(this);
@@ -616,7 +611,6 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
paletteTransferDropTargetListener = new SiriusPaletteToolDropTargetListener(getGraphicalViewer());
getDiagramGraphicalViewer().addDropTargetListener(paletteTransferDropTargetListener);
-
/* initialize Java Service. */
EObject semantic = ViewUtil.resolveSemanticElement(gmfDiagram);
if (semantic instanceof DSemanticDecorator) {
@@ -1277,8 +1271,7 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
* @see org.eclipse.sirius.diagram.part.SiriusDiagramEditor#getAdapter(java.lang.Class)
*/
@Override
- public Object getAdapter(@SuppressWarnings("rawtypes")
- final Class type) {
+ public Object getAdapter(@SuppressWarnings("rawtypes") final Class type) {
Object adapter = null;
if (type == IDiagramCommandFactoryProvider.class) {
adapter = this.emfCommandFactoryProvider;
@@ -1795,6 +1788,14 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE
if (diagramHeaderComposite != null && !diagramHeaderComposite.isDisposed()) {
diagramHeaderComposite.rebuildHeaderSection();
}
+
+ // The input has changed, replace the existing gmfDiagramUpdater
+ if (gmfDiagramUpdater != null) {
+ gmfDiagramUpdater.dispose();
+ }
+ if (representation instanceof DDiagram) {
+ gmfDiagramUpdater = new GMFDiagramUpdater(getSession(), (DDiagram) representation);
+ }
}
/**

Back to the top