Author: Grid.Qian
Date: 2011-06-07 03:08:56 -0400 (Tue, 07 Jun 2011)
New Revision: 31869
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
Log:
JBIDE-8490: add more options for wsdl2java
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2011-06-07
07:08:33 UTC (rev 31868)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/META-INF/MANIFEST.MF 2011-06-07
07:08:56 UTC (rev 31869)
@@ -24,7 +24,8 @@
org.jboss.tools.ws.core,
org.eclipse.jst.ws.creation.ui,
org.eclipse.wst.common.modulecore,
- org.jboss.tools.ws.ui
+ org.jboss.tools.ws.ui,
+ org.eclipse.jdt.ui
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.ws.creation.ui.wsrt
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java 2011-06-07
07:08:33 UTC (rev 31868)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/utils/JBossCreationUIUtils.java 2011-06-07
07:08:56 UTC (rev 31869)
@@ -1,68 +1,136 @@
package org.jboss.tools.ws.creation.ui.utils;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
public class JBossCreationUIUtils {
- public static Combo createSourceCombo(Composite parent, final ServiceModel model) {
- final Combo outputDirCombo = new Combo(parent, SWT.READ_ONLY);
- outputDirCombo.setToolTipText(JBossWSCreationCoreMessages.Tooltip_SourceFolder);
- outputDirCombo.addListener(SWT.Modify, new Listener(){
- public void handleEvent(Event arg0) {
- String javaSourceFolder = outputDirCombo.getText();
- model.setJavaSourceFolder(javaSourceFolder);
- }
-
- });
+ public static Combo createComboItem(Composite configCom, ServiceModel model, String
label, String tooltip) {
+ JBossCreationUIUtils.createLabel(configCom,label,tooltip);
+ return JBossCreationUIUtils.createCombo(configCom, model,tooltip);
+ }
+
+ public static void createLabel(Composite configCom, String label, String tooltip) {
+ final Label srcDirLabel = new Label(configCom, SWT.NONE);
+ srcDirLabel.setText(label);
+ srcDirLabel.setToolTipText(tooltip);
+ }
- populateSourceFolderCombo(outputDirCombo, model.getWebProjectName());
- return outputDirCombo;
+ public static Combo createCombo(Composite parent, final ServiceModel model, String
tooltip) {
+ Combo combo = new Combo(parent, SWT.READ_ONLY);
+ combo.setToolTipText(tooltip);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ combo.setLayoutData(gd);
+ return combo;
}
- public static void populateSourceFolderCombo(Combo outputDirCombo, String
projectName) {
- outputDirCombo.removeAll();
- try {
- IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- IPackageFragmentRoot[] packageFragmentRoots =
JavaCore.create(project).getAllPackageFragmentRoots();
- for (int i = 0; i < packageFragmentRoots.length; i++) {
- IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[i];
- if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
-
outputDirCombo.add(packageFragmentRoot.getResource().getFullPath().toOSString());
- }
- }
- outputDirCombo.select(0);
- } catch (JavaModelException jme) {
- // catch it
- }
+ public static boolean populateServiceCombo(Combo serviceCombo, Definition definition)
{
+ serviceCombo.removeAll();
+ if (definition != null && definition.getServices() != null &&
!definition.getServices().isEmpty()) {
+ Iterator<?> iter = definition.getServices().values().iterator();
+ boolean hasServicePort = false;
+ while (iter.hasNext()) {
+ Service service = (Service) iter.next();
+ StringBuffer serviceName = new
StringBuffer(service.getQName().getLocalPart()).append("#"); //$NON-NLS-1$
+ if (service.getPorts() != null && !service.getPorts().isEmpty()){
+ Iterator<?> innerIter = service.getPorts().values().iterator();
+ while (innerIter.hasNext()) {
+ serviceName.append(((Port)innerIter.next()).getName());
+ if (innerIter.hasNext()) {
+ serviceName.append(","); //$NON-NLS-1$
+ }
+ }
+ hasServicePort = true;
+ }
+ serviceCombo.add(serviceName.toString());
+ serviceCombo.setData(serviceName.toString(), service);
+ }
+ if (hasServicePort) {
+ serviceCombo.select(0);
+ return true;
+ }
+ }
+ return false;
}
+
+ public static boolean populateSourceFolderCombo(Combo outputDirCombo,
List<String> list) {
+ outputDirCombo.removeAll();
+ if (list != null && list.size() > 0) {
+ for (int i=0; i < list.size(); i++) {
+ outputDirCombo.add(list.get(i));
+ }
+ outputDirCombo.select(0);
+ return true;
+ } else {
+ return false;
+ }
+ }
- public static void createSourceComboLabel(Composite configCom) {
- final Label srcDirLabel = new Label(configCom, SWT.NONE);
- srcDirLabel.setText(JBossWSCreationCoreMessages.Label_SourceFolder_Name);
- srcDirLabel.setToolTipText(JBossWSCreationCoreMessages.Tooltip_SourceFolder);
+ public static Text createTextItem(Composite configCom, ServiceModel model,
+ String label, String tooltip) {
+ JBossCreationUIUtils.createLabel(configCom,label,tooltip);
+ return JBossCreationUIUtils.createText(configCom, model,tooltip);
}
- public static void createSourceComboItem(Composite configCom,
- Combo sourceCombo, ServiceModel model) {
- JBossCreationUIUtils.createSourceComboLabel(configCom);
- sourceCombo = JBossCreationUIUtils.createSourceCombo(configCom, model);
+ public static Text createText(Composite parent, ServiceModel model,
+ String tooltip) {
+ Text text = new Text(parent, SWT.NONE);
+ text.setToolTipText(tooltip);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
- sourceCombo.setLayoutData(gd);
+ text.setLayoutData(gd);
+ return text;
}
+
+ public static void populateTargetCombo(Combo targetCombo, ServiceModel model) {
+ targetCombo.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
+ targetCombo.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
+ targetCombo.add(JBossWSCreationCoreMessages.Value_Target_2, 2);
+ if (JBossWSCreationCoreMessages.Value_Target_0.equals(model.getTarget())) {
+ targetCombo.select(0);
+ } else if (JBossWSCreationCoreMessages.Value_Target_1.equals(model.getTarget())) {
+ targetCombo.select(1);
+ } else {
+ targetCombo.select(2);
+ }
+ }
+
+ public static Text createTextItemWithButton(Composite configCom, ServiceModel model,
String label, String tooltip) {
+ JBossCreationUIUtils.createLabel(configCom,label,tooltip);
+ Text text = JBossCreationUIUtils.createTextWithButton(configCom, tooltip);
+ return text;
+ }
+
+ public static Text createTextWithButton(Composite configCom, String tooltip) {
+ Text text = new Text(configCom, SWT.BORDER);
+ text.setToolTipText(tooltip);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return text;
+ }
+
+ public static Button createCheckButton(Composite configCom,
+ String label) {
+ Button button = new Button(configCom, SWT.CHECK);
+ GridData gd = new GridData();
+ gd.horizontalSpan = 3;
+ button.setLayoutData(gd);
+ button.setText(label);
+ return button;
+ }
+
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java 2011-06-07
07:08:33 UTC (rev 31868)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/Java2WSDLCodeGenConfigWidget.java 2011-06-07
07:08:56 UTC (rev 31869)
@@ -11,6 +11,7 @@
package org.jboss.tools.ws.creation.ui.widgets;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -19,9 +20,11 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
+import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.ui.utils.JBossCreationUIUtils;
@@ -36,6 +39,8 @@
private ServiceModel model;
private Button btnUpdateWebxml;
private Combo sourceCombo;
+ private boolean isOK;
+ private IStatus status = null;
public Java2WSDLCodeGenConfigWidget(ServiceModel model) {
this.model = model;
@@ -51,7 +56,18 @@
configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
//choose source folder
- JBossCreationUIUtils.createSourceComboItem(configCom, sourceCombo, model);
+ sourceCombo = JBossCreationUIUtils.createComboItem(configCom,
model,JBossWSCreationCoreMessages.Label_SourceFolder_Name
,JBossWSCreationCoreMessages.Tooltip_SourceFolder);
+ sourceCombo.addListener(SWT.Modify, new Listener(){
+ @Override
+ public void handleEvent(Event arg0) {
+ String javaSourceFolder = sourceCombo.getText();
+ model.setJavaSourceFolder(javaSourceFolder);
+ }
+ });
+ isOK = JBossCreationUIUtils.populateSourceFolderCombo(sourceCombo,
model.getSrcList());
+ if(!isOK) {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_SourceFolder);
+ }
final Button wsdlGen = new Button(configCom, SWT.CHECK | SWT.NONE);
GridData wsdlGenData = new GridData();
@@ -78,4 +94,8 @@
});
return this;
}
+
+ public IStatus getStatus() {
+ return status;
+ }
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java 2011-06-07
07:08:33 UTC (rev 31868)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java 2011-06-07
07:08:56 UTC (rev 31869)
@@ -1,26 +1,41 @@
package org.jboss.tools.ws.creation.ui.widgets;
+import javax.wsdl.Service;
+
+import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.PackageFragment;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor;
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.commands.WSDL2JavaHelpOptionCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
@@ -32,21 +47,22 @@
private ServiceModel model;
private IStatus status = null;
+ private Button removeButton;
+ private Button updateWebxmlButton;
+ private Button genDefaultButton;
+ private Button extensionButton;
+ private Button customPacButton;
+ private Button catalogButton;
+ private Button additionalButton;
+ private Combo serviceCombo = null;
+ private Combo sourceCombo = null;
+ private Combo targetCombo = null;
+ private Text customPacText;
+ private Text catalogText;
+ private Text additionalText;
+ private List bindingList;
+ private boolean isOK;
- public ServiceModel getModel() {
- return model;
- }
-
- public void setModel(ServiceModel model) {
- this.model = model;
- }
-
- private Button btnRemove;
- private Button btnUpdateWebxml;
- private Button btnGenDefaultImpl;
- private Button btnExtension;
- private Combo sourceCombo;
-
public WSDL2JavaCodeGenConfigWidget(ServiceModel model) {
this.model = model;
}
@@ -59,74 +75,177 @@
configCom.setLayout(layout);
configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
- //choose source folder
- JBossCreationUIUtils.createSourceComboItem(configCom, sourceCombo, model);
-
+ // services list
+ serviceCombo = JBossCreationUIUtils.createComboItem(configCom, model,
+ JBossWSCreationCoreMessages.Label_Service_Name,
+ JBossWSCreationCoreMessages.Tooltip_Service);
+ serviceCombo.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event arg0) {
+ Service service = (Service) serviceCombo.getData(serviceCombo.getText());
+ if (service == null) {
+ return;
+ } else if (service.getPorts() == null
+ || service.getPorts().isEmpty()) {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_ServicePort);
+ statusListener.handleEvent(null);
+ } else {
+ model.setService(service);
+ }
+ }
+ });
+
+ // choose source folder
+ sourceCombo = JBossCreationUIUtils.createComboItem(configCom, model,
+ JBossWSCreationCoreMessages.Label_SourceFolder_Name,
+ JBossWSCreationCoreMessages.Tooltip_SourceFolder);
+ sourceCombo.addListener(SWT.Modify, new Listener() {
+ public void handleEvent(Event arg0) {
+ String javaSourceFolder = sourceCombo.getText();
+ model.setJavaSourceFolder(javaSourceFolder);
+ }
+ });
+
// custom package name
- final Label lblCustomPakage = new Label(configCom, SWT.NONE);
- lblCustomPakage
- .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
- final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- txtCustomPkgName.setLayoutData(gd);
- txtCustomPkgName.addModifyListener(new ModifyListener() {
+ customPacText = JBossCreationUIUtils.createTextItemWithButton(configCom, model,
+ JBossWSCreationCoreMessages.Label_Custom_Package_Name,
+ JBossWSCreationCoreMessages.Tooltip_Custom_Package);
+ customPacButton = new Button(configCom, SWT.NONE);
+ customPacButton.setText(JBossWSCreationCoreMessages.Label__Browse_Button);
+ customPacText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if ("".equals(txtCustomPkgName.getText()) //$NON-NLS-1$
- || validatePackage(txtCustomPkgName.getText())) {
- model.setCustomPackage(txtCustomPkgName.getText());
+ if ("".equals(customPacText.getText()) //$NON-NLS-1$
+ || validatePackage(customPacText.getText())) {
+ model.setCustomPackage(customPacText.getText());
}
statusListener.handleEvent(null);
}
});
- txtCustomPkgName.setText(model.getCustomPackage());
-
+ customPacButton.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ IJavaProject project = model.getJavaProject();
+ if (project == null) {
+ return;
+ }
+ try {
+ SelectionDialog dialog = JavaUI.createPackageDialog(
+ null, project, IJavaElementSearchConstants.CONSIDER_REQUIRED_PROJECTS);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null
+ && dialog.getResult().length == 1) {
+ String fqPackageName = ((PackageFragment) dialog
+ .getResult()[0]).getElementName();
+ customPacText.setText(fqPackageName);
+ }
+ }
+ } catch (JavaModelException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
// target
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
- final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
- cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
- if (JBossWSCreationCoreMessages.Value_Target_0
- .equals(model.getTarget())) {
- cbSpec.select(0);
- } else {
- cbSpec.select(1);
- }
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- cbSpec.setLayoutData(gd);
- cbSpec.addModifyListener(new ModifyListener() {
-
+ targetCombo = JBossCreationUIUtils.createComboItem(configCom, model,
+ JBossWSCreationCoreMessages.Label_JaxWS_Target,
+ JBossWSCreationCoreMessages.Tooltip_JaxWS_Target);
+ targetCombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- model.setTarget(cbSpec.getText());
+ model.setTarget(targetCombo.getText());
}
});
// catalog file
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
- final Text txtCatlog = new Text(configCom, SWT.BORDER);
- txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- Button btnCatlog = new Button(configCom, SWT.NONE);
- btnCatlog
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
- btnCatlog.addSelectionListener(new SelectionAdapter() {
+ catalogText = JBossCreationUIUtils.createTextItemWithButton(configCom,
+ model, JBossWSCreationCoreMessages.Label_Catalog_File,
+ JBossWSCreationCoreMessages.Tooltip_Catalog_File);
+ catalogButton = new Button(configCom, SWT.NONE);
+ catalogButton.setText(JBossWSCreationCoreMessages.Label_Add_Button);
+ catalogButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- String fileLocation = new FileDialog(Display.getCurrent()
- .getActiveShell(), SWT.NONE).open();
- txtCatlog.setText(fileLocation);
+ String fileLocation = new FileDialog(Display.getCurrent().getActiveShell(),
SWT.NONE).open();
+ catalogText.setText(fileLocation);
model.setCatalog(fileLocation);
}
});
// binding files
- new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Binding_File);
+ createBindingFileItem(configCom);
- final List bindingList = new List(configCom, SWT.BORDER
- | SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
- gd = new GridData(GridData.FILL_HORIZONTAL);
+ // extension check button
+ extensionButton = JBossCreationUIUtils.createCheckButton(
+ configCom, JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
+ extensionButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setEnableSOAP12(extensionButton.getSelection());
+ }
+ });
+
+ if (model.getWsScenario() != WebServiceScenario.CLIENT) {
+ // generate default impl class
+ genDefaultButton = JBossCreationUIUtils.createCheckButton(configCom,
+ JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
+ genDefaultButton.setSelection(true);
+ genDefaultButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setGenerateImplementatoin(genDefaultButton.getSelection());
+ updateWebxmlButton.setEnabled(genDefaultButton.getSelection());
+ if (!genDefaultButton.getSelection()) {
+ model.setUpdateWebxml(false);
+ } else {
+ model.setUpdateWebxml(updateWebxmlButton.getSelection());
+ }
+ }
+ });
+
+ // update the web.xml
+ updateWebxmlButton = JBossCreationUIUtils.createCheckButton(
+ configCom, JBossWSCreationCoreMessages.Label_Update_Webxml);
+ updateWebxmlButton.setSelection(true);
+ updateWebxmlButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ model.setUpdateWebxml(updateWebxmlButton.getSelection());
+ }
+ });
+ }
+
+ // additional choice
+ additionalText = JBossCreationUIUtils.createTextItemWithButton(configCom, model,
+ JBossWSCreationCoreMessages.Label_AdditionalOption_Name,
+ JBossWSCreationCoreMessages.Tooltip_AdditionalOption);
+ additionalButton = new Button(configCom, SWT.NONE);
+ additionalButton.setText(JBossWSCreationCoreMessages.Label_Help_Button);
+ additionalButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ String message = getAdditionalOptions(model);
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ JBossWSCreationCoreMessages.AdditionalOption_Dialog_Title, message);
+ }
+ });
+ additionalText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!"".equals(additionalText.getText())) { //$NON-NLS-1$
+ model.setAddOptions(additionalText.getText());
+ } else {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_ServletName);
+ statusListener.handleEvent(null);
+ }
+ }
+ });
+
+ updateComposite();
+ return this;
+ }
+
+ private void createBindingFileItem(Composite configCom) {
+ Label label = new Label(configCom, SWT.NONE);
+ label.setText(JBossWSCreationCoreMessages.Label_Binding_File);
+ label.setToolTipText(JBossWSCreationCoreMessages.Tooltip_BindingFile);
+ bindingList = new List(configCom, SWT.BORDER | SWT.SCROLL_LINE
+ | SWT.V_SCROLL | SWT.H_SCROLL);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ bindingList.setToolTipText(JBossWSCreationCoreMessages.Tooltip_BindingFile);
gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
gd.verticalSpan = 3;
bindingList.setLayoutData(gd);
@@ -134,19 +253,17 @@
bindingList.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (bindingList.getSelectionIndex() >= 0) {
- btnRemove.setEnabled(true);
+ removeButton.setEnabled(true);
} else {
- btnRemove.setEnabled(false);
+ removeButton.setEnabled(false);
}
}
});
Button btnSelect = new Button(configCom, SWT.NONE);
- btnSelect
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ btnSelect.setText(JBossWSCreationCoreMessages.Label_Add_Button);
btnSelect.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
-
String fileLocation = new FileDialog(Display.getCurrent()
.getActiveShell(), SWT.NONE).open();
if (fileLocation != null
@@ -154,99 +271,79 @@
bindingList.add(fileLocation);
model.addBindingFile(fileLocation);
}
-
}
});
-
new Label(configCom, SWT.NONE);
- btnRemove = new Button(configCom, SWT.NONE);
- btnRemove.setEnabled(false);
- btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
- btnRemove.addSelectionListener(new SelectionAdapter() {
+ removeButton = new Button(configCom, SWT.NONE);
+ removeButton.setEnabled(false);
+ removeButton.setText(JBossWSCreationCoreMessages.Label_Remove_Button);
+ removeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
model.getBindingFiles().remove(bindingList.getSelectionIndex());
bindingList.remove(bindingList.getSelectionIndex());
if (bindingList.getSelectionIndex() == -1) {
- btnRemove.setEnabled(false);
+ removeButton.setEnabled(false);
}
}
});
+ }
- btnExtension = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnExtension.setLayoutData(gd);
- btnExtension
- .setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
- btnExtension.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setEnableSOAP12(btnExtension.getSelection());
- }
- });
+ private void updateComposite() {
+ boolean a = JBossWSCreationUtils.supportSOAP12(model.getWebProjectName());
+ extensionButton.setEnabled(a);
+ extensionButton.setSelection(a);
- if (model.getWsScenario() != WebServiceScenario.CLIENT) {
- btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnGenDefaultImpl.setLayoutData(gd);
- btnGenDefaultImpl
- .setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
- btnGenDefaultImpl.setSelection(true);
- btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setGenerateImplementatoin(btnGenDefaultImpl
- .getSelection());
- btnUpdateWebxml.setEnabled(btnGenDefaultImpl.getSelection());
- if (!btnGenDefaultImpl.getSelection()) {
- model.setUpdateWebxml(false);
- } else {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- }
- });
+ isOK = JBossCreationUIUtils.populateServiceCombo(serviceCombo,
+ model.getWsdlDefinition());
+ if (!isOK) {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_Service);
+ }
- btnUpdateWebxml = new Button(configCom, SWT.CHECK);
- gd = new GridData();
- gd.horizontalSpan = 3;
- btnUpdateWebxml.setLayoutData(gd);
- btnUpdateWebxml
- .setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
- btnUpdateWebxml.setSelection(true);
- btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- model.setUpdateWebxml(btnUpdateWebxml.getSelection());
- }
- });
+ isOK = JBossCreationUIUtils.populateSourceFolderCombo(sourceCombo,
model.getSrcList());
+ if (!isOK) {
+ status =
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_Message_No_SourceFolder);
}
-
- // select soap12 checkbox if the target jbossws runtime is more
- // than 3.0
- updateExtensionButtonStatus();
-
- return this;
+ JBossCreationUIUtils.populateTargetCombo(targetCombo, model);
+ customPacText.setText(model.getCustomPackage());
}
- private void updateExtensionButtonStatus() {
- boolean a = JBossWSCreationUtils.supportSOAP12(model
- .getWebProjectName());
- btnExtension.setEnabled(a);
- btnExtension.setSelection(a);
- }
-
private void loadBindingFiles(List bindingList) {
for (String fileLocation : model.getBindingFiles()) {
bindingList.add(fileLocation);
}
}
- private boolean validatePackage(String name) {
+ public static String getAdditionalOptions(ServiceModel model) {
+ IStatus status = null;
+ String message = JBossWSCreationCoreMessages.No_Message_AdditionalOptions_Dialog;
+ WSDL2JavaHelpOptionCommand command = new WSDL2JavaHelpOptionCommand(
+ model);
try {
- status = JBossWSUIUtils.validatePackageName(name,
- JBossWSCreationUtils.getJavaProjectByName(model
- .getWebProjectName()));
- } catch (JavaModelException e1) {
- e1.printStackTrace();
+ status = command.execute(null, null);
+ } catch (ExecutionException e) {
+ status = StatusUtils.errorStatus(e);
}
+ if (status.isOK()) {
+ Thread thread = command.getThread();
+ int i = 0;
+ while (thread.isAlive() && i < 20) {
+ i++;
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ if (command.getHelpOptions() != null) {
+ message = command.getHelpOptions();
+ }
+ }
+ return message;
+ }
+
+ private boolean validatePackage(String name) {
+ status = JBossWSUIUtils.validatePackageName(name,model.getJavaProject());
if (status != null && status.getSeverity() == IStatus.ERROR) {
return false;
}
@@ -256,4 +353,12 @@
public IStatus getStatus() {
return status;
}
+
+ public ServiceModel getModel() {
+ return model;
+ }
+
+ public void setModel(ServiceModel model) {
+ this.model = model;
+ }
}