Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2010-12-08 00:26:44 -0500
committeratikhomirov2010-12-08 00:26:44 -0500
commit73dcab8bc2eacda28517ee40b1de6932c39b40c3 (patch)
treebb99d439abe45deb3068269a6aee915bae1aa736
parent60f8a4bb639f2b5873f1ef125da3fe4ef213a3ba (diff)
downloadorg.eclipse.gmf-tooling-73dcab8bc2eacda28517ee40b1de6932c39b40c3.tar.gz
org.eclipse.gmf-tooling-73dcab8bc2eacda28517ee40b1de6932c39b40c3.tar.xz
org.eclipse.gmf-tooling-73dcab8bc2eacda28517ee40b1de6932c39b40c3.zip
[314670] Edges are not properly synchronized with semantic element
-rw-r--r--plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt27
2 files changed, 28 insertions, 1 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
index ca2bfb560..222c66be2 100644
--- a/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.codegen/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.gmf.codegen; singleton:=true
-Bundle-Version: 2.2.100.qualifier
+Bundle-Version: 2.2.200.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.gmf.codegen.gmfgen,
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
index 2a48c46f2..44157aff3 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/update/CanonicalUpdate.xpt
@@ -19,6 +19,8 @@
«DEFINE body FOR gmfgen::GenContainerBase-»
«EXPAND attributes-»
+ «EXPAND refreshOnActivateMethod-»
+
«EXPAND getFeaturesToSynchronizeMethod-»
«EXPAND getSemanticChildrenListMethod-»
@@ -37,6 +39,25 @@
«ENDIF-»
«ENDDEFINE»
+«REM»
+ The canonical update mechanism of the GMF Runtime heavily depends on EditPart listeners being registered
+ prior to actual canonical update (thus, any change from this policy gets known to the interested EditParts.
+ NodeEditPart.activate() installs a transaction post-commit listener that refreshes the edit part. Canonical EditPolicy
+ is installed on a top (diagram) element, and its activation happens before diagram children get activated (and have a chance
+ to install their listeners). Hence this what I believe to be an questionable hack (at least, GEF's
+ activation sequence gets violated). See bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=314670
+«ENDREM»
+«DEFINE refreshOnActivateMethod FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshOnActivate() {
+ // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners
+ «EXPAND CodeStyle::G('java.util.List', '?')» c = getHost().getChildren();
+ for (int i = 0; i < c.size(); i++) {
+ ((org.eclipse.gef.EditPart) c.get(i)).activate();
+ }
+ super.refreshOnActivate();
+ }
+«ENDDEFINE»
«DEFINE getFeaturesToSynchronizeMethod FOR gmfgen::GenContainerBase-»
«IF getSemanticChildrenChildFeatures(self)->size() = 1-»
@@ -303,6 +324,7 @@ private «EXPAND CodeStyle::G('java.util.Collection', editorGen.diagramUpdater.g
«EXPAND xpt::Common::generatedMemberComment»
private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.core.runtime.IAdaptable')» createConnections(«EXPAND CodeStyle::G('java.util.Collection', editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName())» linkDescriptors, «EXPAND CodeStyle::G2('java.util.Map', 'org.eclipse.emf.ecore.EObject', 'org.eclipse.gmf.runtime.notation.View')» domain2NotationMap) {
«EXPAND CodeStyle::newGenericInstance('adapters', 'java.util.LinkedList', 'org.eclipse.core.runtime.IAdaptable')»();
+ «EXPAND CodeStyle::newGenericInstance('toRefresh', 'java.util.HashSet', 'org.eclipse.gef.EditPart')»();
«EXPAND CodeStyle::iterate('nextLinkDescriptor', editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName(), 'linkDescriptors')-»
org.eclipse.gef.EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
org.eclipse.gef.EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
@@ -323,8 +345,13 @@ private «EXPAND CodeStyle::G('java.util.Collection', 'org.eclipse.core.runtime.
if (viewAdapter != null) {
adapters.add(viewAdapter);
}
+ toRefresh.add(sourceEditPart);
+ toRefresh.add(targetEditPart);
}
}
+ «EXPAND CodeStyle::iterate('ep', 'org.eclipse.gef.EditPart', 'toRefresh')-»
+ ep.refresh();
+ }
return adapters;
}
«ENDDEFINE»

Back to the top