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