View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2008 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.mockservice;
14  
15  import com.eviware.soapui.SoapUI;
16  import com.eviware.soapui.impl.wsdl.mock.WsdlMockService;
17  import com.eviware.soapui.support.UISupport;
18  import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
19  import com.eviware.soapui.ui.desktop.DesktopPanel;
20  
21  /***
22   * Clones a WsdlMockService
23   * 
24   * @author Ole.Matzura
25   */
26  
27  public class StartMinimizedMockServiceAction extends AbstractSoapUIAction<WsdlMockService>
28  {
29  	public final static String SOAPUI_ACTION_ID = "StartMinimizedMockServiceAction";
30  
31  	public StartMinimizedMockServiceAction() 
32     {
33        super( "Start Minimized", "Starts this MockService and minimizes its desktop window" );
34     }
35  	
36     public void perform( WsdlMockService mockService, Object param )
37  	{
38     	try
39  		{
40     		UISupport.setHourglassCursor();
41  			DesktopPanel desktopPanel = UISupport.showDesktopPanel( mockService );
42  			if( mockService.getMockRunner() == null )
43  				mockService.start();
44  			
45  			SoapUI.getDesktop().minimize( desktopPanel );
46  		}
47  		catch( Exception e )
48  		{
49  			UISupport.showErrorMessage( e );
50  		}
51  		finally
52  		{
53  			UISupport.resetCursor();
54  		}
55  	}
56  }