The main wizard for the codegen wizard
| Method from org.apache.axis2.tool.codegen.eclipse.CodeGenWizard Detail: |
public void addPages() {
toolSelectionPage = new ToolSelectionPage();
addPage(toolSelectionPage);
//add the wsdl2java wizard pages
wsdlSelectionPage = new WSDLFileSelectionPage();
addPage(wsdlSelectionPage);
optionsPage = new OptionsPage();
addPage(optionsPage);
outputPage = new OutputPage();
addPage(outputPage);
//add java2wsdl wizard pages
javaSourceSelectionPage = new JavaSourceSelectionPage();
addPage(javaSourceSelectionPage);
java2wsdlOptionsPage = new JavaWSDLOptionsPage();
addPage(java2wsdlOptionsPage);
java2wsdlOutputLocationPage = new JavaWSDLOutputLocationPage();
addPage(java2wsdlOutputLocationPage);
}
Adding the page to the wizard. |
public boolean canFinish() {
IWizardPage[] pages = getPages();
AbstractWizardPage wizardPage = null;
for (int i = 0; i < pages.length; i++) {
wizardPage = (AbstractWizardPage) pages[i];
if (wizardPage.getPageType() == this.selectedWizardType) {
if (!(wizardPage.isPageComplete()))
return false;
}
}
return true;
}
|
public void copyDirectory(File srcDir,
File dstDir) throws IOException {
if (srcDir.isDirectory()) {
if (!dstDir.exists()) {
dstDir.mkdir();
}
String[] children = srcDir.list();
for (int i=0; i< children.length; i++) {
copyDirectory(new File(srcDir, children[i]),
new File(dstDir, children[i]));
}
} else {
copyFile(srcDir, dstDir);
}
}
|
public IWizardPage getNextPage(IWizardPage page) {
AbstractWizardPage currentPage = (AbstractWizardPage) page;
AbstractWizardPage pageout = (AbstractWizardPage) super
.getNextPage(page);
while (pageout != null && selectedWizardType != pageout.getPageType()) {
AbstractWizardPage temp = pageout;
pageout = (AbstractWizardPage) super.getNextPage(currentPage);
currentPage = temp;
}
return pageout;
}
|
public int getSelectedCodegenOptionType() {
return selectedCodegenOptionType;
}
|
public int getSelectedWizardType() {
return selectedWizardType;
}
|
public String getWSDLname() {
return wsdlSelectionPage.getFileName();
}
Get the selected WSDL from the WSDLselectionpage |
public void init(IWorkbench workbench,
IStructuredSelection selection) {
//do nothing
}
We will accept the selection in the workbench to see if we can initialize
from it. |
public boolean performFinish() {
try {
switch (selectedWizardType) {
case SettingsConstants.WSDL_2_JAVA_TYPE:
doFinishWSDL2Java();
break;
case SettingsConstants.JAVA_2_WSDL_TYPE:
doFinishJava2WSDL();
break;
case SettingsConstants.UNSPECIFIED_TYPE:
break; //Do nothing
default:
throw new RuntimeException(CodegenWizardPlugin.
getResourceString("general.invalid.state"));
}
} catch (Exception e) {
MessageDialog.openError(getShell(),
CodegenWizardPlugin.getResourceString("general.Error"),
CodegenWizardPlugin.getResourceString("general.Error.prefix") +
e.getMessage());
return false;
}
MessageDialog.openInformation(this.getShell(),
CodegenWizardPlugin
.getResourceString("general.name"), CodegenWizardPlugin
.getResourceString("wizard.success"));
return true;
}
This method is called when 'Finish' button is pressed in the wizard. We
will create an operation and run it using wizard as execution context. |
public void populateOptions() {
optionsPage.populateParamsFromWSDL();
}
populate the options page. Usually done after reloading the WSDL |
public void setDefaultNamespaces(String fullyQualifiedClassName) {
java2wsdlOptionsPage.setNamespaceDefaults(fullyQualifiedClassName);
}
|
public void setSelectedCodegenOptionType(int selectedCodegenOptionType) {
this.selectedCodegenOptionType = selectedCodegenOptionType;
}
|
public void setSelectedWizardType(int selectedWizardType) {
this.selectedWizardType = selectedWizardType;
}
|