1 package net.sourceforge.pmd.util.viewer.gui.menu;
2
3 import net.sourceforge.pmd.util.viewer.model.ViewerModel;
4
5 import javax.swing.JMenuItem;
6 import java.awt.event.ActionEvent;
7 import java.awt.event.ActionListener;
8
9
10 /***
11 * adds the given path fragment to the XPath expression upon action
12 *
13 * @author Boris Gruschko ( boris at gruschko.org )
14 * @version $Id: XPathFragmentAddingItem.java,v 1.2 2003/09/23 20:51:06 tomcopeland Exp $
15 */
16 public class XPathFragmentAddingItem
17 extends JMenuItem
18 implements ActionListener
19 {
20 private ViewerModel model;
21 private String fragment;
22
23 /***
24 * constructs the item
25 *
26 * @param caption menu item's caption
27 * @param model model to refer to
28 * @param fragment XPath expression fragment to be added upon action
29 */
30 public XPathFragmentAddingItem(
31 String caption, ViewerModel model, String fragment )
32 {
33 super( caption );
34
35 this.model = model;
36 this.fragment = fragment;
37
38 addActionListener( this );
39 }
40
41 /***
42 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
43 */
44 public void actionPerformed( ActionEvent e )
45 {
46 model.appendToXPathExpression( fragment, this );
47 }
48 }
49
50
51 /*
52 * $Log: XPathFragmentAddingItem.java,v $
53 * Revision 1.2 2003/09/23 20:51:06 tomcopeland
54 * Cleaned up imports
55 *
56 * Revision 1.1 2003/09/23 20:32:42 tomcopeland
57 * Added Boris Gruschko's new AST/XPath viewer
58 *
59 * Revision 1.1 2003/09/24 01:33:03 bgr
60 * moved to a new package
61 *
62 * Revision 1.1 2003/09/23 07:52:16 bgr
63 * menus added
64 *
65 */
This page was automatically generated by Maven