Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Updating Link's label
Updating Link's label [message #425375] Sun, 23 November 2008 03:15 Go to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hello,

I have modified the getText() method for my LinkItemProvider.
The customized getText() returns "Link to Node X" where X is the name of
the destination node. If I change the name of node X, the label of the
link still has the old name.

For example if the node was called A, the Link label was "Link to Node
A" and after changing the name of node A to B, the link still says "Link
to Node A".

How can I force the Link's label to update?

Thanks!
Best regards,

tamer
Re: Updating Link's label [message #425379 is a reply to message #425375] Sun, 23 November 2008 08:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30898
Registered: July 2009
Senior Member
Tamer,

Comments below.

Tamer wrote:
> Hello,
>
> I have modified the getText() method for my LinkItemProvider.
> The customized getText() returns "Link to Node X" where X is the name
> of the destination node. If I change the name of node X, the label of
> the link still has the old name.
Yes, we have some issues like that what Ecore as well, where we show the
name of a typed element's type.
>
> For example if the node was called A, the Link label was "Link to Node
> A" and after changing the name of node A to B, the link still says
> "Link to Node A".
>
> How can I force the Link's label to update?
Does that reference have an inverse? I.e., from the linked node can you
know all the referencing nodes? If not, an CrossReferenceAdapter can
help with that part. The idea would be that you need to produce a label
updating ViewerNotification with the Link object as the object to
update. You can look at how things like EGenericTypeItemProvider does
something similar in the notifyChanged method.
>
> Thanks!
> Best regards,
>
> tamer
Re: Updating Link's label [message #425387 is a reply to message #425379] Mon, 24 November 2008 02:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hi Ed,

I modified the NodeItemProvider's notifyChanged() method to iterate over
the links of the node and invoke fireNotifyChanged on each one.

The Link labels get updated.

However in my tree I show the links twice (once under the source node
and once under the destination node). I can only get the one under the
source node to update (that is the node that contains it).

I don't really understand how I could update the other reference to the
link (the one under the destination node).

Thanks for your help.
Regards,

tamer

Ed Merks wrote:
> Tamer,
>
> Comments below.
>
> Tamer wrote:
>> Hello,
>>
>> I have modified the getText() method for my LinkItemProvider.
>> The customized getText() returns "Link to Node X" where X is the name
>> of the destination node. If I change the name of node X, the label of
>> the link still has the old name.
> Yes, we have some issues like that what Ecore as well, where we show the
> name of a typed element's type.
>>
>> For example if the node was called A, the Link label was "Link to Node
>> A" and after changing the name of node A to B, the link still says
>> "Link to Node A".
>>
>> How can I force the Link's label to update?
> Does that reference have an inverse? I.e., from the linked node can you
> know all the referencing nodes? If not, an CrossReferenceAdapter can
> help with that part. The idea would be that you need to produce a label
> updating ViewerNotification with the Link object as the object to
> update. You can look at how things like EGenericTypeItemProvider does
> something similar in the notifyChanged method.
>>
>> Thanks!
>> Best regards,
>>
>> tamer
Re: Updating Link's label [message #425393 is a reply to message #425387] Mon, 24 November 2008 13:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30898
Registered: July 2009
Senior Member
Tamer,

Specializing ItemProviderAdapter's isWrappingNeeded will likely do the
trick.


Tamer wrote:
> Hi Ed,
>
> I modified the NodeItemProvider's notifyChanged() method to iterate
> over the links of the node and invoke fireNotifyChanged on each one.
>
> The Link labels get updated.
>
> However in my tree I show the links twice (once under the source node
> and once under the destination node). I can only get the one under the
> source node to update (that is the node that contains it).
>
> I don't really understand how I could update the other reference to
> the link (the one under the destination node).
>
> Thanks for your help.
> Regards,
>
> tamer
>
> Ed Merks wrote:
>> Tamer,
>>
>> Comments below.
>>
>> Tamer wrote:
>>> Hello,
>>>
>>> I have modified the getText() method for my LinkItemProvider.
>>> The customized getText() returns "Link to Node X" where X is the
>>> name of the destination node. If I change the name of node X, the
>>> label of the link still has the old name.
>> Yes, we have some issues like that what Ecore as well, where we show
>> the name of a typed element's type.
>>>
>>> For example if the node was called A, the Link label was "Link to
>>> Node A" and after changing the name of node A to B, the link still
>>> says "Link to Node A".
>>>
>>> How can I force the Link's label to update?
>> Does that reference have an inverse? I.e., from the linked node can
>> you know all the referencing nodes? If not, an CrossReferenceAdapter
>> can help with that part. The idea would be that you need to produce
>> a label updating ViewerNotification with the Link object as the
>> object to update. You can look at how things like
>> EGenericTypeItemProvider does something similar in the notifyChanged
>> method.
>>>
>>> Thanks!
>>> Best regards,
>>>
>>> tamer
Previous Topic:Observing derived features
Next Topic:Named query problem
Goto Forum:
  


Current Time: Mon Feb 24 12:55:50 GMT 2020

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

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

Back to the top