*/
private Map<String, List<String>> checkReferencesFor(TreeNode tn) {
final CourseEditorTreeModel cetm = CourseFactory.getCourseEditSession(ores.getResourceableId()).getEditorTreeModel();
//create a list of all nodes in the selected subtree
final Set<String> allSubTreeids = new HashSet<String>();
TreeVisitor tv = new TreeVisitor(new Visitor() {
public void visit(INode node) {
allSubTreeids.add(node.getIdent());
}
}, tn, true);
tv.visitAll();
//find all references pointing from outside the subtree into the subtree or
//on the subtree root node.
final Map<String, List<String>> allRefs = new HashMap<String, List<String>>();
tv = new TreeVisitor(new Visitor() {
public void visit(INode node) {
List referencingNodes = euce.getCourseEditorEnv().getReferencingNodeIdsFor(node.getIdent());
// subtract the inner nodes. This allows to delete a whole subtree if
// only references residing completly inside the subtree are active.
referencingNodes.removeAll(allSubTreeids);