Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » problem with update of layout model when changing the semantic model
problem with update of layout model when changing the semantic model [message #38367] Mon, 04 September 2006 12:50 Go to next message
Andre Crema is currently offline Andre CremaFriend
Messages: 3
Registered: July 2009
Junior Member
Hi there,

we extend GMF with the possibilty of adding complex editing operations. The
designer of the editor can define transformation rules (e.g. to add more
than one element to the diagram in one step) that will be applied on the
semantic model.
The changes in the semantic model are excecuted within a command. When
adding elements to the semantic model the layout model and the view are
updated correctly by GMF.
Here comes the Problem:
But when elements are deleted from the semantic model they remain in the
layout model. Only the reference to the semantic element (the <element.../>
tag in the source of the layout model) is deleted.
If the shouldDeleteView(View view) method of the XYZCanonicalEditPolicy
class of the topLevel element returns true, the elements are deleted
completely from the view, but in our case the test
"view.getElement().eIsProxy()" returns false and so the layout of the
diagram is incorrect.
I hope this is enough information for you to tell us what our problem is and
what we should do to make the elements to be deleted eProxys.

Thanks for helping ;o)

Andre Crema
TU Berlin - Tiger Project
Re: problem with update of layout model when changing the semantic model [message #39132 is a reply to message #38367] Tue, 05 September 2006 10:17 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Andre,

> "view.getElement().eIsProxy()" returns false and so the layout of the
> diagram is incorrect.
This method works correctly if you reopen the diagram. The problem is:
if you remove element from the model it remains in memory, so corresponding
view will hold non-null reference to this element and this condition will
not trigger delete view process. You can try modifying corresponding method
implementation. For example:

view.isSetElement() && view.getElement() != null && (view.getElement().eIsProxy()
|| view.getElement().eContainer() == null);

If you submitt corresponding request, we'll be able to patch generator to
always perform this check.

-----------------
Alex Shatalin
Re: problem with update of layout model when changing the semantic model [message #39224 is a reply to message #39132] Tue, 05 September 2006 10:32 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi All,

> view.isSetElement() && view.getElement() != null &&
> (view.getElement().eIsProxy() || view.getElement().eContainer() == null);

view.getElement().eResource() == null should be used as a condition to
correctly process elements whose *distant* ancestors were removed.

Best regards,
Boris
Re: problem with update of layout model when changing the semantic model [message #39967 is a reply to message #39132] Tue, 05 September 2006 19:26 Go to previous messageGo to next message
Andre Crema is currently offline Andre CremaFriend
Messages: 3
Registered: July 2009
Junior Member
Hi Alex,

"Alex Shatalin" <vano@borland.com> schrieb im Newsbeitrag
news:cd695fb3115388c89efc73d8b10d@news.eclipse.org...
> Hello Andre,
>
>> "view.getElement().eIsProxy()" returns false and so the layout of the
>> diagram is incorrect.
> This method works correctly if you reopen the diagram. The problem is: if
> you remove element from the model it remains in memory, so corresponding
> view will hold non-null reference to this element and this condition will
> not trigger delete view process. You can try modifying corresponding
> method implementation. For example:
>
> view.isSetElement() && view.getElement() != null &&
> (view.getElement().eIsProxy() || view.getElement().eContainer() == null);
>
> If you submitt corresponding request, we'll be able to patch generator to
> always perform this check.

This works fine with deleted elements! Thank you for this hint.

But there is still a problem with some edges in some cases. Here is an
example:
I have two nodes A and B connected with an edge e(A- e - B before
transformation step).
The following changes are done in one step:
I insert a third node C between A and B, the edge e now connects A and C and
I insert another edge f that connects C and B (A - e - C - f - B after
transformation step).
The semantic model is changed correctly.
But in the view there is still the edge between A and B whose <element.../>
tag is still in the layout model and pointing to the changed edge of the
semantic model. There are now two layout edges pointing to this semantic
edge.
When I delete the eIsProxy() and eContainer() == null test in
XYCanonicalEditPolicy's shouldDeleteView method, everything works fine again
and the edge is deleted correctly.
Do you have any explanation for that?


> -----------------
> Alex Shatalin
>

Thank you again for helping

Andre Crema
TU Berlin - Tiger Project
Re: problem with update of layout model when changing the semantic model [message #40540 is a reply to message #39967] Wed, 06 September 2006 10:28 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Andre,

Current implementation of shouldDeleteView() method was introduced before
the release to fix the following request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=148813.
I suppose you do not have such elements in your model, so you can implement
this method in the following way:

protected boolean shouldDeleteView(View view) {
if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
return false;
}
return view.isSetElement() && view.getElement() != null;
}

Can you please submit bugzilla entry for this problem?

-----------------
Alex Shatalin
Previous Topic:ArrangeRequest
Next Topic:Internal Error while generating *.gmfgen. what does it mean?
Goto Forum:
  


Current Time: Sat Nov 09 03:32:13 GMT 2024

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

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

Back to the top