1 package gov.nasa.pds.ltdt.gui;
2
3 import java.awt.event.ActionEvent;
4 import java.util.Properties;
5
6 import javax.swing.AbstractAction;
7 import javax.swing.Icon;
8
9 /***
10 * Validate Action to handle template validation requests
11 * @author jwang
12 *
13 */
14 public class ValidateAction extends AbstractAction {
15
16 private MainWindow window = null;
17 private Properties props;
18
19 /***
20 * Constructor
21 * @param name
22 * @param image
23 * @param desc
24 * @param mnemonic
25 * @param props
26 * @param window
27 */
28 public ValidateAction (String name, Icon image,
29 String desc, Integer mnemonic, Properties props,
30 MainWindow window) {
31 super (name, image);
32 putValue (SHORT_DESCRIPTION, desc);
33 putValue (MNEMONIC_KEY, mnemonic);
34
35 this.props = props;
36 this.window = window;
37
38
39 }
40
41 public void actionPerformed(ActionEvent ae) {
42
43
44 int cursorOffset = window.editorPane.jta.getCaretPosition();
45
46 Validate.validateTemplate(props, window);
47
48
49 window.editorPane.jta.setCaretPosition(cursorOffset);
50 window.editorPane.jta.grabFocus();
51
52 }
53 }