IMember member = root.getMember();
String memberName = JavaElementLabels.getTextLabel(member,
AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS |
JavaElementLabels.ALL_POST_QUALIFIED |
JavaElementLabels.P_COMPRESSED);
CallLocation location = root.getMethodCall().getFirstCallLocation();
HashMap<String,Object> result = new HashMap<String, Object>();
result.put("name", memberName);
if (location != null) {
// If caller, locationMember == member. If callee, locationMember
// is the function where the callee is called.
IMember locationMember = location.getMember();
IResource resource = locationMember.getResource();
if (resource != null) {
String file = resource.getLocation().toOSString().replace('\\', '/');
int offset = location.getStart();
result.put("position", Position.fromOffset(
file, null, offset, location.getEnd() - offset));
}
}
result.put(callees ? "callees" : "callers", formatRoots(
root.getCalls(new NullProgressMonitor()),