Author: scabanovich
Date: 2012-06-27 18:34:06 -0400 (Wed, 27 Jun 2012)
New Revision: 42269
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
Log:
JBIDE-11394
https://issues.jboss.org/browse/JBIDE-11394
Getting current project in findPersistenceXMLHandle() is fixed.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-06-27
21:45:01 UTC (rev 42268)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/newfile/NewDSXMLWizard.java 2012-06-27
22:34:06 UTC (rev 42269)
@@ -584,17 +584,19 @@
}
return newFile;
}
+
+ static final String PERSISTENCE_XML_PATH = "META-INF/persistence.xml";
//$NON-NLS-1$
private IFile findPersistenceXMLHandle() {
IPath containerPath = getContainerFullPath();
- IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath);
- Set<IFolder> srcs = EclipseResourceUtil.getSourceFolders(folder.getProject());
- IFolder src = (IFolder)EclipseResourceUtil.getJavaSourceRoot(folder.getProject());
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(containerPath.segment(0));
+ Set<IFolder> srcs = EclipseResourceUtil.getSourceFolders(project);
+ IFolder src = (IFolder)EclipseResourceUtil.getJavaSourceRoot(project);
if(src != null) {
- IFile result = src.getFile("META-INF/persistence.xml"); //$NON-NLS-1$
+ IFile result = src.getFile(PERSISTENCE_XML_PATH);
if(!result.exists()) {
for (IFolder f: srcs) {
- IFile r = f.getFile("META-INF/persistence.xml"); //$NON-NLS-1$
+ IFile r = f.getFile(PERSISTENCE_XML_PATH);
if(r.exists()) {
return r;
}