Fix empty BEAUti Template menu; unify template discovery#111
Merged
Conversation
BEAUti's File > Template menu scanned only the filesystem for fxtemplates/*.xml, so it found nothing once the fx templates moved inside beast-fx.jar. The loader already read templates from JAR module layers; the menu did not. Unify both on a single discovery path: - BEASTClassLoader.listResources(): enumerate resources across the boot and plugin module layers (generic, package-manager level). - BeautiDoc.getAvailableTemplates(): single source of truth for which templates exist, covering loose files and JAR-bundled resources. - processTemplate and the menu both consume it; the duplicated filesystem/JAR scans are removed. Fixes #110
This was referenced Jun 24, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #110.
Problem
BEAUti's File ▸ Template submenu is empty (reported by Remco): only "Other Template…" shows, so switching templates is much less convenient.
Cause
The menu discovered templates by scanning the filesystem for
<beastdir>/fxtemplates/*.xml. The installable-packages work moved the fx templates insidebeast-fx.jar(beast.fx/fxtemplates/) and stopped extracting them as loose files, so the filesystem-only scan finds nothing. The loader (BeautiDoc.processTemplate) already read templates from JAR module layers — which is why the default template still loads — but the menu builder was left filesystem-only.Change
BEASTClassLoader.listResources(...)(beast-pkgmgmt): generic enumeration of resources across the boot + plugin module layers, returning aModuleResourcehandle. No BEAUti knowledge — reusable for any package-provided resource lookup.BeautiDoc.getAvailableTemplates()(beast-fx): single source of truth for available templates, covering loose files and JAR resources, deduped (filesystem wins). Both the loader (processTemplate) and the menu (BeautiTabPane.getTemplateActions) consume it, so they can't drift apart again.processTemplateand the menu.Testing
mvn -pl beast-fx test -Dtest=BeautiSimpleTestpasses: drivesparseArgs → processTemplate → getTemplateSources, building the correct model from the Standard template plus merged sub-templates.@walterxie — before this goes to Remco, please build/run BEAUti from this branch and confirm the File ▸ Template submenu lists Standard / LegacyStandard (and any package-provided templates), and that switching between them works.