1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.support.actions;
14
15 import java.awt.event.ActionEvent;
16
17 import javax.swing.AbstractAction;
18 import javax.swing.Action;
19 import javax.swing.KeyStroke;
20
21 import com.eviware.soapui.support.HelpActionMarker;
22 import com.eviware.soapui.support.Tools;
23 import com.eviware.soapui.support.UISupport;
24
25 /***
26 * Shows an online help page
27 *
28 * @author Ole.Matzura
29 */
30
31 public class ShowOnlineHelpAction extends AbstractAction implements HelpActionMarker
32 {
33 private final String url;
34
35 public ShowOnlineHelpAction( String url )
36 {
37 this( "Online Help", url, UISupport.getKeyStroke( "F1" ) );
38 }
39
40 public ShowOnlineHelpAction( String title, String url )
41 {
42 this( title, url, null, null, null );
43 }
44
45 public ShowOnlineHelpAction( String title, String url, String description )
46 {
47 this( title, url, null, description, null );
48 }
49
50 public ShowOnlineHelpAction( String title, String url, String description, String iconPath )
51 {
52 this( title, url, null, description, iconPath );
53 }
54
55 public ShowOnlineHelpAction( String title, String url, KeyStroke accelerator )
56 {
57 this( title, url, accelerator, null );
58 }
59
60 public ShowOnlineHelpAction( String title, String url, KeyStroke accelerator, String description )
61 {
62 this( title, url, accelerator, description, null );
63 }
64
65 public ShowOnlineHelpAction( String title, String url, KeyStroke accelerator, String description, String iconPath )
66 {
67 super( title );
68 this.url = url;
69 putValue( Action.SHORT_DESCRIPTION, description == null ? "Show online help" : description );
70 if( accelerator != null )
71 putValue( Action.ACCELERATOR_KEY, accelerator );
72
73 putValue( Action.SMALL_ICON, iconPath == null ? UISupport.HELP_ICON : UISupport.createImageIcon( iconPath ) );
74 }
75
76 public void actionPerformed( ActionEvent e )
77 {
78 if( url == null )
79 UISupport.showErrorMessage( "Missing help URL" );
80 else
81 Tools.openURL( url );
82 }
83 }