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

Method addPluginTools

ij/src/main/java/ij/gui/Toolbar.java:1383–1423  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1381 }
1382
1383 private void addPluginTools() {
1384 switchPopup.addSeparator();
1385 for (int i=0; i<builtInTools.length; i++)
1386 addBuiltInTool(builtInTools[i]);
1387 MenuBar menuBar = Menus.getMenuBar();
1388 if (menuBar==null)
1389 return;
1390 int n = menuBar.getMenuCount();
1391 Menu pluginsMenu = null;
1392 if (menuBar.getMenuCount()>=5)
1393 pluginsMenu = menuBar.getMenu(5);
1394 if (pluginsMenu==null || !"Plugins".equals(pluginsMenu.getLabel()))
1395 return;
1396 n = pluginsMenu.getItemCount();
1397 Menu toolsMenu = null;
1398 for (int i=0; i<n; ++i) {
1399 MenuItem m = pluginsMenu.getItem(i);
1400 if ("Tools".equals(m.getLabel()) && (m instanceof Menu)) {
1401 toolsMenu = (Menu)m;
1402 break;
1403 }
1404 }
1405 if (toolsMenu==null) {
1406 switchPopup.addSeparator();
1407 return;
1408 }
1409 n = toolsMenu.getItemCount();
1410 boolean separatorAdded = false;
1411 for (int i=0; i<n; ++i) {
1412 MenuItem m = toolsMenu.getItem(i);
1413 String label = m.getLabel();
1414 if (label!=null && (label.endsWith(" Tool")||label.endsWith(" Menu"))) {
1415 if (!separatorAdded) {
1416 switchPopup.addSeparator();
1417 separatorAdded = true;
1418 }
1419 addPluginTool(label);
1420 }
1421 }
1422 switchPopup.addSeparator();
1423 }
1424
1425 private void addBuiltInTool(String name) {
1426 CheckboxMenuItem item = new CheckboxMenuItem(name, name.equals(currentSet));

Callers 1

showSwitchPopupMenuMethod · 0.95

Calls 7

addBuiltInToolMethod · 0.95
getMenuBarMethod · 0.95
addPluginToolMethod · 0.95
getMenuMethod · 0.80
getLabelMethod · 0.65
addSeparatorMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected