MCPcopy Index your code
hub / github.com/benfry/processing4 / rebuildToolList

Method rebuildToolList

app/src/processing/app/Base.java:856–912  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

854
855
856 public void rebuildToolList() {
857 // Only do these once because the list of internal tools will never change
858 if (internalTools == null) {
859 internalTools = new ArrayList<>();
860
861 initInternalTool(processing.app.tools.Archiver.class);
862 initInternalTool(processing.app.tools.ColorSelector.class);
863 initInternalTool(processing.app.tools.CreateFont.class);
864
865 if (Platform.isMacOS()) {
866 initInternalTool(processing.app.tools.InstallCommander.class);
867 }
868
869 initInternalTool(processing.app.tools.ThemeSelector.class);
870 }
871
872 // Only init() these the first time they're loaded
873 if (coreTools == null) {
874 coreTools = ToolContribution.loadAll(Base.getToolsFolder());
875 for (Tool tool : coreTools) {
876 tool.init(this);
877 }
878 }
879
880 // Reset the contributed tools and re-init() all of them.
881 contribTools = ToolContribution.loadAll(Base.getSketchbookToolsFolder());
882 for (Tool tool : contribTools) {
883 try {
884 tool.init(this);
885
886 // With the exceptions, we can't call statusError because the window
887 // isn't completely set up yet. Also not gonna pop up a warning because
888 // people may still be running different versions of Processing.
889
890 } catch (VerifyError | AbstractMethodError ve) {
891 System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
892 "compatible with this version of Processing");
893 Messages.err("Incompatible Tool found during tool.init()", ve);
894
895 } catch (NoSuchMethodError nsme) {
896 System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
897 "compatible with this version of Processing");
898 System.err.println("The " + nsme.getMessage() + " method no longer exists.");
899 Messages.err("Incompatible Tool found during tool.init()", nsme);
900
901 } catch (NoClassDefFoundError ncdfe) {
902 System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
903 "compatible with this version of Processing");
904 System.err.println("The " + ncdfe.getMessage() + " class is no longer available.");
905 Messages.err("Incompatible Tool found during tool.init()", ncdfe);
906
907 } catch (Error | Exception e) {
908 System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\"");
909 e.printStackTrace();
910 }
911 }
912 }
913

Callers 2

refreshContribsMethod · 0.95
populateToolsMenuMethod · 0.95

Calls 11

initInternalToolMethod · 0.95
isMacOSMethod · 0.95
loadAllMethod · 0.95
getToolsFolderMethod · 0.95
errMethod · 0.95
initMethod · 0.65
getMenuTitleMethod · 0.65
getMessageMethod · 0.65
printlnMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected