View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2010 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.actions.multi;
14  
15  import com.eviware.soapui.impl.wsdl.WsdlTestSuite;
16  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
17  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
18  import com.eviware.soapui.model.ModelItem;
19  import com.eviware.soapui.support.action.support.AbstractSoapUIMultiAction;
20  
21  public class MultiTestStepEnableAction extends AbstractSoapUIMultiAction<ModelItem>
22  {
23  	public static final String SOAPUI_ACTION_ID = "MultiTestStepEnableAction";
24  
25  	public MultiTestStepEnableAction()
26  	{
27  		super( SOAPUI_ACTION_ID, "Enable", "Enables the selected items" );
28  	}
29  
30  	public void perform( ModelItem[] targets, Object param )
31  	{
32  		for( ModelItem target : targets )
33  		{
34  			if( target instanceof WsdlTestStep )
35  				( ( WsdlTestStep )target ).setDisabled( false );
36  			else if( target instanceof WsdlTestCase )
37  				( ( WsdlTestCase )target ).setDisabled( false );
38  			else if( target instanceof WsdlTestSuite )
39  				( ( WsdlTestSuite )target ).setDisabled( false );
40  		}
41  	}
42  
43  	public boolean applies( ModelItem target )
44  	{
45  		return ( ( target instanceof WsdlTestStep ) && ( ( WsdlTestStep )target ).isDisabled() )
46  				|| ( ( target instanceof WsdlTestCase ) && ( ( WsdlTestCase )target ).isDisabled() )
47  				|| ( ( target instanceof WsdlTestSuite ) && ( ( WsdlTestSuite )target ).isDisabled() );
48  	}
49  }