()
| 668 | |
| 669 | |
| 670 | public void rebuildToolList() { |
| 671 | // Only do this once because the list of internal tools will never change |
| 672 | if (internalTools == null) { |
| 673 | internalTools = new ArrayList<>(); |
| 674 | |
| 675 | initInternalTool("processing.app.tools.CreateFont"); |
| 676 | initInternalTool("processing.app.tools.ColorSelector"); |
| 677 | initInternalTool("processing.app.tools.Archiver"); |
| 678 | |
| 679 | if (Platform.isMacOS()) { |
| 680 | initInternalTool("processing.app.tools.InstallCommander"); |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | // No need to reload these either |
| 685 | if (coreTools == null) { |
| 686 | coreTools = ToolContribution.loadAll(Base.getToolsFolder()); |
| 687 | for (Tool tool : coreTools) { |
| 688 | tool.init(this); |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | // Rebuilt when new tools installed, etc |
| 693 | contribTools = ToolContribution.loadAll(Base.getSketchbookToolsFolder()); |
| 694 | for (Tool tool : contribTools) { |
| 695 | try { |
| 696 | tool.init(this); |
| 697 | |
| 698 | // With the exceptions, we can't call statusError because the window |
| 699 | // isn't completely set up yet. Also not gonna pop up a warning because |
| 700 | // people may still be running different versions of Processing. |
| 701 | |
| 702 | } catch (VerifyError ve) { |
| 703 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + |
| 704 | "compatible with this version of Processing"); |
| 705 | |
| 706 | } catch (NoSuchMethodError nsme) { |
| 707 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + |
| 708 | "compatible with this version of Processing"); |
| 709 | System.err.println("The " + nsme.getMessage() + " method no longer exists."); |
| 710 | Messages.loge("Incompatible Tool found during tool.init()", nsme); |
| 711 | |
| 712 | } catch (NoClassDefFoundError ncdfe) { |
| 713 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + |
| 714 | "compatible with this version of Processing"); |
| 715 | System.err.println("The " + ncdfe.getMessage() + " class is no longer available."); |
| 716 | Messages.loge("Incompatible Tool found during tool.init()", ncdfe); |
| 717 | |
| 718 | } catch (AbstractMethodError ame) { |
| 719 | System.err.println("\"" + tool.getMenuTitle() + "\" is not " + |
| 720 | "compatible with this version of Processing"); |
| 721 | // ame.printStackTrace(); |
| 722 | |
| 723 | } catch (Error err) { |
| 724 | System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\""); |
| 725 | err.printStackTrace(); |
| 726 | |
| 727 | } catch (Exception ex) { |
no test coverage detected