MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / addItemSorted

Method addItemSorted

ij/src/main/java/ij/Menus.java:986–1001  ·  view source on GitHub ↗
(Menu menu, MenuItem item, int startingIndex)

Source from the content-addressed store, hash-verified

984 }
985
986 static void addItemSorted(Menu menu, MenuItem item, int startingIndex) {
987 String itemLabel = item.getLabel();
988 int count = menu.getItemCount();
989 boolean inserted = false;
990 for (int i=startingIndex; i<count; i++) {
991 MenuItem mi = menu.getItem(i);
992 String label = mi.getLabel();
993 //IJ.log(i+ " "+itemLabel+" "+label + " "+(itemLabel.compareTo(label)));
994 if (itemLabel.compareTo(label)<0) {
995 menu.insert(item, i);
996 inserted = true;
997 break;
998 }
999 }
1000 if (!inserted) menu.add(item);
1001 }
1002
1003 static void addSeparator(Menu menu) {
1004 menu.addSeparator();

Callers 3

addItemMethod · 0.95
getMenuMethod · 0.95
installUserPluginMethod · 0.95

Calls 4

getLabelMethod · 0.65
addMethod · 0.65
compareToMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected