How to change the name at the runtime in eclipse emf [message #1863846] |
Fri, 01 March 2024 01:14  |
Eclipse User |
|
|
|
Let's say I have 2 class.
One's object contains name,type.
Second's object contains one object of class One and limit paramter.
Now, if i create an object of class One and give hive a name as XYZ. Then at the treeview side at the runtime we can see it's name changed form the class name to XYZ(parameter Name).
Now, when creating i linked that object to the second's object.
but after providing the name i can see the name change at the tree view side changes in only One's object.
And not in the Second's object linked one and it still points to the correct object of One's class.
I want if user change the name of One's Object.
It should reflect the change in the name of Second's object's One Paramter that is pointing to that object.
How can i do that??
Thank you in advance for the help.
|
|
|
Re: How to change the name at the runtime in eclipse emf [message #1863852 is a reply to message #1863846] |
Fri, 01 March 2024 05:41  |
Eclipse User |
|
|
|
A brute force approach would be to modify OneItemProviderAdapter from this generated code public void notifyChanged(Notification notification)
{
updateChildren(notification);
switch (notification.getFeatureID(One.class))
{
case MyPackage.ONE__NAME:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
} use "new ViewerNotification(notification, null, false, true))" to do a full refresh of the viewer when the label changes based on the premise that the name affects not only the label of the object itself but also the label of arbitrary other things in the tree and you don't want to do the work to find/track all those places that are affected.
|
|
|
Powered by
FUDForum. Page generated in 0.03134 seconds