Author: dgolovin
Date: 2007-11-19 00:27:25 -0500 (Mon, 19 Nov 2007)
New Revision: 4962
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1328
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2007-11-19
05:27:20 UTC (rev 4961)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamProjectsSet.java 2007-11-19
05:27:25 UTC (rev 4962)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.core;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -126,9 +127,11 @@
*/
public IFolder getActionFolder() {
if(isWarConfiguration()) {
- return war.getFolder("src/action");
+ return findWebSrcFolderByLastSegment("action",war);
} else {
- return getEjbProject().getFolder("ejbModule");
+ IVirtualComponent com = ComponentCore.createComponent(ejb);
+ IVirtualFolder ejbRootFolder = com.getRootFolder().getFolder(new Path("/"));
//$NON-NLS-1$
+ return (IFolder)ejbRootFolder.getUnderlyingFolder();
}
}
@@ -139,9 +142,11 @@
*/
public IFolder getModelFolder() {
if(isWarConfiguration()) {
- return war.getFolder("src/model");
+ return findWebSrcFolderByLastSegment("model",war);
} else {
- return getEjbProject().getFolder("ejbModule");
+ IVirtualComponent com = ComponentCore.createComponent(ejb);
+ IVirtualFolder ejbRootFolder = com.getRootFolder().getFolder(new Path("/"));
//$NON-NLS-1$
+ return (IFolder)ejbRootFolder.getUnderlyingFolder();
}
}
@@ -183,4 +188,18 @@
war.refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
}
+
+ private static final IFolder findWebSrcFolderByLastSegment(String lastSegment, IProject
project) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if(component!=null) {
+ IVirtualFolder vFolder =
component.getRootFolder().getFolder("WEB-INF/classes");
+ IContainer[] folders = vFolder.getUnderlyingFolders();
+ for (IContainer container : folders) {
+ if(lastSegment.equals(container.getFullPath().lastSegment())) {
+ return (IFolder)container;
+ }
+ }
+ }
+ return null;
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-11-19
05:27:20 UTC (rev 4961)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2FacetInstallDelegate.java 2007-11-19
05:27:25 UTC (rev 4962)
@@ -307,19 +307,19 @@
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"),
srcFolder, true); //$NON-NLS-1$
final IContainer source = srcRootFolder.getUnderlyingFolder();
- IPath actionSrcPath = new
Path(source.getFullPath().lastSegment()+"/action"); //$NON-NLS-1$
- IPath modelSrcPath = new Path(source.getFullPath().lastSegment()+"/model");
//$NON-NLS-1$
+ IPath actionSrcPath = new
Path(source.getFullPath().removeFirstSegments(1)+"/action"); //$NON-NLS-1$
+ IPath modelSrcPath = new
Path(source.getFullPath().removeFirstSegments(1)+"/model"); //$NON-NLS-1$
srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, actionSrcPath, new
Path(source.getFullPath().lastSegment()), new
Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
- WtpUtils.createSourceFolder(project, modelSrcPath, new
Path(source.getFullPath().lastSegment()), null);
+ WtpUtils.createSourceFolder(project, actionSrcPath,
source.getFullPath().removeFirstSegments(1), new
Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
+ WtpUtils.createSourceFolder(project, modelSrcPath,
source.getFullPath().removeFirstSegments(1), null);
srcRootFolder.createLink(actionSrcPath, 0, null);
srcRootFolder.createLink(modelSrcPath, 0, null);
AntCopyUtils.copyFileToFile(
new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new
File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/action/"
+
model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.',
'/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
+ new
File(project.getLocation().toFile(),source.getFullPath().removeFirstSegments(1)+"/action/"
+
model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.',
'/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
new FilterSetCollection(filtersFilterSet), true);
// Needed to make sure /dev is picked up by test, so need seam.properties.
@@ -594,7 +594,7 @@
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
filterSet.addFilter("runtimeName",
WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
- filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment());
//$NON-NLS-1$
+ filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getFullPath().removeFirstSegments(1).toString());
//$NON-NLS-1$
// TODO: why are these filters not shared!?
filterSet.addConfiguredFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2007-11-19
05:27:20 UTC (rev 4961)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegate.java 2007-11-19
05:27:25 UTC (rev 4962)
@@ -305,19 +305,19 @@
AntCopyUtils.copyFileToFolder(new File(seamGenResFolder,"seam.properties"),
srcFolder, true); //$NON-NLS-1$
final IContainer source = srcRootFolder.getUnderlyingFolder();
- IPath actionSrcPath = new
Path(source.getFullPath().lastSegment()+"/action"); //$NON-NLS-1$
- IPath modelSrcPath = new Path(source.getFullPath().lastSegment()+"/model");
//$NON-NLS-1$
+ IPath actionSrcPath = new
Path(source.getFullPath().removeFirstSegments(1)+"/action"); //$NON-NLS-1$
+ IPath modelSrcPath = new
Path(source.getFullPath().removeFirstSegments(1)+"/model"); //$NON-NLS-1$
srcRootFolder.delete(IVirtualFolder.FORCE, monitor);
- WtpUtils.createSourceFolder(project, actionSrcPath, new
Path(source.getFullPath().lastSegment()), new
Path(webRootFolder.getLocation().lastSegment()+"/WEB-INF/dev")); //$NON-NLS-1$
- WtpUtils.createSourceFolder(project, modelSrcPath, new
Path(source.getFullPath().lastSegment()), null);
+ WtpUtils.createSourceFolder(project, actionSrcPath,
source.getFullPath().removeFirstSegments(1),
webRootFolder.getFullPath().removeFirstSegments(1).append("WEB-INF/dev"));
//$NON-NLS-1$
+ WtpUtils.createSourceFolder(project, modelSrcPath,
source.getFullPath().removeFirstSegments(1), null);
srcRootFolder.createLink(actionSrcPath, 0, null);
srcRootFolder.createLink(modelSrcPath, 0, null);
AntCopyUtils.copyFileToFile(
new File(seamGenHomeFolder,"src/Authenticator.java"), //$NON-NLS-1$
- new
File(project.getLocation().toFile(),source.getFullPath().lastSegment()+"/action/"
+
model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.',
'/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
+ new
File(project.getLocation().toFile(),source.getFullPath().removeFirstSegments(1)+"/action/"
+
model.getProperty(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString().replace('.',
'/')+"/"+"Authenticator.java"), //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
new FilterSetCollection(filtersFilterSet), true);
AntCopyUtils.copyFileToFile(
@@ -586,7 +586,7 @@
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", projectName); //$NON-NLS-1$
filterSet.addFilter("runtimeName",
WtpUtils.getServerRuntimeName(seamWebProject)); //$NON-NLS-1$
- filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getLocation().lastSegment());
//$NON-NLS-1$
+ filterSet.addFilter("webRootFolder",webRootVirtFolder.getUnderlyingFolder().getFullPath().removeFirstSegments(1).toString());
//$NON-NLS-1$
final SeamRuntime selectedRuntime =
SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).toString());
final String seamHomePath = selectedRuntime.getHomeDir();
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-11-19
05:27:20 UTC (rev 4961)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/WtpUtils.java 2007-11-19
05:27:25 UTC (rev 4962)
@@ -129,7 +129,7 @@
return ""; //$NON-NLS-1$
}
- public static IResource createSourceFolder (IProject project, IPath path, IPath exclude,
Path outputFolder) {
+ public static IResource createSourceFolder (IProject project, IPath path, IPath exclude,
IPath outputFolder) {
IJavaProject javaProject;
IClasspathEntry[] javaProjectEntries;
IPath outputLocation;