View Javadoc

    1   /*
    2    *  soapUI, copyright (C) 2004-2007 eviware.com
    3    *
    4    *  soapUI is free software; you can redistribute it and/or modify it under the
    5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
    6    *  the Free Software Foundation.
    7    *
    8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
    9    *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    10   *  See the GNU Lesser General Public License for more details at gnu.org.
    11   */
    12
    13  package com.eviware.soapui.impl.wsdl.actions.support;
    14
    15  import com.eviware.soapui.impl.wsdl.support.HelpUrls;
    16  import com.eviware.soapui.model.ModelItem;
    17  import com.eviware.soapui.support.HelpActionMarker;
    18  import com.eviware.soapui.support.Tools;
    19  import com.eviware.soapui.support.UISupport;
    20  import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
    21
    22  /***
    23   * Shows an online help page
    24   *
    25   * @author Ole.Matzura
    26   */
    27
    28  public class ShowOnlineSoapUIHelp extends AbstractSoapUIAction implements HelpActionMarker
    29  {
    30  	public static final String SOAPUI_ACTION_ID = "ShowOnlineSoapUIHelp";
    31  	private String url;
    32
    33  	public ShowOnlineSoapUIHelp()
    34  	{
    35  		super( "Online Help", "Show Online Help" );
    36     }
    37
    38  	public ShowOnlineSoapUIHelp( String name, String url )
    39  	{
    40  		super( name, url );
    41  		this.url = url;
    42  	}
    43
    44  	public void perform( ModelItem target, Object param )
    45  	{
    46     	if( param == null && url == null )
    47     	{
    48     		UISupport.showErrorMessage( "Missing help URL" );
    49     		return;
    50     	}
    51
    52     	String url = param == null ? this.url : param.toString();
    53     	if( !url.startsWith( "http://" ))
    54     		url = HelpUrls.HELP_URL_ROOT + url;
    55
    56    		Tools.openURL( url );
    57  	}
    58  }