Map<Action, DefaultMutableTreeNode> actions =
new HashMap<Action, DefaultMutableTreeNode>();
while (!aps.isEmpty()) {
for (Iterator<ActionDTO> i = aps.iterator(); i.hasNext();) {
ActionDTO actionDTO = i.next();
Action action = actionDTO.getAction();
DefaultMutableTreeNode node = null;
if (action.getParent() == null) {
// top level action
node = new DefaultMutableTreeNode(new ActionHolder(action));
edit.add(node);
} else if (actions.containsKey(action.getParent())) {
// we found the parent of this action -- add it to
// the tree
node = new DefaultMutableTreeNode(new ActionHolder(action));
actions.get(action.getParent()).add(node);
}
if (node != null) {
i.remove();
actions.put(action, node);