Exemple #1
0
 private void collectExisting(MPSTreeNode node, Collection<String> existing) {
   for (int idx = 0; idx < node.getChildCount(); idx++) {
     TreeNode child = node.getChildAt(idx);
     if (child instanceof MPSTreeNode) {
       existing.add(child.toString());
       collectExisting(((MPSTreeNode) child), existing);
     }
   }
 }
Exemple #2
0
 private void collectNew(
     TreePath path, Collection<String> existing, Collection<TreePath> newNodes) {
   Object lastPathComponent = path.getLastPathComponent();
   if (lastPathComponent instanceof MPSTreeNode) {
     MPSTreeNode node = ((MPSTreeNode) lastPathComponent);
     for (int idx = 0; idx < node.getChildCount(); idx++) {
       TreeNode child = node.getChildAt(idx);
       if (child instanceof MPSTreeNode) {
         TreePath childPath = path.pathByAddingChild(child);
         if (!(existing.contains(child.toString()))) {
           newNodes.add(childPath);
         }
         collectNew(childPath, existing, newNodes);
       }
     }
   }
 }