}
private CompletionToken createToken(int offset, int startPos, Node node) {
String path = KongaStringUtils.removeStartAndEnd(node.m_deName, "[", "]");
String display = node.getDisplay();
DefaultCompletionToken t = new DefaultCompletionToken(path, startPos, offset, display);
if (includeTokenInfo) {
// TODO: I'd like to show a small image of the tree leading to Node here, but
// unfortunately the CompletionToken API does not allow for that, I can
// only set an info string. Change the CompletionToken API to allow for
// more flexibility. For example, we have have a TokenInfo class, with a text and
// an icon field.
t.setInfo(node.m_deName);
}
Icon icon = getIcon(node);
t.setIcon(icon);
return t;
}