2 * Copyright 2003-2007 the original author or authors.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 import java
.awt
.event
.InputEvent
20 import java
.awt
.event
.KeyEvent
21 import javax
.swing
.KeyStroke
23 newFileAction
= action(
25 closure
: controller
.&fileNewFile
,
27 accelerator
: shortcut('N'),
28 smallIcon
: imageIcon(resource
:"icons/page.png", class:this),
29 shortDescription
: 'New Groovy Script'
32 newWindowAction
= action(
34 closure
: controller
.&fileNewWindow
,
36 accelerator
: shortcut('shift N')
41 closure
: controller
.&fileOpen
,
43 accelerator
: shortcut('O'),
44 smallIcon
: imageIcon(resource
:"icons/folder_page.png", class:this),
45 shortDescription
: 'Open Groovy Script'
50 closure
: controller
.&fileSave
,
52 accelerator
: shortcut('S'),
53 smallIcon
: imageIcon(resource
:"icons/disk.png", class:this),
54 shortDescription
: 'Save Groovy Script',
55 enabled
: false // controller will enable as needed
58 saveAsAction
= action(
60 closure
: controller
.&fileSaveAs
,
66 closure
: controller
.&print
,
68 accelerator
: shortcut('P')
73 closure
: controller
.&exit
,
75 // whether or not application exit should have an
76 // accellerator is debatable in usability circles
77 // at the very least a confirm dialog should dhow up
78 //accelerator: shortcut('Q')
83 closure
: controller
.&undo
,
85 accelerator
: shortcut('Z'),
86 smallIcon
: imageIcon(resource
:"icons/arrow_undo.png", class:this),
87 shortDescription
: 'Undo'
92 closure
: controller
.&redo
,
94 accelerator
: shortcut('shift Z'), // is control-shift-Z or control-Y more common?
95 smallIcon
: imageIcon(resource
:"icons/arrow_redo.png", class:this),
96 shortDescription
: 'Redo'
101 closure
: controller
.&find
,
103 accelerator
: shortcut('F'),
104 smallIcon
: imageIcon(resource
:"icons/find.png", class:this),
105 shortDescription
: 'Find'
108 findNextAction
= action(
110 closure
: controller
.&findNext
,
112 accelerator
: KeyStroke
.getKeyStroke(KeyEvent
.VK_F3
, 0)
115 findPreviousAction
= action(
116 name
: 'Find Previous',
117 closure
: controller
.&findPrevious
,
119 accelerator
: KeyStroke
.getKeyStroke(KeyEvent
.VK_F3
, InputEvent
.SHIFT_DOWN_MASK
)
122 replaceAction
= action(
124 closure
: controller
.&replace
,
126 accelerator
: shortcut('H'),
127 smallIcon
: imageIcon(resource
:"icons/text_replace.png", class:this),
128 shortDescription
: 'Replace'
133 closure
: controller
.&cut
,
135 accelerator
: shortcut('X'),
136 smallIcon
: imageIcon(resource
:"icons/cut.png", class:this),
137 shortDescription
: 'Cut'
142 closure
: controller
.©
,
144 accelerator
: shortcut('C'),
145 smallIcon
: imageIcon(resource
:"icons/page_copy.png", class:this),
146 shortDescription
: 'Copy'
149 pasteAction
= action(
151 closure
: controller
.&paste
,
153 accelerator
: shortcut('V'),
154 smallIcon
: imageIcon(resource
:"icons/page_paste.png", class:this),
155 shortDescription
: 'Paste'
158 selectAllAction
= action(
160 closure
: controller
.&selectAll
,
162 accelerator
: shortcut('A')
165 historyPrevAction
= action(
167 closure
: controller
.&historyPrev
,
169 accelerator
: shortcut(KeyEvent
.VK_COMMA
),
170 smallIcon
: imageIcon(resource
:"icons/book_previous.png", class:this),
171 shortDescription
: 'Previous Groovy Script',
172 enabled
: false // controller will enable as needed
175 historyNextAction
= action(
177 closure
: controller
.&historyNext
,
179 accelerator
: shortcut(KeyEvent
.VK_PERIOD
),
180 smallIcon
: imageIcon(resource
:"icons/book_next.png", class:this),
181 shortDescription
: 'Next Groovy Script',
182 enabled
: false // controller will enable as needed
185 clearOutputAction
= action(
186 name
: 'Clear Output',
187 closure
: controller
.&clearOutput
,
189 accelerator
: shortcut('W')
194 closure
: controller
.&runScript
,
196 keyStroke
: shortcut('ENTER'),
197 accelerator
: shortcut('R'),
198 smallIcon
: imageIcon(resource
:"icons/script_go.png", class:this),
199 shortDescription
: 'Execute Groovy Script'
202 runSelectionAction
= action(
203 name
: 'Run Selection',
204 closure
: controller
.&runSelectedScript
,
206 keyStroke
: shortcut('shift ENTER'),
207 accelerator
: shortcut('shift R')
210 addClasspathJar
= action(
211 name
: 'Add Jar to ClassPath',
212 closure
: controller
.&addClasspathJar
,
216 addClasspathDir
= action(
217 name
: 'Add Directory to ClassPath',
218 closure
: controller
.&addClasspathDir
,
222 clearClassloader
= action(
223 name
: 'Clear Script Context',
224 closure
: controller
.&clearContext
,
228 inspectLastAction
= action(
229 name
: 'Inspect Last',
230 closure
: controller
.&inspectLast
,
232 accelerator
: shortcut('I')
235 inspectVariablesAction
= action(
236 name
: 'Inspect Variables',
237 closure
: controller
.&inspectVariables
,
239 accelerator
: shortcut('J')
242 captureStdOutAction
= action(
243 name
: 'Capture Standard Output',
244 closure
: controller
.&captureStdOut
,
248 fullStackTracesAction
= action(
249 name
: 'Show Full Stack Traces',
250 closure
: controller
.&fullStackTraces
,
254 showToolbarAction
= action(
255 name
: 'Show Toolbar',
256 closure
: controller
.&showToolbar
,
260 largerFontAction
= action(
262 closure
: controller
.&largerFont
,
264 accelerator
: shortcut('shift L')
267 smallerFontAction
= action(
268 name
: 'Smaller Font',
269 closure
: controller
.&smallerFont
,
271 accelerator
: shortcut('shift S')
274 aboutAction
= action(
276 closure
: controller
.&showAbout
,
280 interruptAction
= action(
282 closure
: controller
.&confirmRunInterrupt