Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to modify a position attribute in real time?
https://www.eclipse.org/forums/index.php/mv/msg/207717/665281/#msg_665281
I'm beginner in GMF and I have to modify an attribute "position" (x/y) in a node in real time (every time we change object's position)
The problem is that I don't know where I have to put the code to do that ='(
Can you help me please?
Thanks,
Fenrir
]]>fenrir 2011-04-14T06:36:08-00:00Re: How to modify a position attribute in real time?
https://www.eclipse.org/forums/index.php/mv/msg/207717/665295/#msg_665295
Find the edit part for that node. In the edit part, add this method:
protected void handleNotificationEvent(Notification notification) {
super.handleNotificationEvent(notification);
..... my code here
}
Check when your desired event occurs (the position modification, for instance) and execute your code.
You will probably need to create and execute a Command in order to change the value of your attribute.
Good Luck,
emil salageanu
www.activeeon.com
]]>emil salageanu2011-04-14T08:17:07-00:00Re: How to modify a position attribute in real time?
https://www.eclipse.org/forums/index.php/mv/msg/207717/665357/#msg_665357
Thank you very much for your reply. =)
]]>fenrir 2011-04-14T12:37:54-00:00Re: How to modify a position attribute in real time?
https://www.eclipse.org/forums/index.php/mv/msg/207717/665723/#msg_665723
I'm beginner in GMF and I have the same problem of the position, can you please give me the code that you put in the method "protected void handleNotificationEvent (Notification notification)"
I need your help.
Thanks,
Rahma.]]>Rahma 2011-04-15T15:40:29-00:00Re: How to modify a position attribute in real time?
https://www.eclipse.org/forums/index.php/mv/msg/207717/665918/#msg_665918
//********************************************************** *****************
Point rect = this.getAbsoluteLocation(this);
BigInteger big1 = new BigInteger(""+rect.x);
BigInteger big2 = new BigInteger(""+rect.y);
EList<BigInteger> activation = new BasicEList<BigInteger>();
activation.add(big1);
activation.add(big2);
((ComponentImpl)this.getNotationView().getElement()).setActi vation_node(activation);
//********************************************************** ******************
I know this code isn't a must, but that's what I have to do^^