Author: Grid.Qian
Date: 2010-04-08 01:58:47 -0400 (Thu, 08 Apr 2010)
New Revision: 21335
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
Log:
JBIDE-6079: to 3.1.x
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
---
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-04-08
02:08:49 UTC (rev 21334)
+++
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-04-08
05:58:47 UTC (rev 21335)
@@ -63,4 +63,4 @@
JBossWSGenerateWebXmlWizardPage_Project_Group=Dynamic Web Project Name
JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip=If no Dynamic Web Project exists,
you must create one before creating your sample web service.
JBossWSGenerateWebXmlWizardPage_Web_Service_Group=Web Service
-JBossWSGenerateWizard_NoProjectSelected=No project selected. Please select a Dynamic Web
Project to continue.
+Error_JBossWSGenerateWizard_NoProjectSelected=No correct project selected. Please select
a Dynamic Web Project to continue.
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
---
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-04-08
02:08:49 UTC (rev 21334)
+++
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-04-08
05:58:47 UTC (rev 21335)
@@ -101,7 +101,7 @@
public static String JBossWSGenerateWebXmlWizardPage_Web_Service_Group;
- public static String JBossWSGenerateWizard_NoProjectSelected;
+ public static String Error_JBossWSGenerateWizard_NoProjectSelected;
static {
NLS.initializeMessages(BUNDLE_NAME, JBossWSUIMessages.class);
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
===================================================================
---
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-04-08
02:08:49 UTC (rev 21334)
+++
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-04-08
05:58:47 UTC (rev 21335)
@@ -55,7 +55,7 @@
packageName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- wizard.setClassName(packageName.getText());
+ wizard.setPackageName(packageName.getText());
setPageComplete(isPageComplete());
}
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
===================================================================
---
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-04-08
02:08:49 UTC (rev 21334)
+++
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-04-08
05:58:47 UTC (rev 21335)
@@ -150,7 +150,7 @@
if (firstPage != null && !firstPage.getControl().isDisposed()) {
if (firstPage.hasChanged())
firstPage
- .setErrorMessage(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ .setErrorMessage(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
}
return false;
}
Modified:
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
===================================================================
---
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-04-08
02:08:49 UTC (rev 21334)
+++
branches/jbosstools-3.1.x/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-04-08
05:58:47 UTC (rev 21335)
@@ -21,6 +21,7 @@
import org.eclipse.jst.javaee.web.Servlet;
import org.eclipse.jst.javaee.web.ServletMapping;
import org.eclipse.jst.javaee.web.WebApp;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
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;
@@ -28,54 +29,58 @@
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
public class JBossWSGenerateWizardValidator {
-
+
private static ServiceModel model;
private static ServletDescriptor[] descriptors;
-
+
private static String JAVA = ".java"; //$NON-NLS-1$
- public static void setServiceModel ( ServiceModel inModel ) {
+ public static void setServiceModel(ServiceModel inModel) {
model = inModel;
descriptors = new ServletDescriptor[model.getServiceClasses().size()];
- List<String> serviceClasses = model.getServiceClasses();
- for (int i = 0; i < serviceClasses.size(); i++) {
- descriptors[i] = getServletDescriptor(serviceClasses.get(i));
- }
+ List<String> serviceClasses = model.getServiceClasses();
+ for (int i = 0; i < serviceClasses.size(); i++) {
+ descriptors[i] = getServletDescriptor(serviceClasses.get(i));
+ }
}
public static IStatus isWSNameValid() {
+ IModelProvider provider = null;
if (model.getWebProjectName() == null) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
+ } else {
try {
- ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
- } catch (IllegalArgumentException iae) {
- // ignore
+ IProject project = JBossWSCreationUtils.getProjectByName(model
+ .getWebProjectName());
+ if (!JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ throw new Exception();
+ }
+ provider = ModelProviderManager.getModelProvider(project);
+ } catch (Exception exc) {
model.setWebProjectName(null);
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
}
+
}
- final IModelProvider provider = ModelProviderManager
- .getModelProvider(JBossWSCreationUtils.getProjectByName(model
- .getWebProjectName()));
Object object = provider.getModelObject();
if (object instanceof WebApp) {
WebApp webApp = (WebApp) object;
if (model != null) {
for (int i = 0; i < descriptors.length; i++) {
- if (descriptors[i].getName().trim().length() == 0 ) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
+ if (descriptors[i].getName().trim().length() == 0) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ServiceName_Empty);
}
List<?> theServlets = webApp.getServlets();
for (int j = 0; j < theServlets.size(); j++) {
- Servlet aServlet = (Servlet) theServlets
- .get(j);
- if (aServlet.getServletName().equals(descriptors[i].getName())) {
- return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ Servlet aServlet = (Servlet) theServlets.get(j);
+ if (aServlet.getServletName().equals(
+ descriptors[i].getName())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
List<?> theServletMappings = webApp.getServletMappings();
@@ -84,10 +89,14 @@
.get(j);
List<?> urlPatterns = aServletMapping.getUrlPatterns();
for (int k = 0; k < urlPatterns.size(); k++) {
- UrlPatternType upt = (UrlPatternType) urlPatterns.get(k);
- if (aServletMapping.getServletName().equals(descriptors[i].getName()) ||
- upt.getValue().equals(descriptors[i].getMappings())) {
- return
StatusUtils.errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
+ UrlPatternType upt = (UrlPatternType) urlPatterns
+ .get(k);
+ if (aServletMapping.getServletName().equals(
+ descriptors[i].getName())
+ || upt.getValue().equals(
+ descriptors[i].getMappings())) {
+ return StatusUtils
+ .errorStatus(JBossWSCreationCoreMessages.Error_JBossWS_GenerateWizard_WSName_Same);
}
}
}
@@ -97,25 +106,26 @@
}
return null;
}
-
+
public static IStatus isWSClassValid(String className, IProject project) {
if (model.getCustomPackage().trim().length() == 0) {
// empty package name
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (model.getCustomClassName().trim().length() == 0 ) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (model.getCustomClassName().trim().length() == 0) {
// empty class name
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
- }
- else if (project == null) {
- return
StatusUtils.errorStatus(JBossWSUIMessages.JBossWSGenerateWizard_NoProjectSelected);
- }
- else {
- File file = findFileByPath(className + JAVA, project
- .getLocation().toOSString());
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ } else if (project == null) {
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
+ } else {
+ File file = findFileByPath(className + JAVA, project.getLocation()
+ .toOSString());
if (file != null) {
// class already exists
- return
StatusUtils.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ return StatusUtils
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
}
}
return null;
@@ -134,7 +144,8 @@
sd.setName(servletName);
sd.setDisplayName(sd.getName());
sd.setClassName(clsName);
- sd.setMappings(JBossWSCreationCoreMessages.Separator_Java + sd.getDisplayName());
+ sd.setMappings(JBossWSCreationCoreMessages.Separator_Java
+ + sd.getDisplayName());
return sd;
}
Show replies by date