Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2010-04-18 14:25:10 +0000
committerMartin Fluegge2010-04-18 14:25:10 +0000
commitcc336965101b9f2bfa2a8f710d6c9ab3a8355a93 (patch)
tree90395999eafb01aae1717d792f8c5f4b21d69190 /plugins
parent26310122fc84bf8ba85192cec565fa175b236965 (diff)
downloadcdo-cc336965101b9f2bfa2a8f710d6c9ab3a8355a93.tar.gz
cdo-cc336965101b9f2bfa2a8f710d6c9ab3a8355a93.tar.xz
cdo-cc336965101b9f2bfa2a8f710d6c9ab3a8355a93.zip
[308232] [Dawn] Develop collaborative support for GMF on CDO
https://bugs.eclipse.org/bugs/show_bug.cgi?id=308232
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/DawnDiagramUpdater.java54
2 files changed, 41 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
index 2ff5009e83..5e990339a5 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/copyright.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Martin Fluegge(Berlin, Germany) and others.
+Copyright (c) 2010 Martin Fluegge (Berlin, Germany) 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
diff --git a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/DawnDiagramUpdater.java b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/DawnDiagramUpdater.java
index d32cddd309..d14ef6737f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/DawnDiagramUpdater.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.util/src/org/eclipse/emf/cdo/dawn/util/DawnDiagramUpdater.java
@@ -23,6 +23,8 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -92,7 +94,6 @@ public class DawnDiagramUpdater
{
try
{
- editPart.refresh();
// EObject modelElement = ((View)(editPart).getModel()).getElement();
// List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
@@ -100,20 +101,14 @@ public class DawnDiagramUpdater
// {
// CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
// nextEditPolicy.refresh();
- //
// }
+
+ editPart.refresh();
}
catch (Exception e)
{
e.printStackTrace();
}
- for (Object childEditPart : editPart.getChildren())
- {
- if (childEditPart instanceof EditPart)
- {
- refeshEditpartInternal((EditPart)childEditPart);
- }
- }
if (editPart instanceof DiagramEditPart)
{
@@ -126,6 +121,13 @@ public class DawnDiagramUpdater
}
}
}
+ for (Object childEditPart : editPart.getChildren())
+ {
+ if (childEditPart instanceof EditPart)
+ {
+ refeshEditpartInternal((EditPart)childEditPart);
+ }
+ }
}
else
@@ -149,15 +151,12 @@ public class DawnDiagramUpdater
}
else
{
- findView(element.eContainer());
+ return findView(element.eContainer());
}
}
- return null;
+ // return null;
}
- /**
- * TODO: Martin: shouldmove this to a helper class or change with an existing GMF helper
- */
public static View findViewForModel(EObject object, DiagramDocumentEditor editor)
{
@@ -274,4 +273,31 @@ public class DawnDiagramUpdater
return (EditPart)viewer.getEditPartRegistry().get(view);
}
+ /**
+ * In a normal GMF environment the diagram is loaded from a xml resource. In this scenario the XMLHelper sets "null"
+ * to the element of edge. Thus the value is 'set' with a null value. We do not have this in our case because the
+ * element is carefully loaded from the CDO repository. But if the value is not set a getElement() call fills the
+ * element with the eContainer. See <b>org.eclipse.gmf.runtime.notation.impl.ViewImpl.isSetElement()</b>. This happens
+ * when the ConnectionEditPart is activated and the model registered. See
+ * <b>org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart.registerModel()</b>
+ * <p>
+ * In our scenario the Edges will be wrongly connected to the diagram itself, which makes the CanonicalEditingPolicy
+ * to remove and restore the edge. Long, short story, we must 'to' the elements here to have the element set.
+ *
+ * @param diagram
+ */
+ public static void initializeElement(Diagram diagram)
+ {
+ for (Object obj : diagram.getEdges())
+ {
+ Edge edge = (Edge)obj;
+ if (!edge.isSetElement())
+ {
+ boolean eDeliver = edge.eDeliver();
+ edge.eSetDeliver(false);
+ edge.setElement(null);
+ edge.eSetDeliver(eDeliver);
+ }
+ }
+ }
}

Back to the top