use of org.freeplane.plugin.script.ExecuteScriptAction.ExecutionMode in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method addEntryForGivenLocation.
private void addEntryForGivenLocation(Entry rootEntry, final ScriptMetaData metaData, String scriptPath) {
for (final ExecutionMode executionMode : metaData.getExecutionModes()) {
final String location = metaData.getMenuLocation(executionMode);
if (registeredLocations.add(location + "/" + metaData.getScriptName())) {
Entry parentEntry = findOrCreateEntry(rootEntry, location);
if (parentEntry == null)
throw new RuntimeException("internal error: cannot add entry for " + location);
Entry entry = createEntry(metaData.getScriptName(), scriptPath, executionMode);
parentEntry.addChild(entry);
;
}
}
}
use of org.freeplane.plugin.script.ExecuteScriptAction.ExecutionMode in project freeplane by freeplane.
the class ScriptingMenuEntryVisitor method visit.
/**
* builds menu entries for scripts without a special menu location.
*/
@Override
public void visit(Entry target) {
initEntryNavigator(target);
for (final Map.Entry<String, String> entry : configuration.getMenuTitleToPathMap().entrySet()) {
String scriptName = entry.getKey();
final ScriptMetaData metaData = configuration.getMenuTitleToMetaDataMap().get(scriptName);
if (!metaData.hasMenuLocation()) {
for (final ExecutionMode executionMode : metaData.getExecutionModes()) {
target.addChild(createEntry(scriptName, entry.getValue(), executionMode));
}
}
// else: see buildPhaseFinished
}
if (target.isLeaf()) {
target.addChild(createNoScriptsAvailableAction());
}
}
use of org.freeplane.plugin.script.ExecuteScriptAction.ExecutionMode in project freeplane by freeplane.
the class ScriptingMenuContributor method registerScript.
private void registerScript(final String scriptName, final String scriptPath) {
final ScriptMetaData metaData = configuration.getMenuTitleToMetaDataMap().get(scriptName);
for (final ExecutionMode executionMode : metaData.getExecutionModes()) {
final String location = getLocation(scriptName, metaData, executionMode);
addSubMenu(parentLocation(location), location, getMenuTitle(metaData, executionMode));
addMenuItem(location, scriptName, scriptPath, executionMode, metaData);
}
}
Aggregations