Make TemplateMode 3.0 compatible #4
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #3. The primary change is that the jars in the processing/java/mode folder, especially JavaMode.jar, need to be included in the mode's "lib" directory. This is because in 3.0, unlike previously, the JavaMode itself is loaded as a contributed mode, and isn't in Processing's classpath. Which means that if the JavaMode.jar isn't included, the class loader trying to load the mode has no idea what exactly JavaMode.jar is (since JavaMode.jar isn't in processing's classpath).
Further, how the mode's class loader identifies the class loader to be returned (i.e., JavaMode's class loader) also has to be changed- earlier, it could just cycle through all the modes and find which one of them corresponded to the JavaMode.class. However, now, since the JavaMode.class of the mode is not the same as the JavaMode's JavaMode.class (since they're loaded from different jars), it has to identify the JavaMode by name, and then return its class loader.
Once these 2 changes are made, everything runs smoothly. I've updated the resources/theme folder as well, since otherwise, the UI looks terribly off, as quite a few UI changes were made in 3.0.
And finally, I've updated the readme to mention that the jars in the processing/java/mode folder have to be included in the "lib" folder.
A huge thank you to @Manindra29 for helping me figure out all these changes that needed to be done.