public static Completion completePath(TreeComponent tree, String expression, String completedName) {
String fragment = expression.substring(completedName.length());
if (fragment.isEmpty()) {
return null;
}
NodePathCompleter worker = new NodePathCompleter(tree);
Completion path = worker.complete(fragment);
if (path == null) {
return null;
}
return path.substring(fragment.length());
}