@@ -20,9 +20,31 @@ class ScijavaReplFXTabs(
20
20
private val exitKeyCombination : Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .D , KeyCombination .CONTROL_DOWN )),
21
21
private val createNewReplCombination : Collection <KeyCombination > = setOf(KeyCodeCombination (KeyCode .T , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_DOWN )),
22
22
private val cycleTabsForwardKombination : Collection <KeyCombination > = setOf(KeyCodeCombination (KeyCode .TAB , KeyCombination .CONTROL_DOWN )),
23
- private val cycleTabsBackwardKombination : Collection <KeyCombination > = setOf(KeyCodeCombination (KeyCode .TAB , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_DOWN ))
23
+ private val cycleTabsBackwardKombination : Collection <KeyCombination > = setOf(KeyCodeCombination (KeyCode .TAB , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_DOWN )),
24
+ private val bindings : Map <String , * > = mapOf<String , Any >()
24
25
) {
25
26
27
+ constructor (
28
+ context: Context ,
29
+ increaseFontKeys: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .EQUALS , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_ANY )),
30
+ decreaseFontKeys: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .MINUS , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_ANY )),
31
+ evalKeys: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .ENTER , KeyCombination .CONTROL_DOWN )),
32
+ exitKeyCombination: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .D , KeyCombination .CONTROL_DOWN )),
33
+ createNewReplCombination: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .T , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_DOWN )),
34
+ cycleTabsForwardKombination: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .TAB , KeyCombination .CONTROL_DOWN )),
35
+ cycleTabsBackwardKombination: Collection <KeyCombination > = setOf (KeyCodeCombination (KeyCode .TAB , KeyCombination .CONTROL_DOWN , KeyCombination .SHIFT_DOWN )),
36
+ vararg bindings: Pair <String , * >
37
+ ) : this (
38
+ context,
39
+ increaseFontKeys,
40
+ decreaseFontKeys,
41
+ evalKeys,
42
+ exitKeyCombination,
43
+ createNewReplCombination,
44
+ cycleTabsForwardKombination,
45
+ cycleTabsBackwardKombination,
46
+ mapOf (* bindings))
47
+
26
48
27
49
private val tabPane = TabPane ()
28
50
.also { it.tabClosingPolicy = TabPane .TabClosingPolicy .ALL_TABS }
@@ -44,8 +66,8 @@ class ScijavaReplFXTabs(
44
66
45
67
fun createAndAddTab () {
46
68
val repl = SciJavaReplFX (context)
47
-
48
- repl.setPromptPrefHeight( 250.0 )
69
+ . also { it.setPromptPrefHeight( 250.0 ) }
70
+ . also { it.putBindings(bindings) }
49
71
50
72
repl.node.addEventHandler(KeyEvent .KEY_PRESSED ) {
51
73
if (increaseFontKeys.any { c -> c.match(it) }) {
0 commit comments