(String name, String text)
| 346 | } |
| 347 | |
| 348 | @AstroImageJ(reason = "Remove python", modified = true) |
| 349 | public void create(String name, String text) { |
| 350 | ta.append(text); |
| 351 | if (IJ.isMacOSX()) IJ.wait(25); // needed to get setCaretPosition() on OS X |
| 352 | ta.setCaretPosition(0); |
| 353 | setWindowTitle(name); |
| 354 | boolean macroExtension = name.endsWith(".txt") || name.endsWith(".ijm"); |
| 355 | if (macroExtension || name.endsWith(".js") || name.endsWith(".bsh") || name.endsWith(".py") || name.indexOf(".")==-1) { |
| 356 | macrosMenu = new Menu("Macros"); |
| 357 | macrosMenu.add(new MenuItem("Run Macro", new MenuShortcut(KeyEvent.VK_R))); |
| 358 | macrosMenu.add(new MenuItem("Evaluate Line", new MenuShortcut(KeyEvent.VK_Y))); |
| 359 | macrosMenu.add(new MenuItem("Abort Macro")); |
| 360 | macrosMenu.add(new MenuItem("Install Macros", new MenuShortcut(KeyEvent.VK_I))); |
| 361 | macrosMenu.add(new MenuItem("Macro Functions...", new MenuShortcut(KeyEvent.VK_M, true))); |
| 362 | macrosMenu.add(new MenuItem("Function Finder...", new MenuShortcut(KeyEvent.VK_F, true))); |
| 363 | macrosMenu.add(new MenuItem("Enter Interactive Mode")); |
| 364 | macrosMenu.add(new MenuItem("Assign to Repeat Cmd",new MenuShortcut(KeyEvent.VK_A, true))); |
| 365 | macrosMenu.addSeparator(); |
| 366 | macrosMenu.add(new MenuItem("Evaluate Macro")); |
| 367 | macrosMenu.add(new MenuItem("Evaluate JavaScript", new MenuShortcut(KeyEvent.VK_J, false))); |
| 368 | macrosMenu.add(new MenuItem("Evaluate BeanShell", new MenuShortcut(KeyEvent.VK_B, true))); |
| 369 | //macrosMenu.add(new MenuItem("Evaluate Python", new MenuShortcut(KeyEvent.VK_P, false))); |
| 370 | macrosMenu.add(new MenuItem("Show Log Window", new MenuShortcut(KeyEvent.VK_L, true))); |
| 371 | macrosMenu.addSeparator(); |
| 372 | // MACROS_MENU_ITEMS must be updated if items are added to this menu |
| 373 | macrosMenu.addActionListener(this); |
| 374 | mb.add(macrosMenu); |
| 375 | if (!(name.endsWith(".js")||name.endsWith(".bsh")||name.endsWith(".py"))) { |
| 376 | Menu debugMenu = new Menu("Debug"); |
| 377 | debugMenu.add(new MenuItem("Debug Macro", new MenuShortcut(KeyEvent.VK_D))); |
| 378 | debugMenu.add(new MenuItem("Step", new MenuShortcut(KeyEvent.VK_E))); |
| 379 | debugMenu.add(new MenuItem("Trace", new MenuShortcut(KeyEvent.VK_T))); |
| 380 | debugMenu.add(new MenuItem("Fast Trace", new MenuShortcut(KeyEvent.VK_T,true))); |
| 381 | debugMenu.add(new MenuItem("Run")); |
| 382 | debugMenu.add(new MenuItem("Run to Insertion Point", new MenuShortcut(KeyEvent.VK_E, true))); |
| 383 | debugMenu.add(new MenuItem("Abort")); |
| 384 | debugMenu.addActionListener(this); |
| 385 | mb.add(debugMenu); |
| 386 | } |
| 387 | } else { |
| 388 | fileMenu.addSeparator(); |
| 389 | fileMenu.add(new MenuItem("Compile and Run", new MenuShortcut(KeyEvent.VK_R))); |
| 390 | } |
| 391 | if (language!=null) { |
| 392 | for (int i=0; i<languages.length; i++) { |
| 393 | if (name.endsWith(extensions[i])) { |
| 394 | language.select(languages[i]); |
| 395 | break; |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | if (text.startsWith("//@AutoInstall") && (name.endsWith(".ijm")||name.endsWith(".txt"))) { |
| 400 | boolean installInPluginsMenu = !name.contains("Tool."); |
| 401 | installMacros(text, installInPluginsMenu); |
| 402 | if ( text.startsWith("//@AutoInstallAndHide")) |
| 403 | dontShowWindow = true; |
| 404 | } |
| 405 | if (IJ.getInstance()!=null && !dontShowWindow) |
no test coverage detected