### Eclipse Workspace Patch 1.0 #P org.jboss.tools.ws.ui Index: src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java =================================================================== --- src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java (revision 24632) +++ src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizard.java (working copy) @@ -87,8 +87,14 @@ model.setUpdateWebxml(true); model.setCustomPackage(getPackageName()); - File file = JBossWSCreationUtils.findFileByPath(getClassName() + JAVA, project - .getLocation().toOSString()); + String classFilePath = + JBossWSCreationUtils.composeSrcPackageClassPath(project, model.getCustomPackage(), className); + File file = null; + if (classFilePath != null) + file = JBossWSCreationUtils.findFileByPath(classFilePath); + else + file = JBossWSCreationUtils.findFileByPath(className + JAVA, + project.getLocation().toOSString()); if (file != null) { MessageDialog .openError( Index: src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java =================================================================== --- src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java (revision 24578) +++ src/org/jboss/tools/ws/ui/wizards/JBossWSGenerateWizardValidator.java (working copy) @@ -160,7 +160,13 @@ if (status != null && status.getSeverity() == IStatus.ERROR) { return status; } - File file = JBossWSCreationUtils.findFileByPath(className + JAVA, + String classFilePath = + JBossWSCreationUtils.composeSrcPackageClassPath(project, model.getCustomPackage(), className); + File file = null; + if (classFilePath != null) + file = JBossWSCreationUtils.findFileByPath(classFilePath); + else + file = JBossWSCreationUtils.findFileByPath(className + JAVA, project.getLocation().toOSString()); if (file != null) { // class already exists #P org.jboss.tools.ws.creation.core Index: src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java =================================================================== --- src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java (revision 24277) +++ src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java (working copy) @@ -75,6 +75,7 @@ "synchronized", "this", "throw", "throws", "transient", "true", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ "try", "void", "volatile", "while" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ static final String WEBINF = "WEB-INF"; //$NON-NLS-1$ + private static String JAVA = ".java"; //$NON-NLS-1$ public static boolean isJavaKeyword(String keyword) { if (hasUpperCase(keyword)) { @@ -445,6 +446,30 @@ return path; } + public static String composeSrcPackageClassPath ( IProject project, String packageName, String className) { + String classFilePath = null; + try { + String srcPath = JBossWSCreationUtils.getJavaProjectSrcLocation(project); + if (srcPath != null && srcPath.trim().length() > 0) { + String pathSeparator = "" + File.separatorChar; //$NON-NLS-1$ + String packageToFolderPath = packageName.replace(".", pathSeparator); //$NON-NLS-1$ + classFilePath = srcPath + pathSeparator + packageToFolderPath + pathSeparator + className + JAVA; + return classFilePath; + } + } catch (JavaModelException e) { + return null; + } + return null; + + } + + public static File findFileByPath(String path) { + File file = new File(path); + if (file.exists()) + return file; + return null; + } + public static File findFileByPath(String name, String path) { File ret = null; File folder = new File(path);