use of org.freeplane.features.script.IScriptStarter in project freeplane by freeplane.
the class ReminderHook method runScript.
public void runScript(ReminderExtension reminderExtension) {
final String script = reminderExtension.getScript();
if (script == null || script.equals(""))
return;
final IScriptStarter starter = (IScriptStarter) modeController.getExtension(IScriptStarter.class);
if (starter == null)
return;
final NodeModel node = reminderExtension.getNode();
final MapModel map = node.getMap();
final Controller controller = modeController.getController();
if (!controller.getMapViewManager().getMaps(modeController.getModeName()).containsValue(map))
return;
starter.executeScript(node, script);
}
use of org.freeplane.features.script.IScriptStarter in project freeplane by freeplane.
the class ScriptingRegistration method register.
private void register(ModeController modeController) {
modeController.addExtension(IScriptEditorStarter.class, new IScriptEditorStarter() {
@Override
public String startEditor(final String pScriptInput) {
final ScriptModel scriptModel = new ScriptModel(pScriptInput);
final ScriptEditorPanel scriptEditorPanel = new ScriptEditorPanel(scriptModel, false);
scriptEditorPanel.setVisible(true);
return scriptModel.getScript();
}
@Override
public ComboBoxEditor createComboBoxEditor(Dimension minimumSize) {
final ScriptComboBoxEditor scriptComboBoxEditor = new ScriptComboBoxEditor();
if (minimumSize != null)
scriptComboBoxEditor.setMinimumSize(minimumSize);
return scriptComboBoxEditor;
}
});
modeController.addExtension(IScriptStarter.class, new IScriptStarter() {
@Override
public void executeScript(NodeModel node, String script) {
ScriptingEngine.executeScript(node, script);
}
});
registerScriptAddOns();
if (!modeController.getController().getViewController().isHeadless()) {
registerGuiStuff(modeController);
ScriptCompiler.compileScriptsOnPath(ScriptResources.getClasspath());
createUserScriptsDirectory();
createInitScriptsDirectory();
createUserLibDirectory();
}
FilterController.getCurrentFilterController().getConditionFactory().addConditionController(100, new ScriptConditionController());
ScriptingPolicy.installRestrictingPolicy();
System.setSecurityManager(new InternationalizedSecurityManager());
}
Aggregations