// pid
OtpErlangPid pid = null;
if (processTuple.arity() == 3) {
// {Pid(), Initial_call()|Registered_name(), Node()}
pid = (OtpErlangPid) processTuple.elementAt(INDEX_PROCESS_PID);
pidNode = new TreeNode("pid: " + pid2Str(pid),
Activator.getImage(Images.INFO_NODE));
} else {
index = 1;// tuple doesn't contain Pid element
}
final OtpErlangObject info = processTuple.elementAt(INDEX_PROCESS_INFO
- index);
// process node
final OtpErlangObject processNode = processTuple.elementAt(INDEX_PROCESS_NODE
- index);
processNodeNode = new TreeNode("node: " + processNode,
Activator.getImage(Images.INFO_NODE));
if (info instanceof OtpErlangTuple) {
// initial call
functionNode = createFunctionNode("initial call:", info);
functionNode.setImage(Activator.getImage(Images.INFO_NODE));
if (pid != null) {
builder.append(pid2Str(pid));
} else {
builder.append(lastFunctionDescription);
}
} else {
// registered name
nameNode = new TreeNode("name: " + info,
Activator.getImage(Images.INFO_NODE));
builder.append(info.toString());
}
builder.append(" (").append(processNode).append(")");
} else if (erlangObject instanceof OtpErlangPid) {
// Pid
final OtpErlangPid pid = (OtpErlangPid) erlangObject;
pidNode = new TreeNode("pid: " + pid2Str(pid),
Activator.getImage(Images.INFO_NODE));
processNodeNode = new TreeNode("node: " + pid.node(),
Activator.getImage(Images.INFO_NODE));
builder.append(pid2Str(pid)).append(" (").append(pid.node()).append(")");
} else {
// Atom (registered name)
nameNode = new TreeNode("name: " + erlangObject,
Activator.getImage(Images.INFO_NODE));
builder.append(erlangObject.toString());
}
final ITreeNode node = new TreeNode();
if (pidNode != null) {
node.addChildren(pidNode);
}
if (nameNode != null) {
node.addChildren(nameNode);
}
if (processNodeNode != null) {
node.addChildren(processNodeNode);
}
if (functionNode != null) {
node.addChildren(functionNode);
}
lastProcessDescription = builder.toString();
node.setLabel(label + lastProcessDescription);
return node;
}