Author: dazarov
Date: 2011-07-06 19:56:53 -0400 (Wed, 06 Jul 2011)
New Revision: 32682
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-9138
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java 2011-07-06
23:52:46 UTC (rev 32681)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java 2011-07-06
23:56:53 UTC (rev 32682)
@@ -42,6 +42,7 @@
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2TemplateManager;
+import org.jboss.tools.jst.web.WebUtils;
/**
*
@@ -260,11 +261,11 @@
}
IVirtualComponent component = ComponentCore.createComponent(project);
if (component != null) {
- IVirtualFolder webRootFolder = component.getRootFolder().getFolder(
- new Path("/")); //$NON-NLS-1$
- IContainer folder = webRootFolder.getUnderlyingFolder();
+ IContainer[] folders = WebUtils.getWebRootFolders(project, false);
+ if(folders == null || folders.length == 0)
+ return null;
IFolder webFolder = ResourcesPlugin.getWorkspace().getRoot()
- .getFolder(folder.getFullPath());
+ .getFolder(folders[0].getFullPath());
IFolder resourcesFolder = webFolder.getFolder("resources"); //$NON-NLS-1$
NullProgressMonitor monitor = new NullProgressMonitor();
if (!resourcesFolder.exists()) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebUtils.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebUtils.java 2011-07-06
23:52:46 UTC (rev 32681)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/WebUtils.java 2011-07-06
23:56:53 UTC (rev 32682)
@@ -84,7 +84,7 @@
return (modelNature != null) ?
WebProject.getInstance(modelNature.getModel()).getWebRootLocation() : null;
}
- public static IContainer[] getWebRootFolders(IProject project) {
+ public static IContainer[] getWebRootFolders(IProject project, boolean ignoreTarget) {
IFacetedProject facetedProject = null;
try {
facetedProject = ProjectFacetsManager.create(project);
@@ -95,12 +95,25 @@
IVirtualComponent component = ComponentCore.createComponent(project);
if(component!=null) {
IVirtualFolder webRootVirtFolder = component.getRootFolder().getFolder(new
Path("/")); //$NON-NLS-1$
- return webRootVirtFolder.getUnderlyingFolders();
+ IContainer[] folders = webRootVirtFolder.getUnderlyingFolders();
+ if(folders.length > 1){
+ ArrayList<IContainer> containers = new ArrayList<IContainer>();
+ for(IContainer container : folders){
+ if(container.getFullPath().segmentCount() < 2 ||
!"target".equals(container.getFullPath().segment(1))) //$NON-NLS-1$
+ containers.add(container);
+ }
+ return containers.toArray(new IContainer[]{});
+ }else
+ return folders;
}
}
return null;
}
+ public static IContainer[] getWebRootFolders(IProject project) {
+ return getWebRootFolders(project, false);
+ }
+
public static String[] getServletLibraries(String natureId, String templateBase, String
servletVersion) {
String classPathVarName = findClassPathVarByNatureId(natureId);