1 package net.sourceforge.pmd.util.viewer.gui.menu;
2
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
5
6 import javax.swing.JMenuItem;
7
8 import net.sourceforge.pmd.util.viewer.model.ViewerModel;
9
10
11
12
13
14
15
16
17 public class XPathFragmentAddingItem extends JMenuItem implements ActionListener {
18 private ViewerModel model;
19 private String fragment;
20
21
22
23
24
25
26
27
28 public XPathFragmentAddingItem(String caption, ViewerModel model, String fragment) {
29 super(caption);
30 this.model = model;
31 this.fragment = fragment;
32 addActionListener(this);
33 }
34
35
36
37
38 public void actionPerformed(ActionEvent e) {
39 model.appendToXPathExpression(fragment, this);
40 }
41 }