Search in sources :

Example 1 with IScriptEditorStarter

use of org.freeplane.features.script.IScriptEditorStarter in project freeplane by freeplane.

the class ScriptEditorProperty method actionPerformed.

public void actionPerformed(final ActionEvent arg0) {
    final IScriptEditorStarter plugin = (IScriptEditorStarter) Controller.getCurrentModeController().getExtension(IScriptEditorStarter.class);
    if (plugin != null) {
        final IScriptEditorStarter starter = plugin;
        final String resultScript = starter.startEditor(script);
        if (resultScript != null) {
            script = resultScript;
            firePropertyChangeEvent();
        }
    }
}
Also used : IScriptEditorStarter(org.freeplane.features.script.IScriptEditorStarter)

Example 2 with IScriptEditorStarter

use of org.freeplane.features.script.IScriptEditorStarter 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();
        createUserLibDirectory();
    }
    FilterController.getCurrentFilterController().getConditionFactory().addConditionController(100, new ScriptConditionController());
}
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

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