01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.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 position to the
24: * specified WsdlTestStep
25: *
26: * @author ole.matzura
27: */
28:
29: public class InsertWsdlTestStepAction extends
30: AbstractSoapUIAction<WsdlTestStep> {
31: public static final String SOAPUI_ACTION_ID = "InsertWsdlTestStepAction";
32:
33: public InsertWsdlTestStepAction() {
34: super ("Insert Step",
35: "Inserts a TestStep at the position of this TestStep");
36: }
37:
38: public void perform(WsdlTestStep testStep, Object param) {
39: WsdlTestStepFactory factory = (WsdlTestStepFactory) param;
40: WsdlTestCase testCase = testStep.getTestCase();
41:
42: String name = UISupport.prompt("Specify name for new step",
43: "Insert Step", factory.getTestStepName());
44: if (name != null) {
45: TestStepConfig newTestStepConfig = factory
46: .createNewTestStep(testCase, name);
47: if (newTestStepConfig != null) {
48: int ix = testCase.getIndexOfTestStep(testStep);
49: testStep = testCase.insertTestStep(newTestStepConfig,
50: ix);
51: UISupport.selectAndShow(testStep);
52: }
53: }
54: }
55: }
|