optionspage.java
来自「开源的axis2框架的源码。用于开发WEBSERVER」· Java 代码 · 共 1,238 行 · 第 1/3 页
JAVA
1,238 行
*
*/
private void fillDatabinderCombo() {
databindingTypeCombo.add(DATA_BINDING_ADB);
databindingTypeCombo.add(DATA_BINDING_XMLBEANS);
databindingTypeCombo.add(DATA_BINDING_JIBX);
//databindingTypeCombo.add(DATA_BINDING_JAXME);
databindingTypeCombo.add(DATA_BINDING_NONE);
}
/**
* Fill the combo with proper language names
*
*/
private void fillLanguageCombo() {
languageSelectionComboBox.add(JAVA);
//since we have not looked at C# support seriously
//for a long time, we'll just leave it out
//languageSelectionComboBox.add(C_SHARP);
languageSelectionComboBox.select(0);
}
/**
* Fill the combo with properoption selection
*
*/
private void fillCodegenOptionSelectionComboBox() {
codegenOptionSelectionComboBox.add(DEFAULT);
codegenOptionSelectionComboBox.add(CUSTOM);
codegenOptionSelectionComboBox.select(0);
}
/**
* Validates the status of the server-side checkbox, and enables/disables
* the generation checkbox for XML configuration file
*/
private void handleServersideSelection() {
if (this.serverSideCheckBoxButton.getSelection()) {
settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton
.getSelection());
this.serverXMLCheckBoxButton.setEnabled(true);
//this.generateAllCheckBoxButton.setEnabled(true);
this.generateServerSideInterfaceCheckBoxButton.setEnabled(true);
if(clientSideCheckBoxButton.getSelection()==true
|| generateAllCheckBoxButton.getSelection() == true){
uncheckClientSide();
uncheckGenerateAll();
serverSideCheckBoxButton.setSelection(true);
settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton
.getSelection());
}
this.syncAndAsyncRadioButton.setSelection(false);
this.asyncOnlyRadioButton.setSelection(false);
this.syncOnlyRadioButton.setSelection(false);
//earlier existing code (This only set focus false)
this.syncAndAsyncRadioButton.setEnabled(false);
this.asyncOnlyRadioButton.setEnabled(false);
this.syncOnlyRadioButton.setEnabled(false);
this.testCaseCheckBoxButton.setEnabled(false);
this.testCaseCheckBoxButton.setSelection(false);
}
else {
// //added this to increase the UI features (this will deselct all the selected features)
// this.serverXMLCheckBoxButton.setSelection(false);
// //this.generateAllCheckBoxButton.setSelection(false);
// this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
// //earlier existing code (This only set focus false)
// this.serverXMLCheckBoxButton.setEnabled(false);
// //this.generateAllCheckBoxButton.setEnabled(false);
// this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
if(clientSideCheckBoxButton.getSelection()==false
&& generateAllCheckBoxButton.getSelection() == false){
serverSideCheckBoxButton.setSelection(true);
settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton
.getSelection());
}
}
}
/**
* Validates the status of the client-side checkbox, and enables/disables
* the generation checkbox for XML configuration file
*/
private void handleClientsideSelection() {
if (this.clientSideCheckBoxButton.getSelection()) {
this.syncAndAsyncRadioButton.setSelection(true);
this.syncAndAsyncRadioButton.setEnabled(true);
this.asyncOnlyRadioButton.setEnabled(true);
this.syncOnlyRadioButton.setEnabled(true);
if(serverSideCheckBoxButton.getSelection()==true
|| generateAllCheckBoxButton.getSelection() == true){
clientSideCheckBoxButton.setSelection(true);
settings.put(PREF_CHECK_GENERATE_CLIENTSIDE, clientSideCheckBoxButton
.getSelection());
uncheckServerSide();
uncheckGenerateAll();
}
this.serverXMLCheckBoxButton.setEnabled(false);
this.serverXMLCheckBoxButton.setSelection(false);
this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
this.testCaseCheckBoxButton.setEnabled(true);
}
else {
//added this to increase the UI features (this will deselct all the selected features)
// this.syncAndAsyncRadioButton.setSelection(false);
// this.asyncOnlyRadioButton.setSelection(false);
// this.syncOnlyRadioButton.setSelection(false);
//earlier existing code (This only set focus false)
// this.syncAndAsyncRadioButton.setEnabled(false);
// this.asyncOnlyRadioButton.setEnabled(false);
// this.syncOnlyRadioButton.setEnabled(false);
if(serverSideCheckBoxButton.getSelection()==false
&& generateAllCheckBoxButton.getSelection() == false){
clientSideCheckBoxButton.setSelection(true);
settings.put(PREF_CHECK_GENERATE_CLIENTSIDE, clientSideCheckBoxButton
.getSelection());
}
}
}
private void handleGenerateAllSelection() {
if (this.generateAllCheckBoxButton.getSelection()) {
settings.put(PREF_GEN_ALL, generateAllCheckBoxButton
.getSelection());
if(serverSideCheckBoxButton.getSelection()==true
|| clientSideCheckBoxButton.getSelection() == true){
this.serverSideCheckBoxButton.setSelection(false);
settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton.getSelection());
uncheckServerSide();
uncheckClientSide();
}
this.syncAndAsyncRadioButton.setSelection(false);
this.asyncOnlyRadioButton.setSelection(false);
this.syncOnlyRadioButton.setSelection(false);
//earlier existing code (This only set focus false)
this.syncAndAsyncRadioButton.setEnabled(false);
this.asyncOnlyRadioButton.setEnabled(false);
this.syncOnlyRadioButton.setEnabled(false);
this.serverXMLCheckBoxButton.setEnabled(false);
this.serverXMLCheckBoxButton.setSelection(false);
this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
this.testCaseCheckBoxButton.setEnabled(true);
}
else{
if(serverSideCheckBoxButton.getSelection()==false
|| clientSideCheckBoxButton.getSelection() == false){
generateAllCheckBoxButton.setSelection(true);
settings.put(PREF_GEN_ALL, generateAllCheckBoxButton
.getSelection());
}
}
}
/**
* Get the selected language
*
* @return a string containing the name of the target language
*/
public String getSelectedLanguage() {
return languageSelectionComboBox.getItem(languageSelectionComboBox
.getSelectionIndex());
}
/**
* the async only status
*
* @return true if "Generate asynchronous code only" is checked
*/
public boolean isAsyncOnlyOn() {
return asyncOnlyRadioButton.getSelection();
}
/**
* the sync only status
*
* @return true if "Generate synchronous code only" is checked
*/
public boolean isSyncOnlyOn() {
return syncOnlyRadioButton.getSelection();
}
/**
* return the package name
*
* @return a string containing the package name to use for code generation
*/
public String getPackageName() {
if ("".equals(packageText.getText().trim())){
//we do not allow the packaging to be empty
//if the user sets it to empty we set it to
//the default
return URLProcessor.DEFAULT_PACKAGE;
}
return this.packageText.getText();
}
/**
* The serverside status
*
* @return true if "Generate Server-Side" is checked
*/
public boolean isServerside() {
return this.serverSideCheckBoxButton.getSelection();
}
/**
*
* @return true if "Generate XML configuration file" is checked
*/
public boolean isServerXML() {
if (this.serverXMLCheckBoxButton.isEnabled())
return this.serverXMLCheckBoxButton.getSelection();
else
return false;
}
/**
*
* @return true if "Generate test case" is checked
*/
public boolean isGenerateTestCase() {
return this.testCaseCheckBoxButton.getSelection();
}
/*
* (non-Javadoc)
*
* @see org.apache.axis2.tool.codegen.eclipse.ui.CodegenPage#getPageType()
*/
public int getPageType() {
return WSDL_2_JAVA_TYPE;
}
/**
*
* @return null if portname is empty
*/
public String getPortName() {
int selectionIndex = portNameCombo.getSelectionIndex();
if (selectionIndex != -1) {
String text = this.portNameCombo.getItem(selectionIndex);
if (text == null || text.trim().equals("")) {
return null;
}
return text;
} else {
return null;
}
}
/**
* @return null if the text is empty
*
*/
public String getServiceName() {
int selectionIndex = serviceNameCombo.getSelectionIndex();
// cater for the scenario where the combo's can be empty
if (selectionIndex != -1) {
String text = this.serviceNameCombo.getItem(selectionIndex);
if (text == null || text.trim().equals("")) {
return null;
}
return text;
} else {
return null;
}
}
/**
*
* @return
*/
public String getDatabinderName() {
return this.databindingTypeCombo.getItem(databindingTypeCombo
.getSelectionIndex());
}
/**
*
* @return
*/
public boolean getGenerateServerSideInterface() {
return this.generateServerSideInterfaceCheckBoxButton.getSelection();
}
/**
*
* @return
*/
public boolean getGenerateAll() {
return this.generateAllCheckBoxButton.getSelection();
}
/**
* get the package to namespace mappings
* @return
*/
public String getNs2PkgMapping(){
String returnList="";
TableItem[] items = namespace2packageTable.getItems();
String packageValue;
for (int i=0;i<items.length;i++){
packageValue = items[i].getText(1);
if (packageValue!=null && !"".equals(packageValue)){
returnList = returnList +
("".equals(returnList)?"":",") +
items[i].getText(0)+ "=" + packageValue;
}
}
return "".equals(returnList)?null:returnList;
}
private void disableControls(){
this.codegenOptionSelectionComboBox.select(0);
this.testCaseCheckBoxButton.setEnabled(false);
this.testCaseCheckBoxButton.setSelection(false);
this.databindingTypeCombo.setEnabled(false);
this.databindingTypeCombo.select(0);
this.generateAllCheckBoxButton.setEnabled(false);
this.generateAllCheckBoxButton.setSelection(false);
this.generateServerSideInterfaceCheckBoxButton.setEnabled(false);
this.generateServerSideInterfaceCheckBoxButton.setSelection(false);
this.languageSelectionComboBox.setEnabled(false);
this.namespace2packageTable.setEnabled(false);
this.packageText.setEditable(false);
this.portNameCombo.setEnabled(false);
this.portNameCombo.select(0);
this.serverSideCheckBoxButton.setEnabled(false);
this.serverSideCheckBoxButton.setSelection(false);
this.serverXMLCheckBoxButton.setEnabled(false);
this.serverXMLCheckBoxButton.setSelection(false);
this.serviceNameCombo.setEnabled(false);
this.serviceNameCombo.select(0);
this.syncOnlyRadioButton.setEnabled(false);
this.syncOnlyRadioButton.setSelection(false);
this.asyncOnlyRadioButton.setEnabled(false);
this.asyncOnlyRadioButton.setSelection(false);
this.syncAndAsyncRadioButton.setEnabled(false);
this.syncAndAsyncRadioButton.setSelection(true);
this.packageText.setEnabled(false);
this.clientSideCheckBoxButton.setEnabled(false);
this.clientSideCheckBoxButton.setSelection(true);
this.generateAllCheckBoxButton.setEnabled(false);
}
private void enableControls(){
this.testCaseCheckBoxButton.setEnabled(true);
this.databindingTypeCombo.setEnabled(true);
this.languageSelectionComboBox.setEnabled(true);
this.namespace2packageTable.setEnabled(true);
this.packageText.setEditable(true);
this.portNameCombo.setEnabled(true);
this.serverSideCheckBoxButton.setEnabled(true);
this.serviceNameCombo.setEnabled(true);
this.syncOnlyRadioButton.setEnabled(true);
this.asyncOnlyRadioButton.setEnabled(true);
this.syncAndAsyncRadioButton.setEnabled(true);
this.packageText.setEnabled(true);
this.clientSideCheckBoxButton.setEnabled(true);
this.generateAllCheckBoxButton.setEnabled(true);
}
/**
* get the package derived by Namespace
*/
public String getPackageFromNamespace(String namespace){
return URLProcessor.makePackageName(namespace);
}
private void handleCustomPackageNameModifyEvent() {
// This method is add as a tempory fix for the Axis2-1368
// TODO fix this permanantly.
String text = this.packageText.getText();
if ((text == null) || (text.trim().equals(""))|| (text.endsWith(".")) || (text.startsWith("."))) {
updateStatus(org.apache.axis2.tool.codegen.eclipse.plugin.CodegenWizardPlugin
.getResourceString("page2.pachage.error.nolocation"));
return;
}
updateStatus(null);
}
private void uncheckServerSide(){
this.serverSideCheckBoxButton.setSelection(false);
settings.put(PREF_CHECK_GENERATE_SERVERSIDE, serverSideCheckBoxButton.getSelection());
}
private void uncheckClientSide(){
this.clientSideCheckBoxButton.setSelection(false);
settings.put(PREF_CHECK_GENERATE_CLIENTSIDE, clientSideCheckBoxButton.getSelection());
}
private void uncheckGenerateAll(){
this.generateAllCheckBoxButton.setSelection(false);
settings.put(PREF_GEN_ALL, generateAllCheckBoxButton.getSelection());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?