1
2
3
4
5 package com.eviware.soapui.support.dnd.handlers;
6
7 import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
8 import com.eviware.soapui.support.UISupport;
9
10 public class TestCaseToTestCaseDropHandler extends AbstractBeforeAfterModelItemDropHandler<WsdlTestCase, WsdlTestCase>
11 {
12 public TestCaseToTestCaseDropHandler()
13 {
14 super( WsdlTestCase.class, WsdlTestCase.class );
15 }
16
17 @Override
18 boolean canCopyAfter( WsdlTestCase source, WsdlTestCase target )
19 {
20 return true;
21 }
22
23 @Override
24 boolean canMoveAfter( WsdlTestCase source, WsdlTestCase target )
25 {
26 return source != target;
27 }
28
29 @Override
30 boolean copyAfter( WsdlTestCase source, WsdlTestCase target )
31 {
32 WsdlTestCase testCase = TestCaseToTestSuiteDropHandler.copyTestCase( source, target.getTestSuite(),
33 target.getTestSuite().getIndexOfTestCase( target )+1 );
34
35 if( testCase != null )
36 UISupport.select( testCase );
37
38 return testCase != null;
39 }
40
41 @Override
42 boolean moveAfter( WsdlTestCase source, WsdlTestCase target )
43 {
44 WsdlTestCase testCase = TestCaseToTestSuiteDropHandler.moveTestCase( source, target.getTestSuite(),
45 target.getTestSuite().getIndexOfTestCase( target )+1 );
46
47 if( testCase != null )
48 UISupport.select( testCase );
49
50 return testCase != null;
51 }
52
53 @Override
54 String getCopyAfterInfo( WsdlTestCase source, WsdlTestCase target )
55 {
56 return "Copy TestCase [" + source.getName() + "] to TestSuite [" + target.getTestSuite().getName() + "]";
57 }
58
59 @Override
60 String getMoveAfterInfo( WsdlTestCase source, WsdlTestCase target )
61 {
62 return source == target ? "Move TestCase [" + source.getName() + "] within TestSuite" :
63 "Move TestCase [" + source.getName() + "] to TestSuite in Project [" + target.getName() + "]";
64 }
65
66 @Override
67 boolean canCopyBefore( WsdlTestCase source, WsdlTestCase target )
68 {
69 return true;
70 }
71
72 @Override
73 boolean canMoveBefore( WsdlTestCase source, WsdlTestCase target )
74 {
75 return source != target;
76 }
77
78 @Override
79 boolean copyBefore( WsdlTestCase source, WsdlTestCase target )
80 {
81 WsdlTestCase testCase = TestCaseToTestSuiteDropHandler.copyTestCase( source, target.getTestSuite(),
82 target.getTestSuite().getIndexOfTestCase( target ) );
83
84 if( testCase != null )
85 UISupport.select( testCase );
86
87 return testCase != null;
88 }
89
90 @Override
91 String getCopyBeforeInfo( WsdlTestCase source, WsdlTestCase target )
92 {
93 return getCopyAfterInfo( source, target );
94 }
95
96 @Override
97 String getMoveBeforeInfo( WsdlTestCase source, WsdlTestCase target )
98 {
99 return getMoveAfterInfo( source, target );
100 }
101
102 @Override
103 boolean moveBefore( WsdlTestCase source, WsdlTestCase target )
104 {
105 WsdlTestCase testCase = TestCaseToTestSuiteDropHandler.moveTestCase( source, target.getTestSuite(),
106 target.getTestSuite().getIndexOfTestCase( target ) );
107
108 if( testCase != null )
109 UISupport.select( testCase );
110
111 return testCase != null;
112 }
113 }