final HashMap<String, KeyStroke> menuKeyToKeyStrokeMap) {
final IndexedTree.Node node = (Node) menuNode;
final Object userObject = menuNode.getUserObject();
if (userObject instanceof JMenuItem) {
final JMenuItem jMenuItem = (JMenuItem) userObject;
final IFreeplaneAction action = (IFreeplaneAction) jMenuItem.getAction();
final String key = String.valueOf(node.getKey());
final String iconKey = action == null ? null : action.getIconKey();
return new DefaultMutableTreeNode(new MenuEntry(key, jMenuItem.getText(), iconKey, menuKeyToKeyStrokeMap
.get(key), jMenuItem.getToolTipText()));
}
// the other expected types are String and javax.swing.JPopupMenu.Separator
// - just omit them