Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to change the name at the runtime in eclipse emf
How to change the name at the runtime in eclipse emf [message #1863846] Fri, 01 March 2024 06:14 Go to next message
Sachin Goyal is currently offline Sachin GoyalFriend
Messages: 19
Registered: February 2024
Junior Member
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 10:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Tree view on Xtext model file on the first run not working (crosspost)
Next Topic:[CDO] Commit Exception on the second commit after thread interruption
Goto Forum:
  


Current Time: Thu May 02 05:36:47 GMT 2024

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

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

Back to the top