How can I get the id of a element in the source code [message #956371] |
Wed, 24 October 2012 09:01  |
Eclipse User |
|
|
|
Recently,I am working on a project using the source code of Papyrus.
when I select a node of the model,i expect to get the element id.
The sitituation is like this,I can get the name,type et al.However what I want is to locate the element in the file(midel.uml),so I want to get the id.
the core code I write is as below:
List<IGraphicalEditPart> editParts = getSelectedElements();
Iterator<IGraphicalEditPart> it = editParts.iterator();
while(it.hasNext()) {
IGraphicalEditPart editPart = it.next();
if(!(editPart instanceof DiagramEditPart)) {
NamedElementImpl selectedElement = (NamedElementImpl)(editPart.resolveSemanticElement());
System.out.println(selectedElement.getName());
}
...
Can you please give a helping hand?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03509 seconds