Methods Summary |
---|
public void | addMenuItem(org.gudy.azureus2.plugins.ui.menus.MenuItem item)
try {
String name = item.getResourceKey();
String sMenuID = item.getMenuID();
try {
this.items_mon.enter();
Map mTypes = (Map) this.items.get(sMenuID);
if (mTypes == null) {
// LinkedHashMap to preserve order
mTypes = new LinkedHashMap();
this.items.put(sMenuID, mTypes);
}
mTypes.put(name, item);
} finally {
this.items_mon.exit();
}
} catch (Exception e) {
System.out.println("Error while adding Menu Item");
Debug.printStackTrace(e);
}
|
private void | addMenuItems(java.lang.String menu_id, java.util.ArrayList l)
Map menu_map = (Map)this.items.get(menu_id);
if (menu_map != null) {l.addAll(menu_map.values());}
|
public org.gudy.azureus2.plugins.ui.menus.MenuItem[] | getAllAsArray(java.lang.String sMenuID)
Map local_menu_item_map = (Map)this.items.get(sMenuID);
Map global_menu_item_map = (Map)this.items.get(null);
if (local_menu_item_map == null && global_menu_item_map == null) {
return new MenuItem[0];
}
if (sMenuID == null) {local_menu_item_map = null;}
ArrayList l = new ArrayList();
if (local_menu_item_map != null) {l.addAll(local_menu_item_map.values());}
if (global_menu_item_map != null) {l.addAll(global_menu_item_map.values());}
return (MenuItem[]) l.toArray(new MenuItem[l.size()]);
|
public org.gudy.azureus2.plugins.ui.menus.MenuItem[] | getAllAsArray(java.lang.String[] menu_ids)
ArrayList l = new ArrayList();
for (int i=0; i<menu_ids.length; i++) {
addMenuItems(menu_ids[i], l);
}
addMenuItems(null, l);
return (MenuItem[]) l.toArray(new MenuItem[l.size()]);
|
public static org.gudy.azureus2.ui.common.util.MenuItemManager | getInstance()Return the static MenuManager instance
try {
class_mon.enter();
if (instance == null)
instance = new MenuItemManager();
return instance;
} finally {
class_mon.exit();
}
|
public void | removeMenuItem(org.gudy.azureus2.plugins.ui.menus.MenuItem item)
Map menu_item_map = (Map)this.items.get(item.getMenuID());
if (menu_item_map != null) {menu_item_map.remove(item.getResourceKey());}
|