Default Update Feature and Unresolvable Proxies [message #897622] |
Tue, 24 July 2012 15:29  |
Eclipse User |
|
|
|
Hey all,
I've got a situation where I have the business model and diagram model in separate files. I was expecting the default getUpdateFeature() to determine whether or not a shape was missing business objects, so it would correctly return an UpdateNoBoFeature. However, in this case, a business object is being found, but it is a proxy that cannot be resolved (i.e. it's been deleted from the business model).
That said, I'm not sure how best to correct this. I think the best place would be in link service, where it would filter out BOs that cannot be resolved. An alternative would be to udpate the default getUpdateFeature() to examine the returned BOs.
What do you think?
Best,
Rob
|
|
|
|
|
Re: Default Update Feature and Unresolvable Proxies [message #897669 is a reply to message #897633] |
Tue, 24 July 2012 23:43  |
Eclipse User |
|
|
|
Rob,
You might want to check for object.eIsProxy() instead of checking a
non-null eContainer(). In general an EObject might have a null
eContainer() but a non-null eResource(), i.e., if it's a root object
contained by a resource resource it won't have a container but it's
still a useable resolved object.
On 24/07/2012 10:17 PM, Rob Cernich wrote:
> I'm working around the problem by adding the following to a customized
> DefaultPersistencyBehavior.loadDiagram():
>
> final Diagram finalDiagram = diagram;
> // clean out unresolvable links
> getEditingDomain().getCommandStack().execute(new
> RecordingCommand(getEditingDomain()) {
> @Override
> protected void doExecute() {
> for (PictogramLink link : finalDiagram.getPictogramLinks()) {
> for (EObject object : new
> ArrayList<EObject>(link.getBusinessObjects())) {
> if (object.eContainer() == null) {
> link.getBusinessObjects().remove(object);
> }
> }
> }
> }
> });
>
|
|
|
Powered by
FUDForum. Page generated in 0.03823 seconds