Author: scabanovich
Date: 2009-12-04 08:19:36 -0500 (Fri, 04 Dec 2009)
New Revision: 19047
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5099
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-12-04
12:28:49 UTC (rev 19046)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-12-04
13:19:36 UTC (rev 19047)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.jboss.tools.common.model.XModelObject;
@@ -93,6 +94,13 @@
public IResource getResource() {
if(resource != null) return resource;
+ if(resource == null && id instanceof IAdaptable) {
+ IResource r = (IResource)((IAdaptable)id).getAdapter(IResource.class);
+ resource = r;
+ if(resource != null) {
+ source = resource.getFullPath();
+ }
+ }
if(source != null) {
resource = ResourcesPlugin.getWorkspace().getRoot().getFile(source);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2009-12-04
12:28:49 UTC (rev 19046)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2009-12-04
13:19:36 UTC (rev 19047)
@@ -3,6 +3,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
@@ -88,6 +89,10 @@
CompositeComponent component = new CompositeComponent();
component.setId(c);
+ IResource r = (IResource)c.getAdapter(IResource.class);
+ if(r instanceof IFile) {
+ component.setSourcePath(r.getFullPath());
+ }
component.setName(createValueInfo(c.getAttributeValue(XModelObjectConstants.ATTR_NAME)));
library.addComponent(component);