package feathereditor include FeatherTextEditor.feather import texteditor.TextEditorBehaviour class FeatherEditorBehaviour( val file : File ) : GroupBehaviour( file.name ), Savable { val textEditor = FeatherTextEditor( file ) val form = FeatherArgumentsForm().apply { folder.value = file.parentFile } val argumentsBehaviour = FeatherArgumentsBehaviour( this, file, form ) val run = Action( "Run", this:>runScript ) .shortcut( Key.F10.shift() ) override meth shortcuts() = listOf( run ) init { secondaryBehaviours.add( textEditor ) secondaryBehaviours.add( argumentsBehaviour ) contexts.add( Context( Context.FEATHER_FILE, file ) ) contexts.add( Context( Context.TEXT_FILE, file ) ) contexts.add( Context( Context.FILE, file ) ) } // override meth toolbar() = super.toolbar() meth runScript() { $( feather2 '${file.name}' ).dir( form.folder.value ) .runToTextBehaviour(file.name, null) .openTab() } override meth save() { textEditor.save() } override meth isSaved() = textEditor.isSaved() }