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.dnd.handlers;
14  
15  import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
16  import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
17  
18  public class TestStepToTestCaseDropHandler extends AbstractBeforeAfterModelItemDropHandler<WsdlTestStep, WsdlTestCase>
19  {
20  	public TestStepToTestCaseDropHandler()
21  	{
22  		super( WsdlTestStep.class, WsdlTestCase.class );
23  	}
24  
25  	@Override
26  	boolean copyAfter( WsdlTestStep source, WsdlTestCase target )
27  	{
28  		return DragAndDropSupport.copyTestStep( source, target, -1 );
29  	}
30  
31  	@Override
32  	boolean moveAfter( WsdlTestStep source, WsdlTestCase target )
33  	{
34  		return DragAndDropSupport.moveTestStep( source, target, -1 );
35  	}
36  
37  	@Override
38  	boolean canCopyAfter( WsdlTestStep source, WsdlTestCase target )
39  	{
40  		return true;
41  	}
42  
43  	@Override
44  	boolean canMoveAfter( WsdlTestStep source, WsdlTestCase target )
45  	{
46  		return true;
47  	}
48  
49  	@Override
50  	String getCopyAfterInfo( WsdlTestStep source, WsdlTestCase target )
51  	{
52  		return source.getTestCase() == target ? "Copy TestStep [" + source.getName() + "] within TestCase ["
53  				+ target.getName() + "]" : "Copy TestStep [" + source.getName() + "] to TestCase [" + target.getName()
54  				+ "]";
55  	}
56  
57  	@Override
58  	String getMoveAfterInfo( WsdlTestStep source, WsdlTestCase target )
59  	{
60  		return source.getTestCase() == target ? "Move TestStep [" + source.getName() + "] within TestCase ["
61  				+ target.getName() + "]" : "Move TestStep [" + source.getName() + "] to TestCase [" + target.getName()
62  				+ "]";
63  	}
64  
65  	@Override
66  	boolean canCopyBefore( WsdlTestStep source, WsdlTestCase target )
67  	{
68  		return true;
69  	}
70  
71  	@Override
72  	boolean canMoveBefore( WsdlTestStep source, WsdlTestCase target )
73  	{
74  		return true;
75  	}
76  
77  	@Override
78  	boolean copyBefore( WsdlTestStep source, WsdlTestCase target )
79  	{
80  		return DragAndDropSupport.copyTestStep( source, target, 0 );
81  	}
82  
83  	@Override
84  	String getCopyBeforeInfo( WsdlTestStep source, WsdlTestCase target )
85  	{
86  		return getCopyAfterInfo( source, target );
87  	}
88  
89  	@Override
90  	String getMoveBeforeInfo( WsdlTestStep source, WsdlTestCase target )
91  	{
92  		return getMoveAfterInfo( source, target );
93  	}
94  
95  	@Override
96  	boolean moveBefore( WsdlTestStep source, WsdlTestCase target )
97  	{
98  		return DragAndDropSupport.moveTestStep( source, target, 0 );
99  	}
100 }