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