View Javadoc

1   /*
2    *  soapUI, copyright (C) 2004-2009 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.teststep;
14  
15  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
16  import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepFactory;
17  import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepRegistry;
18  import com.eviware.soapui.support.action.support.DefaultActionMapping;
19  import com.eviware.soapui.support.action.support.DefaultSoapUIActionGroup;
20  import com.eviware.soapui.support.action.support.SoapUIActionMappingList;
21  
22  /***
23   * SoapUIAction group for dynamically creating the "Insert TestStep" popup menu
24   * 
25   * @author ole.matzura
26   */
27  
28  public class WsdlTestStepInsertStepSoapUIActionGroup extends DefaultSoapUIActionGroup<WsdlTestStep>
29  {
30  	public WsdlTestStepInsertStepSoapUIActionGroup( String id, String name )
31  	{
32  		super( id, name );
33  	}
34  
35  	public SoapUIActionMappingList<WsdlTestStep> getActionMappings( WsdlTestStep modelItem )
36  	{
37  		SoapUIActionMappingList<WsdlTestStep> actions = new SoapUIActionMappingList<WsdlTestStep>();
38  
39  		WsdlTestStepRegistry registry = WsdlTestStepRegistry.getInstance();
40  		WsdlTestStepFactory[] factories = ( WsdlTestStepFactory[] )registry.getFactories();
41  
42  		for( int c = 0; c < factories.length; c++ )
43  		{
44  			WsdlTestStepFactory factory = factories[c];
45  			if( factory.canCreate() )
46  			{
47  				DefaultActionMapping<WsdlTestStep> actionMapping = new DefaultActionMapping<WsdlTestStep>(
48  						InsertWsdlTestStepAction.SOAPUI_ACTION_ID, null, factory.getTestStepIconPath(), false, factory );
49  
50  				actionMapping.setName( factory.getTestStepName() );
51  				actionMapping.setDescription( factory.getTestStepDescription() );
52  
53  				actions.add( actionMapping );
54  			}
55  		}
56  
57  		return actions;
58  	}
59  }