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