Пример #1
0
 // in: node for JMenu, out: node for MenuEntry
 private static DefaultMutableTreeNode menuNode2menuEntryNode(
     final DefaultMutableTreeNode menuNode,
     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
   return null;
 }
 public void onMenuItemSelected(JMenuItem mi) {
   publish("text: " + mi.getText() + ", tooltip: " + mi.getToolTipText());
   T.debug("onMenuItemSelected()");
 }