Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Default Update Feature and Unresolvable Proxies
Default Update Feature and Unresolvable Proxies [message #897622] Tue, 24 July 2012 19:29 Go to next message
Rob Cernich is currently offline Rob Cernich
Messages: 40
Registered: September 2011
Member
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 #897624 is a reply to message #897622] Tue, 24 July 2012 19:35 Go to previous messageGo to next message
Rob Cernich is currently offline Rob Cernich
Messages: 40
Registered: September 2011
Member
I just noticed UpdateNoBoFeature relies on PictogramLink.getBusinessObjects(), which would contain the proxies (meaning the feature would never execute).
Re: Default Update Feature and Unresolvable Proxies [message #897633 is a reply to message #897624] Tue, 24 July 2012 20:17 Go to previous messageGo to next message
Rob Cernich is currently offline Rob Cernich
Messages: 40
Registered: September 2011
Member
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);
                }
            }
        }
    }
});
Re: Default Update Feature and Unresolvable Proxies [message #897669 is a reply to message #897633] Wed, 25 July 2012 03:43 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
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);
> }
> }
> }
> }
> });
>
Previous Topic:ManhattanConnectionRouter
Next Topic:Connections to a Polygon figure are not properly connected to its borders
Goto Forum:
  


Current Time: Thu Sep 18 15:57:02 GMT 2014

Powered by FUDForum. Page generated in 0.02292 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software