View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.gui.action;
21  
22  import java.awt.event.ActionEvent;
23  import java.awt.event.ActionListener;
24  
25  import javax.help.CSH;
26  import javax.help.HelpBroker;
27  import javax.swing.AbstractAction;
28  import javax.swing.Action;
29  
30  import org.xnap.XNap;
31  import org.xnap.gui.util.HelpManager;
32  import org.xnap.gui.util.IconHelper;
33  
34  /***
35   * Provides an action that shows the about dialog.
36   */
37  public class ContextHelpAction extends AbstractAction 
38  {
39      
40      //--- Constant(s) ---
41      
42      //--- Data field(s) ---
43      
44      //--- Constructor(s) ---
45  
46      /***
47       * Constructs the ContextHelpAction.
48       */
49      public ContextHelpAction()
50      {
51  		putValue(Action.NAME, XNap.tr("What's This?"));
52  		putValue(IconHelper.XNAP_ICON, "contexthelp.png");
53  		putValue(Action.SHORT_DESCRIPTION,
54  				 XNap.tr("Activates the context help mouse cursor."));
55  
56  		HelpBroker hb = HelpManager.getMainHelpBroker();
57  		if (hb == null) {
58  			setEnabled(false);
59  		}
60      }
61  
62      //--- Method(s) ---
63  
64      /***
65       * Delegates event to the <code>HelpManager.getTracker()</code>
66       * actionlistener.
67       */
68      public void actionPerformed(ActionEvent event) 
69      {
70  		ActionListener al =  HelpManager.getTracker();
71  		if (al != null) {
72  			al.actionPerformed(event);
73  		}
74      }
75  }