Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Making figures sensitive to attributes of semantic elements
Making figures sensitive to attributes of semantic elements [message #214922] Fri, 09 January 2009 15:27 Go to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

Hey Guys.

I read the following page in eclipse wiki and the followed the steps
described there:

http://wiki.eclipse.org/GMF_Tips#Making_figures_sensitive_to _attributes_of_semantic_elements

Unfortunately, there is still a problem:
The changes made via updateFace() are not persisted in the diagram file.
In my case, line color is changed in updateFace() to red, but after
saving, closing and re-opening the diagram, the line color is still gray.

Any ideas how to fix this problem?

Cheers,
Mark
Re: Making figures sensitive to attributes of semantic elements [message #214942 is a reply to message #214922] Sun, 11 January 2009 08:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgreen.upb.de

Hi Mark,

Mark L. wrote:
> Hey Guys.
>
> I read the following page in eclipse wiki and the followed the steps
> described there:
>
> http://wiki.eclipse.org/GMF_Tips#Making_figures_sensitive_to _attributes_of_semantic_elements
>
>
> Unfortunately, there is still a problem:
> The changes made via updateFace() are not persisted in the diagram file.
> In my case, line color is changed in updateFace() to red, but after
> saving, closing and re-opening the diagram, the line color is still gray.

You should store the semantic changes in the model file. Adding the "updateFace()" to the constructor does the job of
having an "updated" figure when the diagram if opened.

Joel

>
> Any ideas how to fix this problem?
>
> Cheers,
> Mark
Re: Making figures sensitive to attributes of semantic elements [message #215053 is a reply to message #214942] Mon, 12 January 2009 21:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

Hello everybody.

At first, thanks to Joel. My mistake.

> You should store the semantic changes in the model file. Adding the
> "updateFace()" to the constructor does the job of having an "updated"
> figure when the diagram if opened.

After adding updateFace() to the constructor a part of the problem still
remains. When reopening the diagram file, labels in the node (that are
affected by updateFace, too) have their original color.

To me, it seems that WrappingLabel.setForegroundColor has no effect, if
it is called from a constructor of a Figure. Sounds pretty strange, I know.

Do you guys have any hints how to solve that?

Regards,
Mark
Re: Making figures sensitive to attributes of semantic elements [message #215164 is a reply to message #215053] Wed, 14 January 2009 00:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jgreen.upb.de

Hi Mark,

Mark L. wrote:
> Hello everybody.
>
> At first, thanks to Joel. My mistake.
>
>> You should store the semantic changes in the model file. Adding the
>> "updateFace()" to the constructor does the job of having an "updated"
>> figure when the diagram if opened.
>
> After adding updateFace() to the constructor a part of the problem still
> remains. When reopening the diagram file, labels in the node (that are
> affected by updateFace, too) have their original color.
>
> To me, it seems that WrappingLabel.setForegroundColor has no effect, if
> it is called from a constructor of a Figure.

Where are you calling what? Are you trying to update child figures? In the GMF tutorial, the updateFace() is called
before createContents() where your WrappingLabels will be created. You may want to try calling the uodateFace() after
the createContents() -- I don't know why they propose this order.
Or try modifying the createContents() method.

Joel

> Sounds pretty strange, I know.
>
> Do you guys have any hints how to solve that?
>
> Regards,
> Mark
Re: Making figures sensitive to attributes of semantic elements [message #215242 is a reply to message #215164] Wed, 14 January 2009 20:38 Go to previous message
Eclipse UserFriend
Originally posted by: ML1984.gmx.de

Hi all.

It's working now. There were subsequent calls to setForegroundColor
after the ones in my code. I suggest the following steps for
"making figures sensitive to attributes of semantic elements":

- React on direct changes of semantic element (in all cases):
override handleNotificationEvent (as described in the wiki)

- Initialization after reopening the diagram file:
- Nodes: add init code to end of constructor
(as described in the wiki)
- Labels: add init code to the end of refreshVisuals
- Edges: add new method refreshVisuals (overrides inherited one);
add call to refreshVisuals of the superclass;
add init code

If you think this is absolutely wrong, please tell me/us.

Cheers,
Mark
Previous Topic:Creating EAttributes at runtime
Next Topic:Hiding connectors
Goto Forum:
  


Current Time: Thu Sep 26 09:06:04 GMT 2024

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

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

Back to the top