Author: Grid.Qian
Date: 2010-03-31 03:39:46 -0400 (Wed, 31 Mar 2010)
New Revision: 21145
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.ui/META-INF/MANIFEST.MF
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/utils/JBossWSUIUtils.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
Log:
JBIDE-5934: validate the packagename of web service client and web service sample wizard
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 2010-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -1,5 +1,7 @@
package org.jboss.tools.ws.creation.ui.widgets;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -22,11 +24,13 @@
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;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
@SuppressWarnings("restriction")
public class WSDL2JavaCodeGenConfigWidget extends SimpleWidgetDataContributor {
private ServiceModel model;
+ private IStatus status = null;
public ServiceModel getModel() {
return model;
@@ -46,7 +50,7 @@
}
public WidgetDataEvents addControls(Composite parent,
- Listener statusListener) {
+ final Listener statusListener) {
Composite configCom = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, false);
@@ -56,7 +60,7 @@
// custom package name
Label lblCustomPakage = new Label(configCom, SWT.NONE);
lblCustomPakage
- .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
+ .setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
txtCustomPkgName.setText(model.getCustomPackage());
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -65,16 +69,19 @@
txtCustomPkgName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- model.setCustomPackage(txtCustomPkgName.getText());
+ if (validatePackage(txtCustomPkgName.getText())) {
+ model.setCustomPackage(txtCustomPkgName.getText());
+ }
+ statusListener.handleEvent(null);
}
});
// target
new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
+ .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);
+ 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);
@@ -93,12 +100,12 @@
// catalog file
new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Catalog_File);
+ .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);
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
btnCatlog.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String fileLocation = new FileDialog(Display.getCurrent()
@@ -110,7 +117,7 @@
// binding files
new Label(configCom, SWT.NONE)
- .setText(JBossWSCreationCoreMessages.Label_Binding_File);
+ .setText(JBossWSCreationCoreMessages.Label_Binding_File);
final List bindingList = new List(configCom, SWT.BORDER
| SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
@@ -131,7 +138,7 @@
Button btnSelect = new Button(configCom, SWT.NONE);
btnSelect
- .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
+ .setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
btnSelect.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -159,19 +166,19 @@
}
}
});
-
+
btnExtension = new Button(configCom, SWT.CHECK);
gd = new GridData();
gd.horizontalSpan = 3;
btnExtension.setLayoutData(gd);
- btnExtension.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
+ btnExtension
+ .setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
btnExtension.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- model.setEnableSOAP12(btnExtension
- .getSelection());
+ model.setEnableSOAP12(btnExtension.getSelection());
}
});
-
+
if (model.getWsScenario() != WebServiceScenario.CLIENT) {
btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
gd = new GridData();
@@ -207,15 +214,17 @@
}
});
}
-
- //enable enable soap12 checkbox if the target jbossws runtime is less than 3.0
+
+ // enable enable soap12 checkbox if the target jbossws runtime is less
+ // than 3.0
updateExtensionButtonStatus();
-
+
return this;
}
-
- private void updateExtensionButtonStatus(){
- btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model.getWebProjectName()));
+
+ private void updateExtensionButtonStatus() {
+ btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model
+ .getWebProjectName()));
}
private void loadBindingFiles(List bindingList) {
@@ -223,4 +232,22 @@
bindingList.add(fileLocation);
}
}
+
+ private boolean validatePackage(String name) {
+ try {
+ status = JBossWSUIUtils.validatePackageName(name,
+ JBossWSCreationUtils.getJavaProjectByName(model
+ .getWebProjectName()));
+ } catch (JavaModelException e1) {
+ e1.printStackTrace();
+ }
+ if (status != null && status.getSeverity() == IStatus.ERROR) {
+ return false;
+ }
+ return true;
+ }
+
+ public IStatus getStatus() {
+ return status;
+ }
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-03-30 18:22:32 UTC
(rev 21144)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2010-03-31 07:39:46 UTC
(rev 21145)
@@ -17,11 +17,13 @@
org.jboss.tools.ws.creation.core,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.emfworkbench.integration,
- org.jboss.tools.common.ui
+ org.jboss.tools.common.ui,
+ org.eclipse.core.filesystem
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.ws.ui,
org.jboss.tools.ws.ui.messages,
- org.jboss.tools.ws.ui.preferences
+ org.jboss.tools.ws.ui.preferences,
+ org.jboss.tools.ws.ui.utils
Bundle-Vendor: %PLUGIN_PROVIDER
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.jst.javaee.web,
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-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2010-03-31
07:39:46 UTC (rev 21145)
@@ -45,7 +45,7 @@
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
-Error_JBossWSGenerateWizard_NoProjectSelected=No correct project selected. Please select
a Dynamic Web Project to continue.
+Error_JBossWS_GenerateWizard_NoProjectSelected=No correct project selected. Please select
a Dynamic Web Project to continue.
Error_JBossWS_Label_Runtime_Load=Error occurred while loading JBossWS Command. Select the
correct JBoss Server folder.
Error_JBossWS_Basic_Editor_Composite=Parent control should be Composite
Error_JBossWS_Basic_Editor_Support=Editor supports only Grid layout
@@ -53,6 +53,12 @@
Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty=Path to
JBossWS home directory cannot be empty
Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct=Runtime name is not
correct
Error_JBossWS_Runtime_List_Field_Editor_Name_Cannot_Be_Empty=Name cannot be empty
+Error_JBossWS_GenerateWizard_PackageName_Cannot_Be_Empty=Package name cannot be empty
+Error_JBossWS_GenerateWizard_ClassName_Cannot_Be_Empty=Class name cannot be empty
Error_JBossWS_GenerateWizard_NotDynamicWebProject=The project must be a Dynamic Web
Project and contain a web.xml in a right Location
Error_JBossWS_GenerateWizard_ClassName_Same=The class name has been used in the web
project.
-Error_JBossWS_GenerateWizard_ServiceName_Empty=The Service Name may not be an empty
string.
\ No newline at end of file
+Error_JBossWS_GenerateWizard_ServiceName_Empty=The Service Name may not be an empty
string.
+Error_JBossWS_GenerateWizard_IsOutputFolder=Name conflict with output folder
+Error_JBossWS_GenerateWizard_PackageExists=Package already exists
+Error_JBossWS_GenerateWizard_PackageNotShown=Package already exists. Note: Views might
filter empty parent packages
+Error_JBossWS_GenerateWizard_PackageExistsDifferentCase=Package already exists with a
different case
\ No newline at end of file
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-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -69,7 +69,7 @@
public static String JBossWSGenerateWebXmlWizardPage_Project_Group_Tooltip;
public static String JBossWSGenerateWebXmlWizardPage_Web_Service_Group;
- public static String Error_JBossWSGenerateWizard_NoProjectSelected;
+ public static String Error_JBossWS_GenerateWizard_NoProjectSelected;
public static String Error_JBossWS_Label_Runtime_Load;
public static String Error_JBossWS_Basic_Editor_Composite;
public static String Error_JBossWS_Basic_Editor_Support;
@@ -79,9 +79,14 @@
public static String
Error_JBossWS_Runtime_List_Field_Editor_Inputelement_Must_Be_An_Instance_Of_List;
public static String Error_JBossWS_GenerateWizard_NotDynamicWebProject;
public static String Error_JBossWS_GenerateWizard_ClassName_Same;
+ public static String Error_JBossWS_GenerateWizard_PackageName_Cannot_Be_Empty;
+ public static String Error_JBossWS_GenerateWizard_ClassName_Cannot_Be_Empty;
public static String Error_JBossWS_GenerateWizard_ServiceName_Empty;
+ public static String Error_JBossWS_GenerateWizard_IsOutputFolder;
+ public static String Error_JBossWS_GenerateWizard_PackageExists;
+ public static String Error_JBossWS_GenerateWizard_PackageNotShown;
+ public static String Error_JBossWS_GenerateWizard_PackageExistsDifferentCase;
-
static {
NLS.initializeMessages(BUNDLE_NAME, JBossWSUIMessages.class);
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2010-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -12,7 +12,24 @@
package org.jboss.tools.ws.ui.utils;
import java.io.File;
+import java.net.URI;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaConventions;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.ui.JBossWSUIPlugin;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+
/**
* @author Grid Qian
*/
@@ -30,4 +47,89 @@
return returnPath;
}
+ public static IStatus validatePackageName(String name, IJavaElement context) {
+ IStatus status = null;
+ if (context == null || !context.exists()) {
+ status = JavaConventions.validatePackageName(name,JavaCore.VERSION_1_3,
JavaCore.VERSION_1_3);
+ if (status != null && !status.isOK()) {
+ return status;
+ }
+ }
+ String[] sourceComplianceLevels = getSourceComplianceLevels(context);
+ status = JavaConventions.validatePackageName(name,sourceComplianceLevels[0],
sourceComplianceLevels[1]);
+ if (status != null && status.getSeverity() == IStatus.ERROR) {
+ return status;
+ }
+
+ IPackageFragmentRoot[] roots = null;
+ try {
+ roots = context.getJavaProject().getPackageFragmentRoots();
+ } catch (JavaModelException e) {
+ JBossWSUIPlugin.log(e);
+ }
+ for (IPackageFragmentRoot root : roots) {
+ if (root != null) {
+ IPackageFragment pack = root.getPackageFragment(name);
+ try {
+ IPath rootPath = root.getPath();
+ IPath outputPath = root.getJavaProject()
+ .getOutputLocation();
+ if (rootPath.isPrefixOf(outputPath)
+ && !rootPath.equals(outputPath)) {
+ // if the bin folder is inside of our root, don't allow
+ // to name a package
+ // like the bin folder
+ IPath packagePath = pack.getPath();
+ if (outputPath.isPrefixOf(packagePath)) {
+ status = StatusUtils
+ .warningStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_IsOutputFolder);
+ return status;
+ }
+ }
+ if (pack.exists()) {
+ if (pack.containsJavaResources()
+ || !pack.hasSubpackages()) {
+ status = StatusUtils
+ .warningStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_PackageExists);
+ } else {
+ status = StatusUtils
+ .warningStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_PackageNotShown);
+ }
+ return status;
+ } else {
+ if(pack.getResource() == null){
+ continue;
+ }
+ URI location = pack.getResource().getLocationURI();
+ if (location != null) {
+ IFileStore store = EFS.getStore(location);
+ if (store.fetchInfo().exists()) {
+ status = StatusUtils
+ .warningStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_PackageExistsDifferentCase);
+ return status;
+ }
+ }
+ }
+ } catch (CoreException e) {
+ JBossWSUIPlugin.log(e);
+ }
+ }
+ }
+ return status;
+ }
+
+ public static String[] getSourceComplianceLevels(IJavaElement context) {
+ if (context != null) {
+ IJavaProject javaProject = context.getJavaProject();
+ if (javaProject != null) {
+ return new String[] {
+ javaProject.getOption(JavaCore.COMPILER_SOURCE, true),
+ javaProject.getOption(JavaCore.COMPILER_COMPLIANCE,
+ true) };
+ }
+ }
+ return new String[] { JavaCore.getOption(JavaCore.COMPILER_SOURCE),
+ JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE) };
+ }
+
}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateSampleClassWizardPage.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -55,7 +55,7 @@
packageName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- wizard.setClassName(packageName.getText());
+ wizard.setPackageName(packageName.getText());
setPageComplete(isPageComplete());
}
@@ -149,7 +149,7 @@
IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(
testName, wizard.getProject());
int i = 1;
- while (status != null) {
+ while (status != null && status.getSeverity() == IStatus.ERROR) {
testName = currentName + i;
wizard.setClassName(testName);
model = wizard.getServiceModel();
@@ -167,12 +167,16 @@
IStatus status = JBossWSGenerateWizardValidator.isWSClassValid(model
.getCustomClassName(), wizard.getProject());
if (status != null) {
- setMessage(status.getMessage(), DialogPage.ERROR);
- return false;
- } else {
- setMessage(null);
- return true;
+ if (status.getSeverity() == IStatus.ERROR) {
+ setMessage(status.getMessage(), DialogPage.ERROR);
+ return false;
+ } else if (status.getSeverity() == IStatus.WARNING) {
+ setMessage(status.getMessage(), DialogPage.WARNING);
+ return true;
+ }
}
+ setMessage(null);
+ return true;
}
protected void refresh() {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -150,7 +150,7 @@
if (firstPage != null && !firstPage.getControl().isDisposed()) {
if (firstPage.hasChanged())
firstPage
- .setErrorMessage(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
+ .setErrorMessage(JBossWSUIMessages.Error_JBossWS_GenerateWizard_NoProjectSelected);
}
return false;
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-30
18:22:32 UTC (rev 21144)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java 2010-03-31
07:39:46 UTC (rev 21145)
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jst.j2ee.model.IModelProvider;
import org.eclipse.jst.j2ee.model.ModelProviderManager;
import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
@@ -28,6 +29,7 @@
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
public class JBossWSGenerateWizardValidator {
@@ -50,7 +52,7 @@
IModelProvider provider = null;
if (model.getWebProjectName() == null) {
return StatusUtils
- .errorStatus(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_NoProjectSelected);
} else {
try {
IProject project = JBossWSCreationUtils.getProjectByName(model
@@ -62,7 +64,7 @@
} catch (Exception exc) {
model.setWebProjectName(null);
return StatusUtils
- .errorStatus(JBossWSUIMessages.Error_JBossWSGenerateWizard_NoProjectSelected);
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_NoProjectSelected);
}
}
Object object = provider.getModelObject();
@@ -111,15 +113,20 @@
if (model.getCustomPackage().trim().length() == 0) {
// empty package name
return StatusUtils
- .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_PackageName_Cannot_Be_Empty);
} 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.Error_JBossWSGenerateWizard_NoProjectSelected);
+ .errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Cannot_Be_Empty);
+ } else if (project == null
+ || !JavaEEProjectUtilities.isDynamicWebProject(project)) {
+ return null;
} else {
+ IStatus status = JBossWSUIUtils.validatePackageName(model
+ .getCustomPackage(), JavaCore.create(project));
+ if (status != null && status.getSeverity() == IStatus.ERROR) {
+ return status;
+ }
File file = JBossWSCreationUtils.findFileByPath(className + JAVA,
project.getLocation().toOSString());
if (file != null) {
@@ -127,8 +134,8 @@
return StatusUtils
.errorStatus(JBossWSUIMessages.Error_JBossWS_GenerateWizard_ClassName_Same);
}
+ return status;
}
- return null;
}
private static ServletDescriptor getServletDescriptor(String clsName) {