We've checked in model changes:
*Bug 320171* <https://bugs.eclipse.org/bugs/show_bug.cgi?id=320171> - [Model]
Use real Java-References in the Binding-Model-Elements
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320171
This changes binding context references to references (instead of simple IDs
to be resolved by the runtime system).
We don't currently have an "upgrade old model" ability. For something XML
resource based, I did find a code snippet that can be used to load an old
model and then allow you to deal with attributes that are now "extra". Just
for posterity, here's an example that can migrate an old MBindingTable id to
a context reference:
// set up the load option:
set.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,
Boolean.TRUE);
// sample upgrade function:
private void processModelUpgrades(Resource resource) {
if (!(resource instanceof XMLResource)) {
return;
}
Map<EObject, AnyType> extensions = ((XMLResource) resource)
.getEObjectToExtensionMap();
MApplication application = (MApplication) resource.getContents().get(0);
TreeIterator<EObject> it = EcoreUtil.getAllContents(resource
.getContents());
while (it.hasNext()) {
EObject obj = it.next();
if (obj instanceof MBindingTable) {
AnyType anyType = extensions.get(obj);
for (Entry feature : anyType.getAnyAttribute()) {
if (feature.getEStructuralFeature().getName()
.equals("bindingContextId")) {
MBindingContext root = getBindingContext(application,
(String) feature.getValue());
((MBindingTable) obj).setBindingContext(root);
System.out.println("set " + root);
}
}
}
}
}
--
Paul Webster
Hi floor. Make me a sammich! - GIR
_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev