Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Change element's attributes from a popup action
Change element's attributes from a popup action [message #659725] Tue, 15 March 2011 11:15 Go to next message
Aintzane  is currently offline Aintzane
Messages: 10
Registered: March 2011
Junior Member
Hi,

Is there any way of updating the attributes of an element created in an action executed from a popup menu? I can access to the selected element's edit part, or to a new element's edit part created by means of a CreateViewRequest, but I cannot access to these element's model part. How can be done?

Thanks in advance,

Aintzane
icon14.gif  Re: Change element's attributes from a popup action [message #659753 is a reply to message #659725] Tue, 15 March 2011 13:55 Go to previous message
Aintzane  is currently offline Aintzane
Messages: 10
Registered: March 2011
Junior Member
I found how to do it, following this topic: http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg01922.html

XXXEditPart selectedElement;

//get the EditingDomain from the DiagramEditor
EditingDomain editingDomain = selectedElement.getEditingDomain();
//Selected element
XXXImpl xxxElement = (XXXImpl)((NodeImpl)selectedElement.getModel()).getElement() ;
//EReference of the attribute
EAttribute attr = xxxxxPackage.eINSTANCE.getXXXe_attrName();
//Create the SetCommand from the editing domain
editingDomain.getCommandStack().execute(SetCommand.create(ed itingDomain, xxxElement, attr, attr_value));

Thanks,

Aintzane
Previous Topic:Finding difficulties to open a GMF editor from another GMF editor
Next Topic:[Solved] How To get the model from the EditPart?
Goto Forum:
  


Current Time: Thu Oct 02 04:30:41 GMT 2014

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

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