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.support.dnd.handlers;
14  
15  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
16  import com.eviware.soapui.model.tree.nodes.support.WsdlTestStepsModelItem;
17  
18  public class TestStepToTestStepsDropHandler extends
19  		AbstractAfterModelItemDropHandler<WsdlTestStep, WsdlTestStepsModelItem>
20  {
21  	public TestStepToTestStepsDropHandler()
22  	{
23  		super( WsdlTestStep.class, WsdlTestStepsModelItem.class );
24  	}
25  
26  	boolean copyAfter( WsdlTestStep source, WsdlTestStepsModelItem target )
27  	{
28  		return DragAndDropSupport.copyTestStep( source, target.getTestCase(), 0 );
29  	}
30  
31  	boolean moveAfter( WsdlTestStep source, WsdlTestStepsModelItem target )
32  	{
33  		return DragAndDropSupport.moveTestStep( source, target.getTestCase(), 0 );
34  	}
35  
36  	@Override
37  	boolean canCopyAfter( WsdlTestStep source, WsdlTestStepsModelItem target )
38  	{
39  		return true;
40  	}
41  
42  	@Override
43  	boolean canMoveAfter( WsdlTestStep source, WsdlTestStepsModelItem target )
44  	{
45  		return true;
46  	}
47  
48  	@Override
49  	String getCopyAfterInfo( WsdlTestStep source, WsdlTestStepsModelItem target )
50  	{
51  		return source.getTestCase() == target.getTestCase() ? "Copy TestStep [" + source.getName()
52  				+ "] within TestCase [" + target.getTestCase().getName() + "]" : "Copy TestStep [" + source.getName()
53  				+ "] to TestCase [" + target.getTestCase().getName() + "]";
54  	}
55  
56  	@Override
57  	String getMoveAfterInfo( WsdlTestStep source, WsdlTestStepsModelItem target )
58  	{
59  		return source.getTestCase() == target.getTestCase() ? "Move TestStep [" + source.getName()
60  				+ "] within TestCase [" + target.getTestCase().getName() + "]" : "Move TestStep [" + source.getName()
61  				+ "] to TestCase [" + target.getTestCase().getName() + "]";
62  	}
63  }