1 package org.telscenter.pas.steps.actions;
2
3 import java.awt.Component;
4 import java.awt.event.ActionEvent;
5
6 import javax.swing.AbstractAction;
7 import javax.swing.ImageIcon;
8 import javax.swing.JDialog;
9 import javax.swing.SwingUtilities;
10
11 public class DialogSaveAction extends AbstractAction {
12
13 public DialogSaveAction() {
14
15 }
16 public DialogSaveAction(ImageIcon imageIcon) {
17 super(null, imageIcon);
18 }
19
20 public DialogSaveAction(String string) {
21 super(string);
22 }
23
24 public void actionPerformed(ActionEvent e) {
25 if( e != null)
26 hideRootDialog(e.getSource());
27 }
28
29 /***
30 * @param e
31 */
32 protected void hideRootDialog(Object source) {
33 Component root = SwingUtilities.getRoot((Component) source);
34
35 if (root instanceof JDialog) {
36 JDialog dialog = (JDialog) root;
37 dialog.setVisible(false);
38 dialog.dispose();
39 }
40 }
41
42 }