[jbosstools-commits] JBoss Tools SVN: r24579 - in trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui: wizards and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Aug 31 11:37:49 EDT 2010


Author: bfitzpat
Date: 2010-08-31 11:37:49 -0400 (Tue, 31 Aug 2010)
New Revision: 24579

Modified:
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizard.java
   trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java
Log:
OPEN - issue JBIDE-6753: [restwizard] provide option to not generate servlet stuff in web.xml 
https://jira.jboss.org/browse/JBIDE-6753

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-08-31 15:22:49 UTC (rev 24578)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties	2010-08-31 15:37:49 UTC (rev 24579)
@@ -10,7 +10,8 @@
 JBossRSGenerateWizardPage_Error_RestEasyJarsNotFoundInRuntime=RESTEasy jars not found in the runtime associated with the selected project. Make sure RESTEasy is installed and try again.
 JBossRSGenerateWizardPage_Label_Application_Class_Name=Application Class Name:
 JBossRSGenerateWizardPage_Page_title=Specify the Dynamic Web Project, service, package and class name for the sample web service and web service classes.
-JBossRSGenerateWizardValidator_ERROR_Can_Only_Add_Sample_Once=Project already has the sample RESTful service installed. Cannot be added a second time.
+JBossRSGenerateWizardPage_UpdateWebXMLCheckbox=Update web.xml
+JBossRSGenerateWizardValidator_ERROR_Can_Only_Add_Sample_Once=Project already has a RESTful service installed. The sample can only be installed in an empty project.
 JBossRuntimeListFieldEditor_ActionAdd=&Add
 JBossRuntimeListFieldEditor_ActionEdit=&Edit
 JBossRuntimeListFieldEditor_ActionRemove=&Remove
@@ -162,6 +163,6 @@
 TesterWSDLUtils_WSDL_HTTPS_Secured_Inaccessible=WSDL is secured and inaccessible. Try saving a copy of the WSDL and using the file copy instead.
 TesterWSDLUtils_WSDL_Inaccessible=WSDL is inaccessible.
 UidPwdDialog_Description=Specify the user name and password to access this web service via basic authentication.
-UidPwdDialog_PWD_Label=Password: 
+UidPwdDialog_PWD_Label=Password\: 
 UidPwdDialog_Title=User Name/ Password
-UidPwdDialog_UID_Label=User Name: 
+UidPwdDialog_UID_Label=User Name\: 

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-08-31 15:22:49 UTC (rev 24578)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java	2010-08-31 15:37:49 UTC (rev 24579)
@@ -42,6 +42,7 @@
 	public static String JBossRSGenerateWizardPage_Error_RestEasyJarsNotFoundInRuntime;
 	public static String JBossRSGenerateWizardPage_Label_Application_Class_Name;
 	public static String JBossRSGenerateWizardPage_Page_title;
+	public static String JBossRSGenerateWizardPage_UpdateWebXMLCheckbox;
 	public static String JBossRSGenerateWizardValidator_ERROR_Can_Only_Add_Sample_Once;
 	public static String JBossRuntimeListFieldEditor_ActionAdd;
 	public static String JBossRuntimeListFieldEditor_ActionEdit;

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizard.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizard.java	2010-08-31 15:22:49 UTC (rev 24578)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizard.java	2010-08-31 15:37:49 UTC (rev 24579)
@@ -61,6 +61,7 @@
 	private String appClassName = APPCLASSDEFAULT;
 	private boolean useDefaultServiceName = true;
 	private boolean useDefaultClassName = true;
+	private boolean updateWebXML = true;
 
 	private IStructuredSelection selection;
 	private IProject project;
@@ -109,20 +110,22 @@
 			}
 
 			IStatus status = null;
