Acces of node element from outside [message #1060672] |
Mon, 27 May 2013 16:08  |
Eclipse User |
|
|
|
Hi,
I'm using Xtext and GMF and therefor I would like to acces the current selected node in my xtext project in order to get the child of this node exported.

For exampple if Super Class 1 is selected, I want to acces this class in my xtext project to get the childs B and C. Is there a way to do this?
|
|
|
|
|
Re: Acces of node element from outside [message #1061873 is a reply to message #1060672] |
Tue, 04 June 2013 13:03  |
Eclipse User |
|
|
|
Hi,
thanks for the hint. I tried to implement the selection service, but it didn't seems to acces the GMF related node. Rather that I get an xtext class object, because I implmented an IXtextAwareEditPart in GMF. Is there a way to acces the active GMF node?
This code hasn't work for me so far:
ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
ISelection selection = selectionService.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection iStructuredSelection = (IStructuredSelection) selection;
if (iStructuredSelection.getFirstElement() instanceof PartImpl) {
PartImpl partImpl = (PartImpl) iStructuredSelection; // <------ The xtext class
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02632 seconds