Attached is some code extracted for the XmlPlugin to install templates from a plugin in a templates subdirectory. It's intended to run at startup.
EditPlugin templatesPlugin = jEdit.getPlugin("templates.TemplatesPlugin", false); if(templatesPlugin == null){ Log.log(Log.MESSAGE,XmlPlugin.class,"Templates plugin is not installed, so templates won't be copied"); }else{ try{ Class ti = Class.forName("templates.TemplatesInstaller"); Method installTemplates = ti.getMethod("installTemplatesInBackground", PluginJAR.class, String.class); installTemplates.invoke(null, XmlPlugin.this.getPluginJAR(), "XMLPlugin"); }catch(Exception e){ Log.log(Log.WARNING, XmlPlugin.class, "Error installing templates", e); } }
See [bugs:#3530] for rationale: a plugin only to bundle templates should have simple code to install them.
Related
Bugs:
#3530