use of org.erlide.tracing.core.mvc.model.treenodes.TreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method createProcessNode.
private ITreeNode createProcessNode(final String label, final OtpErlangObject erlangObject) {
final StringBuilder builder = new StringBuilder();
ITreeNode functionNode = null;
ITreeNode nameNode = null;
ITreeNode pidNode = null;
ITreeNode processNodeNode = null;
if (erlangObject instanceof OtpErlangTuple) {
// tuple: {Pid(), Initial_call()|Registered_name(), Node()} |
// {Registered_name, Node()}
final OtpErlangTuple processTuple = (OtpErlangTuple) erlangObject;
int index = 0;
// pid
OtpErlangPid pid = null;
if (processTuple.arity() == 3) {
// {Pid(), Initial_call()|Registered_name(), Node()}
pid = (OtpErlangPid) processTuple.elementAt(TraceDataHandler.INDEX_PROCESS_PID);
pidNode = new TreeNode("pid: " + pid2Str(pid), Activator.getImage(Images.INFO_NODE));
} else {
// tuple doesn't contain Pid element
index = 1;
}
final OtpErlangObject info = processTuple.elementAt(TraceDataHandler.INDEX_PROCESS_INFO - index);
// process node
final OtpErlangObject processNode = processTuple.elementAt(TraceDataHandler.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;
}
use of org.erlide.tracing.core.mvc.model.treenodes.TreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processReceiveTrace.
private ITreeNode processReceiveTrace(final String label, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode processNode = createProcessNode("receiver: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.RECEIVER_NODE));
labelBuilder.append(lastProcessDescription);
final ITreeNode messageNode = createMessageNode(tuple.elementAt(TraceDataHandler.INDEX_MESSAGE));
final TreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()));
node.setImage(Activator.getDefault().getImageRegistry().get(Images.RECEIVED_MESSAGE_NODE.toString()));
node.addChildren(processNode, messageNode);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.TreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processSpawnTrace.
private ITreeNode processSpawnTrace(final String label, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode processNode = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.PROCESS_NODE));
labelBuilder.append(lastProcessDescription).append("->");
final ITreeNode processNode2 = createProcessNode("new process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS2));
processNode2.setImage(Activator.getImage(Images.NEW_PROCESS_NODE));
labelBuilder.append(lastProcessDescription);
final ITreeNode functionNode = createFunctionNode("function: ", tuple.elementAt(TraceDataHandler.INDEX_SPAWN_FUNCTION));
functionNode.setImage(Activator.getImage(Images.FUNCTION_NODE));
final ITreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()), Activator.getImage(Images.SPAWN_NODE));
node.addChildren(processNode, processNode2, functionNode);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.TreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processInOutTrace.
private ITreeNode processInOutTrace(final String label, final Images image, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode processNode = createProcessNode("process: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
processNode.setImage(Activator.getImage(Images.PROCESS_NODE));
labelBuilder.append(lastProcessDescription);
final ITreeNode functionNode = createFunctionNode("function: ", tuple.elementAt(TraceDataHandler.INDEX_FUNCTION));
functionNode.setImage(Activator.getImage(Images.FUNCTION_NODE));
final ITreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()), Activator.getImage(image));
node.addChildren(processNode, functionNode);
return node;
}
use of org.erlide.tracing.core.mvc.model.treenodes.TreeNode in project erlide_eclipse by erlang.
the class TraceDataHandler method processSendTrace.
private ITreeNode processSendTrace(final String label, final Images image, final OtpErlangTuple tuple) {
final StringBuilder labelBuilder = new StringBuilder(label).append(": ");
final ITreeNode senderNode = createProcessNode("sender: ", tuple.elementAt(TraceDataHandler.INDEX_PROCESS));
senderNode.setImage(Activator.getImage(Images.SENDER_NODE));
labelBuilder.append(lastProcessDescription).append("->");
final ITreeNode receiverNode = createProcessNode("receiver: ", tuple.elementAt(TraceDataHandler.INDEX_TO));
receiverNode.setImage(Activator.getImage(Images.RECEIVER_NODE));
labelBuilder.append(lastProcessDescription);
final ITreeNode messageNode = createMessageNode(tuple.elementAt(TraceDataHandler.INDEX_MESSAGE));
final TreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()));
node.setImage(Activator.getImage(image));
node.addChildren(senderNode, receiverNode, messageNode);
return node;
}
Aggregations