dialog.setBooleanValue(Form.MOVE, false);
dialog.setBooleanValue(Form.CLONE_DESCRIPTION, true);
dialog.getFormField(Form.DESCRIPTION).setEnabled(false);
dialog.setValue(Form.DESCRIPTION, testCase.getDescription());
dialog.setValue(Form.NAME, "Copy of " + testCase.getName());
WorkspaceImpl workspace = testCase.getTestSuite().getProject().getWorkspace();
dialog.setOptions(Form.PROJECT,
ModelSupport.getNames(workspace.getOpenProjectList(), new String[]{CREATE_NEW_OPTION}));
dialog.setValue(Form.PROJECT, testCase.getTestSuite().getProject().getName());
dialog.setOptions(Form.TESTSUITE, ModelSupport.getNames(
testCase.getTestSuite().getProject().getTestSuiteList(), new String[]{CREATE_NEW_OPTION}));
dialog.setValue(Form.TESTSUITE, testCase.getTestSuite().getName());
boolean hasLoadTests = testCase.getLoadTestCount() > 0;
dialog.setBooleanValue(Form.CLONE_LOADTESTS, hasLoadTests);
dialog.getFormField(Form.CLONE_LOADTESTS).setEnabled(hasLoadTests);
boolean hasSecurityTests = testCase.getSecurityTestCount() > 0;
dialog.setBooleanValue(Form.CLONE_SECURITYTESTS, hasSecurityTests);
dialog.getFormField(Form.CLONE_SECURITYTESTS).setEnabled(hasSecurityTests);
if (dialog.show()) {
String targetProjectName = dialog.getValue(Form.PROJECT);
String targetTestSuiteName = dialog.getValue(Form.TESTSUITE);
String name = dialog.getValue(Form.NAME);
WsdlProject project = testCase.getTestSuite().getProject();
WsdlTestSuite targetTestSuite = null;
Set<Interface> requiredInterfaces = new HashSet<Interface>();
// to another project project?
if (!targetProjectName.equals(project.getName())) {
// get required interfaces
for (int y = 0; y < testCase.getTestStepCount(); y++) {
WsdlTestStep testStep = testCase.getTestStepAt(y);
requiredInterfaces.addAll(testStep.getRequiredInterfaces());
}
project = (WsdlProject) workspace.getProjectByName(targetProjectName);
if (project == null) {
targetProjectName = UISupport.prompt("Enter name for new Project", "Clone TestCase", "");
if (targetProjectName == null) {
return;
}
try {
project = workspace.createProject(targetProjectName, null);
} catch (SoapUIException e) {
UISupport.showErrorMessage(e);
}
if (project == null) {