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 com.borland.jbuilder.node.JavaFileNode;
24 import com.borland.primetime.ide.Browser;
25 import com.borland.primetime.ide.BrowserAction;
26 import com.borland.primetime.node.Node;
27
28 /***
29 * The class handles the action the user performs when selecting Checkstyle on the contextual menu of a file tab or when
30 * he use the toolbar icon.
31 * @author Henri Tremblay
32 * @version $Revision: 1.7 $ $Date: 2003/12/07 16:07:53 $
33 */
34 public class CheckStyleAction extends BrowserAction
35 {
36 /*** Default Constructor. */
37 public CheckStyleAction() {
38 super("JBCS", 'C',
39 "Checkstyle is a development tool to help programmers write "
40 + "Java code that adheres to a coding standard",
41 CheckStyleOpenTool.ICON, "Run Checkstyle on current file");
42 }
43
44 /***
45 * @param browser The active browser.
46 * @see BrowserAction
47 */
48 public void actionPerformed(Browser browser) {
49 Node node = browser.getActiveNode();
50 if(node instanceof JavaFileNode) {
51 CheckStyleOpenTool.checkNodes(browser, new JavaFileNode[] { (JavaFileNode) node} );
52 }
53 else {
54
55 new MessageHandler(browser).writeStatusBarMessage("Checkstyle - Not a Java source file");
56 }
57 }
58 }