fixed build console
[groovy.git] / src / main / groovy / ui / ConsoleActions.groovy
blob92ffc1d94913a256932c4f6dc1e6a4107363cd96
1 /*
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.
17 package groovy.ui
19 import java.awt.event.InputEvent
20 import java.awt.event.KeyEvent
21 import javax.swing.KeyStroke
23 newFileAction = action(
24 name: 'New File',
25 closure: controller.&fileNewFile,
26 mnemonic: 'N',
27 accelerator: shortcut('N'),
28 smallIcon: imageIcon(resource:"icons/page.png", class:this),
29 shortDescription: 'New Groovy Script'
32 newWindowAction = action(
33 name: 'New Window',
34 closure: controller.&fileNewWindow,
35 mnemonic: 'W',
36 accelerator: shortcut('shift N')
39 openAction = action(
40 name: 'Open',
41 closure: controller.&fileOpen,
42 mnemonic: 'O',
43 accelerator: shortcut('O'),
44 smallIcon: imageIcon(resource:"icons/folder_page.png", class:this),
45 shortDescription: 'Open Groovy Script'
48 saveAction = action(
49 name: 'Save',
50 closure: controller.&fileSave,
51 mnemonic: 'S',
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(
59 name: 'Save As...',
60 closure: controller.&fileSaveAs,
61 mnemonic: 'A',
64 printAction = action(
65 name: 'Print...',
66 closure: controller.&print,
67 mnemonic: 'P',
68 accelerator: shortcut('P')
71 exitAction = action(
72 name: 'Exit',
73 closure: controller.&exit,
74 mnemonic: 'X'
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')
81 undoAction = action(
82 name: 'Undo',
83 closure: controller.&undo,
84 mnemonic: 'U',
85 accelerator: shortcut('Z'),
86 smallIcon: imageIcon(resource:"icons/arrow_undo.png", class:this),
87 shortDescription: 'Undo'
90 redoAction = action(
91 name: 'Redo',
92 closure: controller.&redo,
93 mnemonic: 'R',
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'
99 findAction = action(
100 name: 'Find...',
101 closure: controller.&find,
102 mnemonic: 'F',
103 accelerator: shortcut('F'),
104 smallIcon: imageIcon(resource:"icons/find.png", class:this),
105 shortDescription: 'Find'
108 findNextAction = action(
109 name: 'Find Next',
110 closure: controller.&findNext,
111 mnemonic: 'N',
112 accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0)
115 findPreviousAction = action(
116 name: 'Find Previous',
117 closure: controller.&findPrevious,
118 mnemonic: 'V',
119 accelerator: KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_DOWN_MASK)
122 replaceAction = action(
123 name: 'Replace...',
124 closure: controller.&replace,
125 mnemonic: 'E',
126 accelerator: shortcut('H'),
127 smallIcon: imageIcon(resource:"icons/text_replace.png", class:this),
128 shortDescription: 'Replace'
131 cutAction = action(
132 name: 'Cut',
133 closure: controller.&cut,
134 mnemonic: 'T',
135 accelerator: shortcut('X'),
136 smallIcon: imageIcon(resource:"icons/cut.png", class:this),
137 shortDescription: 'Cut'
140 copyAction = action(
141 name: 'Copy',
142 closure: controller.&copy,
143 mnemonic: 'C',
144 accelerator: shortcut('C'),
145 smallIcon: imageIcon(resource:"icons/page_copy.png", class:this),
146 shortDescription: 'Copy'
149 pasteAction = action(
150 name: 'Paste',
151 closure: controller.&paste,
152 mnemonic: 'P',
153 accelerator: shortcut('V'),
154 smallIcon: imageIcon(resource:"icons/page_paste.png", class:this),
155 shortDescription: 'Paste'
158 selectAllAction = action(
159 name: 'Select All',
160 closure: controller.&selectAll,
161 mnemonic: 'A',
162 accelerator: shortcut('A')
165 historyPrevAction = action(
166 name: 'Previous',
167 closure: controller.&historyPrev,
168 mnemonic: 'P',
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(
176 name: 'Next',
177 closure: controller.&historyNext,
178 mnemonic: 'N',
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,
188 mnemonic: 'O',
189 accelerator: shortcut('W')
192 runAction = action(
193 name: 'Run',
194 closure: controller.&runScript,
195 mnemonic: 'R',
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,
205 mnemonic: 'E',
206 keyStroke: shortcut('shift ENTER'),
207 accelerator: shortcut('shift R')
210 addClasspathJar = action(
211 name: 'Add Jar to ClassPath',
212 closure: controller.&addClasspathJar,
213 mnemonic: 'J',
216 addClasspathDir = action(
217 name: 'Add Directory to ClassPath',
218 closure: controller.&addClasspathDir,
219 mnemonic: 'D',
222 clearClassloader = action(
223 name: 'Clear Script Context',
224 closure: controller.&clearContext,
225 mnemonic: 'C',
228 inspectLastAction = action(
229 name: 'Inspect Last',
230 closure: controller.&inspectLast,
231 mnemonic: 'I',
232 accelerator: shortcut('I')
235 inspectVariablesAction = action(
236 name: 'Inspect Variables',
237 closure: controller.&inspectVariables,
238 mnemonic: 'V',
239 accelerator: shortcut('J')
242 captureStdOutAction = action(
243 name: 'Capture Standard Output',
244 closure: controller.&captureStdOut,
245 mnemonic: 'C'
248 fullStackTracesAction = action(
249 name: 'Show Full Stack Traces',
250 closure: controller.&fullStackTraces,
251 mnemonic: 'F'
254 showToolbarAction = action(
255 name: 'Show Toolbar',
256 closure: controller.&showToolbar,
257 mnemonic: 'T'
260 largerFontAction = action(
261 name: 'Larger Font',
262 closure: controller.&largerFont,
263 mnemonic: 'L',
264 accelerator: shortcut('shift L')
267 smallerFontAction = action(
268 name: 'Smaller Font',
269 closure: controller.&smallerFont,
270 mnemonic: 'S',
271 accelerator: shortcut('shift S')
274 aboutAction = action(
275 name: 'About',
276 closure: controller.&showAbout,
277 mnemonic: 'A'
280 interruptAction = action(
281 name: 'Interrupt',
282 closure: controller.&confirmRunInterrupt