0
在独立ViewPart中,我设法在OutlineView中选择了EObjectNode。我现在需要获取它引用的EObject,但我看不出如何。如何从EObjectNode获取EObject
在独立ViewPart中,我设法在OutlineView中选择了EObjectNode。我现在需要获取它引用的EObject,但我看不出如何。如何从EObjectNode获取EObject
if (selection instanceof IStructuredSelection) {
Object first = ((IStructuredSelection)selection).getFirstElement();
EObjectNode enode = (EObjectNode)first;
ResourceSet resourceSet = new ResourceSetImpl();
Resource inResource = resourceSet.getResource(enode.getEObjectURI(),true);
MyEcoreElement element = (MyEcoreElement)inResource.getEObject(enode.getEObjectURI().fragment());
//....
}