-			try {
-				RSMergeWebXMLCommand mergeCommand = new RSMergeWebXMLCommand(model);
-				status = mergeCommand.execute(null, null);
-			} catch (ExecutionException e) {
-				JBossWSUIPlugin.log(e);
+			if (getUpdateWebXML()) {
+				try {
+					RSMergeWebXMLCommand mergeCommand = new RSMergeWebXMLCommand(model);
+					status = mergeCommand.execute(null, null);
+				} catch (ExecutionException e) {
+					JBossWSUIPlugin.log(e);
+				}
+				if (status != null && status.getSeverity() == Status.ERROR) {
+					MessageDialog
+							.openError(
+									this.getShell(),
+									JBossWSUIMessages.JBossWS_GenerateWizard_MessageDialog_Title,
+									status.getMessage());
+					return false;
+				}
 			}
-			if (status != null && status.getSeverity() == Status.ERROR) {
-				MessageDialog
-						.openError(
-								this.getShell(),
-								JBossWSUIMessages.JBossWS_GenerateWizard_MessageDialog_Title,
-								status.getMessage());
-				return false;
-			}
 			try {
 				new AddRestEasyJarsCommand(model).execute(null, null);
 				RSServiceSampleCreationCommand createCommand =
@@ -217,6 +220,14 @@
 		this.useDefaultClassName = useDefaultClassName;
 	}
 
+	public void setUpdateWebXML(boolean updateWebXML) {
+		this.updateWebXML = updateWebXML;
+	}
+
+	public boolean getUpdateWebXML() {
+		return updateWebXML;
+	}
+
 	public IProject getProject() {
 		return project;
 	}

Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java	2010-08-31 15:22:49 UTC (rev 24578)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossRSGenerateWizardPage.java	2010-08-31 15:37:49 UTC (rev 24579)
@@ -29,6 +29,7 @@
 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.Group;
@@ -48,6 +49,7 @@
 	private Text packageName;
 	private Text className;
 	private Text appClassName;
+	private Button updateWebXML;
 
 	protected JBossRSGenerateWizardPage(String pageName) {
 		super(pageName);
@@ -97,7 +99,7 @@
 		gd.horizontalSpan = 2;
 		group2.setLayout(new GridLayout(2, false));
 		group2.setLayoutData(gd);
-
+		
 		new Label(group2, SWT.NONE)
 				.setText(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateWizardPage_ServiceName_Label);
 		name = new Text(group2, SWT.BORDER);
@@ -114,6 +116,23 @@
 
 		});
 
+		updateWebXML = new Button(group2, SWT.CHECK);
+		updateWebXML.setText(JBossWSUIMessages.JBossRSGenerateWizardPage_UpdateWebXMLCheckbox);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		updateWebXML.setLayoutData(gd);
+		updateWebXML.setSelection(wizard.getUpdateWebXML());
+		updateWebXML.addSelectionListener(new SelectionListener() {
+			public void widgetSelected(SelectionEvent e) {
+				wizard.setUpdateWebXML(updateWebXML.getSelection());
+				name.setEnabled(wizard.getUpdateWebXML());
+				setPageComplete(isPageComplete());
+			}
+			public void widgetDefaultSelected(SelectionEvent e) {
+				widgetSelected(e);
+			}
+		});
+
 		Group group3 = new Group(composite, SWT.NONE);
 		group3.setText(JBossWSUIMessages.JBossWS_GenerateWizard_GenerateWizardPage_Class_Group);
 		gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -344,14 +363,16 @@
 		}
 
 		// already has a REST sample installed - can't use wizard again
-		IStatus alreadyHasREST = JBossRSGenerateWizardValidator.RESTAppExists();
-		if (alreadyHasREST != null) {
-			if (alreadyHasREST.getSeverity() == IStatus.ERROR) {
-				setMessage(alreadyHasREST.getMessage(), DialogPage.ERROR);
-				return false;
-			} else if (alreadyHasREST.getSeverity() == IStatus.WARNING) {
-				setMessage(alreadyHasREST.getMessage(), DialogPage.WARNING);
-				return true;
+		if (wizard.getUpdateWebXML()) {
+			IStatus alreadyHasREST = JBossRSGenerateWizardValidator.RESTAppExists();
+			if (alreadyHasREST != null) {
+				if (alreadyHasREST.getSeverity() == IStatus.ERROR) {
+					setMessage(alreadyHasREST.getMessage(), DialogPage.ERROR);
+					return false;
+				} else if (alreadyHasREST.getSeverity() == IStatus.WARNING) {
+					setMessage(alreadyHasREST.getMessage(), DialogPage.WARNING);
+					return true;
+				}
 			}
 		} 
 		



More information about the jbosstools-commits mailing list