use of org.freeplane.plugin.script.addons.ScriptAddOnProperties in project freeplane by freeplane.
the class ScriptingConfiguration method createAddOnScriptMap.
private Map<File, Script> createAddOnScriptMap() {
Map<File, Script> result = new LinkedHashMap<File, Script>();
for (ScriptAddOnProperties scriptAddOnProperties : getInstalledScriptAddOns()) {
final List<Script> scripts = scriptAddOnProperties.getScripts();
for (Script script : scripts) {
script.active = scriptAddOnProperties.isActive();
result.put(findScriptFile(scriptAddOnProperties, script), script);
}
}
return result;
}
use of org.freeplane.plugin.script.addons.ScriptAddOnProperties in project freeplane by freeplane.
the class ScriptingRegistration method registerScriptAddOns.
private void registerScriptAddOns() {
File[] addonXmlFiles = AddOnsController.getController().getAddOnsDir().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".script.xml");
}
});
final IXMLParser parser = XMLLocalParserFactory.createLocalXMLParser();
for (File file : addonXmlFiles) {
BufferedInputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(file));
final IXMLReader reader = new StdXMLReader(inputStream);
parser.setReader(reader);
final ScriptAddOnProperties addOn = new ScriptAddOnProperties((XMLElement) parser.parse());
addOn.setAddOnPropertiesFile(file);
AddOnsController.getController().registerInstalledAddOn(addOn);
} catch (final Exception e) {
LogUtils.warn("error parsing " + file, e);
} finally {
FileUtils.silentlyClose(inputStream);
}
}
}
use of org.freeplane.plugin.script.addons.ScriptAddOnProperties in project freeplane by freeplane.
the class ScriptingConfiguration method addClasspathForAddOns.
private void addClasspathForAddOns(final ArrayList<String> classpath) {
final List<ScriptAddOnProperties> installedScriptAddOns = getInstalledScriptAddOns();
for (ScriptAddOnProperties scriptAddOnProperties : installedScriptAddOns) {
final List<String> lib = scriptAddOnProperties.getLib();
if (lib != null) {
for (String libEntry : lib) {
final File dir = new File(getPrivateAddOnDirectory(scriptAddOnProperties), "lib");
classpath.add(new File(dir, libEntry).getAbsolutePath());
}
}
}
}
Aggregations