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.support.resolver;
14  
15  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
16  import com.eviware.soapui.support.UISupport;
17  import com.eviware.soapui.support.resolver.ResolveContext.Resolver;
18  
19  public class RemoveTestStepResolver implements Resolver
20  {
21  	private WsdlTestStep testStep;
22  	private boolean resolve;
23  
24  	public RemoveTestStepResolver( WsdlTestStep testStep )
25  	{
26  		this.testStep = testStep;
27  	}
28  
29  	@Override
30  	public String toString()
31  	{
32  		return getDescription();
33  	}
34  
35  	public String getDescription()
36  	{
37  		return "Remove Test Step";
38  	}
39  
40  	public String getResolvedPath()
41  	{
42  		return null;
43  	}
44  
45  	public boolean isResolved()
46  	{
47  		return resolve;
48  	}
49  
50  	public boolean resolve()
51  	{
52  		if( UISupport.confirm( "Are you sure to remove this test step?", "Remove Test Step" ) )
53  		{
54  			if( testStep != null )
55  			{
56  				testStep.getTestCase().removeTestStep( testStep );
57  				resolve = true;
58  			}
59  		}
60  		return resolve;
61  	}
62  
63  }