Skip to content

Fix empty BEAUti Template menu; unify template discovery#111

Merged
walterxie merged 1 commit into
masterfrom
fix/beauti-template-menu
Jun 23, 2026
Merged

Fix empty BEAUti Template menu; unify template discovery#111
walterxie merged 1 commit into
masterfrom
fix/beauti-template-menu

Conversation

@alexeid

@alexeid alexeid commented Jun 23, 2026

Copy link
Copy Markdown
Member

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 inside beast-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 a ModuleResource handle. 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.
  • Removes the duplicated filesystem/JAR scan code from processTemplate and the menu.

Testing

  • mvn -pl beast-fx test -Dtest=BeautiSimpleTest passes: drives parseArgs → 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.

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
@alexeid alexeid requested a review from walterxie June 23, 2026 21:15
@walterxie walterxie merged commit 3a1f8f3 into master Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BEAUti File ▸ Template menu is empty

2 participants