KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > subversion > operators > ImportWizardOperator


1 /*
2  * ImportWizardOperator.java
3  *
4  * Created on 10/05/06 11:54
5  */

6 package org.netbeans.test.subversion.operators;
7
8 import org.netbeans.jellytools.WizardOperator;
9 import org.netbeans.jellytools.nodes.Node;
10 import org.netbeans.jemmy.JemmyException;
11 import org.netbeans.test.subversion.operators.actions.ImportAction;
12
13 /**
14  * Class implementing all necessary methods for handling "ImportWizardOperator" NbDialog.
15  *
16  *
17  * @author peter
18  * @version 1.0
19  */

20 public class ImportWizardOperator extends WizardOperator {
21
22     /**
23      * Creates new ImportWizardOperator that can handle it.
24      */

25     public ImportWizardOperator() {
26         super("Import");
27     }
28
29     /** Invokes new wizard and returns instance of ImportWizardOperator.
30      * @return instance of ImportWizardOperator
31      */

32     public static ImportWizardOperator invoke() {
33         new ImportAction().perform();
34         return new ImportWizardOperator();
35     }
36     
37     /** Invokes new wizard on given node and returns instance of ImportWizardOperator.
38      * @param node node on which to invoke wizard
39      * @return instance of ImportWizardOperator
40      */

41     public static ImportWizardOperator invoke(Node node) {
42         new ImportAction().perform(node);
43         return new ImportWizardOperator();
44     }
45     
46     //*****************************************
47
// High-level functionality definition part
48
//*****************************************
49

50     /**
51      * Goes through the wizard and fill supplied parameter.
52      * @param cvsRoot CVS root.
53      * @param password password - can be null
54      * @param folderToImport local folder to import
55      * @param importMessage import message
56      * @param repositoryFolder repository folder
57      */

58     public void doImport(String JavaDoc repositoryURL, String JavaDoc password, String JavaDoc importMessage, String JavaDoc repositoryFolder) {
59         if(repositoryURL == null) {
60             throw new JemmyException("CVS root must not be null."); // NOI18N
61
}
62         if(importMessage == null) {
63             throw new JemmyException("Import message must not be null."); // NOI18N
64
}
65         if(repositoryFolder == null) {
66             throw new JemmyException("Repository Folder must not be null."); // NOI18N
67
}
68         ImportWizardOperator.invoke();
69         RepositoryStepOperator rso = new RepositoryStepOperator();
70         if(password != null) {
71             rso.setPassword(password);
72         }
73         rso.setRepositoryURL(repositoryURL);
74         rso.next();
75         FolderToImportStepOperator folderToImportOper = new FolderToImportStepOperator();
76         folderToImportOper.setImportMessage(importMessage);
77         folderToImportOper.setRepositoryFolder(repositoryFolder);
78         folderToImportOper.finish();
79     }
80 }
81
82
Popular Tags