Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement