public static void add(String title, final P0 onChoose, final JList list, final Object... commands) {
    	
        final DefaultListModel listModel = (DefaultListModel) list.getModel();
        final AtomicInteger index = new AtomicInteger(listModel.getSize());

        listModel.addElement(title);
        final ListSelectionListener selectionListener = new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting() && index.get() == list.getSelectedIndex()) {
                    onChoose.e();
                }
            }
        };
        list.addListSelectionListener(selectionListener);

        listModel.addListDataListener(new ListDataListener() {
            public void intervalAdded(ListDataEvent e) {
                if (e.getIndex1() < index.get()) {
                    index.getAndAdd(e.getIndex1() - e.getIndex0());
                }
            }

            public void intervalRemoved(ListDataEvent e) {
                if (e.getIndex1() < index.get()) {
                    index.getAndAdd(e.getIndex0() - e.getIndex1());
                } else if (e.getIndex0() <= index.get()) {
                    list.removeListSelectionListener(selectionListener);
                    final ListDataListener me = this;
                    asyncRun(new P0() {
                        public void e() {
                            listModel.removeListDataListener(me);
                        }
                    });
                }
            }

            public void contentsChanged(ListDataEvent e) {
            }
        });
        

    	Map<String, P0> commandMap = Cols.<String,P0>map(commands);
    	if (commandMap==null || !commandMap.isEmpty()) {
			onPopup(list, new F0<JPopupMenu>() {public JPopupMenu e() {
                if (index.get() == list.getSelectedIndex()) {
                    JPopupMenu menu = new JPopupMenu();
            		for (int i = 0; i < commands.length; i+=2) {
        				String 	name 	= (String) commands[i];
        				P0 		action 	= (P0) commands[i+1];
        				menu.add(menuItem(name, action));
        			}
					return menu;
                }
                return null;
			}});
    	}
    }