()
| 457 | |
| 458 | |
| 459 | protected void rebuildToolbarMenu() { //JMenu menu) { |
| 460 | JMenuItem item; |
| 461 | if (toolbarMenu == null) { |
| 462 | toolbarMenu = new JMenu(); |
| 463 | } else { |
| 464 | toolbarMenu.removeAll(); |
| 465 | } |
| 466 | |
| 467 | //System.out.println("rebuilding toolbar menu"); |
| 468 | // Add the single "Open" item |
| 469 | item = Toolkit.newJMenuItem("Open...", 'O'); |
| 470 | item.addActionListener(new ActionListener() { |
| 471 | public void actionPerformed(ActionEvent e) { |
| 472 | base.handleOpenPrompt(); |
| 473 | } |
| 474 | }); |
| 475 | toolbarMenu.add(item); |
| 476 | |
| 477 | insertToolbarRecentMenu(); |
| 478 | |
| 479 | item = Toolkit.newJMenuItemShift("Examples...", 'O'); |
| 480 | item.addActionListener(new ActionListener() { |
| 481 | public void actionPerformed(ActionEvent e) { |
| 482 | showExamplesFrame(); |
| 483 | } |
| 484 | }); |
| 485 | toolbarMenu.add(item); |
| 486 | |
| 487 | item = new JMenuItem(Language.text("examples.add_examples")); |
| 488 | item.addActionListener(new ActionListener() { |
| 489 | public void actionPerformed(ActionEvent e) { |
| 490 | ContributionManager.openExamples(); |
| 491 | } |
| 492 | }); |
| 493 | toolbarMenu.add(item); |
| 494 | |
| 495 | // Add a list of all sketches and subfolders |
| 496 | toolbarMenu.addSeparator(); |
| 497 | base.populateSketchbookMenu(toolbarMenu); |
| 498 | // boolean found = false; |
| 499 | // try { |
| 500 | // found = base.addSketches(toolbarMenu, base.getSketchbookFolder(), true); |
| 501 | // } catch (IOException e) { |
| 502 | // Base.showWarning("Sketchbook Toolbar Error", |
| 503 | // "An error occurred while trying to list the sketchbook.", e); |
| 504 | // } |
| 505 | // if (!found) { |
| 506 | // JMenuItem empty = new JMenuItem("(empty)"); |
| 507 | // empty.setEnabled(false); |
| 508 | // toolbarMenu.add(empty); |
| 509 | // } |
| 510 | } |
| 511 | |
| 512 | |
| 513 | protected int importMenuIndex = -1; |
no test coverage detected