-
-
Save clementgpro/63cb84b6f431eef08e5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @see IActionDelegate#run(IAction) | |
*/ | |
public void run(IAction action) { | |
IStructuredSelection selection = (IStructuredSelection) targetPart | |
.getSite().getSelectionProvider().getSelection(); | |
EObject object = (EObject) selection.getFirstElement(); | |
EList<EReference> references = object.eClass().getEAllReferences(); | |
int sum = 0; | |
for(EReference r : references){ | |
EList children = (EList) object.eGet(r); | |
sum += children.size(); | |
} | |
System.out.println("The element has " + sum + " children"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment