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

Method showSwitchPopupMenu

ij/src/main/java/ij/gui/Toolbar.java:1337–1381  ·  view source on GitHub ↗
(MouseEvent e)

Source from the content-addressed store, hash-verified

1335 }
1336
1337 void showSwitchPopupMenu(MouseEvent e) {
1338 String path = IJ.getDir("macros")+"toolsets/";
1339 if (path==null)
1340 return;
1341 boolean applet = IJ.getApplet()!=null;
1342 File f = new File(path);
1343 String[] list;
1344 if (!applet && f.exists() && f.isDirectory()) {
1345 list = f.list();
1346 if (list==null) return;
1347 Arrays.sort(list);
1348 } else
1349 list = new String[0];
1350 switchPopup.removeAll();
1351 path = IJ.getDir("macros") + "StartupMacros.txt";
1352 f = new File(path);
1353 if (!f.exists()) {
1354 path = IJ.getDir("macros") + "StartupMacros.ijm";
1355 f = new File(path);
1356 }
1357 if (!applet && f.exists())
1358 addItem("Startup Macros");
1359 else
1360 addItem("StartupMacros*");
1361 for (int i=0; i<list.length; i++) {
1362 String name = list[i];
1363 if (name.startsWith(".") || name.endsWith(" Tool"))
1364 continue;
1365 if (name.endsWith(".txt")) {
1366 name = name.substring(0, name.length()-4);
1367 addItem(name);
1368 } else if (name.endsWith(".ijm")) {
1369 name = name.substring(0, name.length()-4) + " ";
1370 addItem(name);
1371 }
1372 }
1373 addItem("Overlay Editing Tools*");
1374 addPluginTools();
1375 addItem("Restore Startup Tools");
1376 addItem("Remove Custom Tools");
1377 addItem("Help...");
1378 add(ovalPopup);
1379 if (IJ.isMacOSX()) IJ.wait(10);
1380 switchPopup.show(e.getComponent(), e.getX(), e.getY());
1381 }
1382
1383 private void addPluginTools() {
1384 switchPopup.addSeparator();

Callers 1

mousePressedMethod · 0.95

Calls 15

getDirMethod · 0.95
getAppletMethod · 0.95
addItemMethod · 0.95
addPluginToolsMethod · 0.95
isMacOSXMethod · 0.95
waitMethod · 0.95
startsWithMethod · 0.80
substringMethod · 0.80
lengthMethod · 0.65
addMethod · 0.65
getXMethod · 0.65
getYMethod · 0.65

Tested by

no test coverage detected