1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package com.henri.jbcs;
22
23 import java.awt.event.ActionEvent;
24
25 import com.borland.jbuilder.node.JavaFileNode;
26 import com.borland.primetime.editor.EditorAction;
27 import com.borland.primetime.ide.Browser;
28 import com.borland.primetime.node.Node;
29
30 /***
31 * A key bindable EditorAction. Called when the keyboard shortcut is used
32 *
33 * @author Henri Tremblay
34 * @see EditorAction
35 * @version $Revision: 1.3 $ $Date: 2004/09/01 21:42:22 $
36 */
37 public class CheckStyleKeymapAction extends EditorAction
38 {
39
40 /***
41 * @see EditorAction
42 */
43 public CheckStyleKeymapAction() {
44 super("jbcs");
45 putValue("LongDescription",
46 "Checkstyle is a development tool to help programmers write "
47 + "Java code that adheres to a coding standard");
48 putValue("ActionGroup", "OpenTools");
49 }
50
51 /***
52 * Triggers <code>ACTION_CheckStyle.actionPerformed()</code> when the JDK
53 * fires a key event
54 *
55 * @param e The action event.
56 */
57 public void actionPerformed(ActionEvent e) {
58 Browser browser = Browser.getActiveBrowser();
59 Node node = browser.getActiveNode();
60 if(node instanceof JavaFileNode) {
61 CheckStyleOpenTool.checkNodes(browser, new JavaFileNode[] {(JavaFileNode) node});
62 }
63 else {
64
65 new MessageHandler(browser).writeStatusBarMessage("Checkstyle - Not a Java source file");
66 }
67 }
68 }