Exemplo n.º 1
0
 public void removeMenuItemByLabel(String text) {
   for (int i = 0; i < m_menuItems.size(); i++) {
     MenuItem m = (MenuItem) m_menuItems.elementAt(i);
     if (text.compareTo(m.toString()) == 0) {
       m_menuItems.removeElementAt(i);
     }
   }
 }
Exemplo n.º 2
0
  public void addMenuItem(
      String text,
      int ordinal,
      int priority,
      final int wrapper_callback,
      final int callback,
      int push_at_start) {
    for (int i = 0; i < m_menuItems.size(); i++) {
      MenuItem m = (MenuItem) m_menuItems.elementAt(i);
      if (text.compareTo(m.toString()) == 0) {
        return; // item already exists, don't add.
      }
    }

    // System.out.println("***** addMenuItem *****");
    // System.out.println("text=" + text);

    MenuItem m =
        new MenuItem(text, ordinal, priority) {
          public void run() {
            try {
              int c_on_menuItem = CibylCallTable.getAddressByName("rim_on_menuItem");
              if (c_on_menuItem != 0) {
                UIWorker.addUIEvent(c_on_menuItem, wrapper_callback, callback, 0, 0, true);
              }
            } catch (Exception ex) {
              System.out.println("run (menuItem): " + ex);
            }
          }
        };

    // System.out.println("added item " + m.toString());

    if (push_at_start == 1) {
      m_menuItems.insertElementAt(m, 0);
    } else m_menuItems.addElement(m);
  }