Author: scabanovich
Date: 2009-04-20 10:21:04 -0400 (Mon, 20 Apr 2009)
New Revision: 14820
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3665
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java 2009-04-20
13:16:42 UTC (rev 14819)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java 2009-04-20
14:21:04 UTC (rev 14820)
@@ -161,6 +161,9 @@
if(resourceName != null && resource.isLinked()) return
resourceName.replace('#', '/');
return resourceName;
}
+
if("true".equals(getModel().getProperties().getProperty("isProjectFragment")))
{
+ return resourceName;
+ }
return p.replace('#', '/') + " (" + resourceName +
")";
}
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2009-04-20
13:16:42 UTC (rev 14819)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2009-04-20
14:21:04 UTC (rev 14820)
@@ -41,7 +41,7 @@
IProject p = (IProject)getModel().getProperties().get("project");
String app = getAttributeValue("application name");
if(p != null && !app.equals(p.getName())) {
- app = p.getName() + " (" + app + ")";
+ app = app.length() > 0 ? p.getName() + " (" + app + ")" :
p.getName();
}
return (app != null && app.length() > 0) ? app :
super.getPresentationString();
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2009-04-20
13:16:42 UTC (rev 14819)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2009-04-20
14:21:04 UTC (rev 14820)
@@ -25,6 +25,9 @@
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.osgi.framework.Bundle;
import org.jboss.tools.common.meta.action.XActionInvoker;
@@ -341,6 +344,16 @@
properties.setProperty("name", project.getName());
s = (FileSystemImpl)model.createModelObject("FileSystemFolder", properties);
fs.addChild(s);
+ if(!isJar(resource)) {
+ IResource webRoot = getFirstWebContentResource(project);
+ if(webRoot != null && webRoot.exists() && webRoot != project) {
+ fsLoc = webRoot.getLocation().toString();
+ properties.setProperty("location", fsLoc);
+ properties.setProperty("name", "WEB-ROOT");
+ s = (FileSystemImpl)model.createModelObject("FileSystemFolder",
properties);
+ fs.addChild(s);
+ }
+ }
if(!isJar(resource) || getObjectByResource(model, resource) == null) {
properties = new Properties();
@@ -370,6 +383,17 @@
return getObjectByResource(model, resource);
}
+ public static IResource getFirstWebContentResource(IProject project) {
+ IVirtualComponent vc = ComponentCore.createComponent(project);
+ if (vc == null || vc.getRootFolder() == null)
+ return null;
+ if (ModuleCoreNature.isFlexibleProject(project)) {
+ return vc.getRootFolder().getUnderlyingResource();
+ }
+
+ return null;
+ }
+
private static boolean isJar(IResource resource) {
return (resource instanceof IFile && isJar(resource.getName()));
}