1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.actions.teststep;
14
15 import com.eviware.soapui.config.TestStepConfig;
16 import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
17 import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
18 import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepFactory;
19 import com.eviware.soapui.support.UISupport;
20 import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
21
22 /***
23 * Inserts a WsdlTestStep specified by the supplied WsdlTestStepFactory at the
24 * position to the specified WsdlTestStep
25 *
26 * @author ole.matzura
27 */
28
29 public class InsertWsdlTestStepAction extends AbstractSoapUIAction<WsdlTestStep>
30 {
31 public static final String SOAPUI_ACTION_ID = "InsertWsdlTestStepAction";
32
33 public InsertWsdlTestStepAction()
34 {
35 super( "Insert Step", "Inserts a TestStep at the position of this TestStep" );
36 }
37
38 public void perform( WsdlTestStep testStep, Object param )
39 {
40 WsdlTestStepFactory factory = ( WsdlTestStepFactory )param;
41 WsdlTestCase testCase = testStep.getTestCase();
42
43 String name = UISupport.prompt( "Specify name for new step", "Insert Step", factory.getTestStepName() );
44 if( name != null )
45 {
46 TestStepConfig newTestStepConfig = factory.createNewTestStep( testCase, name );
47 if( newTestStepConfig != null )
48 {
49 int ix = testCase.getIndexOfTestStep( testStep );
50 testStep = testCase.insertTestStep( newTestStepConfig, ix );
51 if( testStep != null )
52 UISupport.selectAndShow( testStep );
53 }
54 }
55 }
56 }