01: /*
02: * CommentAction.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.actions;
13:
14: import java.awt.event.ActionEvent;
15: import java.awt.event.InputEvent;
16: import java.awt.event.KeyEvent;
17:
18: import javax.swing.KeyStroke;
19: import workbench.gui.editor.TextCommenter;
20: import workbench.gui.sql.EditorPanel;
21:
22: import workbench.resource.ResourceMgr;
23:
24: /**
25: * Action to "comment" the currently selected text in the SQL editor.
26: * This is done by addin single line comments to each line
27: * @see workbench.gui.editor.TextCommenter#commentSelection()
28: * @author support@sql-workbench.net
29: */
30: public class CommentAction extends WbAction {
31: private EditorPanel client;
32:
33: public CommentAction(EditorPanel aClient) {
34: super ();
35: this .client = aClient;
36: this .initMenuDefinition("MnuTxtCommentSelection", KeyStroke
37: .getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK
38: + InputEvent.SHIFT_MASK));
39: this .setMenuItemName(ResourceMgr.MNU_TXT_EDIT);
40: }
41:
42: public void executeAction(ActionEvent e) {
43: TextCommenter commenter = new TextCommenter(client);
44: commenter.commentSelection();
45: }
46: }
|