Search in sources :

Example 1 with ScriptConditionController

use of org.freeplane.plugin.script.filter.ScriptConditionController 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());
}
Also used : IScriptModel(org.freeplane.plugin.script.ScriptEditorPanel.IScriptModel) NodeModel(org.freeplane.features.map.NodeModel) ScriptConditionController(org.freeplane.plugin.script.filter.ScriptConditionController) IScriptEditorStarter(org.freeplane.features.script.IScriptEditorStarter) Dimension(java.awt.Dimension) IScriptStarter(org.freeplane.features.script.IScriptStarter) ComboBoxEditor(javax.swing.ComboBoxEditor)

Aggregations

Dimension (java.awt.Dimension)1 ComboBoxEditor (javax.swing.ComboBoxEditor)1 NodeModel (org.freeplane.features.map.NodeModel)1 IScriptEditorStarter (org.freeplane.features.script.IScriptEditorStarter)1 IScriptStarter (org.freeplane.features.script.IScriptStarter)1 IScriptModel (org.freeplane.plugin.script.ScriptEditorPanel.IScriptModel)1 ScriptConditionController (org.freeplane.plugin.script.filter.ScriptConditionController)1