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.
:::java
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);
}
}
Submitted | kerik-sf - 2015-09-07 19:44:19.053000 | Assigned | sjakob |
---|---|---|---|
Priority | 5 | Labels | |
Status | open | Group | None |
Resolution | None |
2015-09-07 20:07:56.796000 kerik-sf |
See [bugs:#3530] for rationale: a plugin only to bundle templates should have simple code to install them. |
---|