|
From: <caw...@us...> - 2007-03-08 16:30:04
|
Revision: 2106
http://svn.sourceforge.net/rubyeclipse/?rev=2106&view=rev
Author: cawilliams
Date: 2007-03-08 08:30:02 -0800 (Thu, 08 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java 2007-03-07 21:40:23 UTC (rev 2105)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/IRubyProject.java 2007-03-08 16:30:02 UTC (rev 2106)
@@ -146,4 +146,24 @@
public abstract ISourceFolderRoot getSourceFolderRoot(String rootPath);
public abstract ISourceFolderRoot findSourceFolderRoot(IPath path) throws RubyModelException;
+
+ /**
+ * Returns the existing package fragment roots identified by the given entry.
+ * Note that a classpath entry that refers to another project may
+ * have more than one root (if that project has more than on root
+ * containing source), and classpath entries within the current
+ * project identify a single root.
+ * <p>
+ * If the classpath entry denotes a variable, it will be resolved and return
+ * the roots of the target entry (empty if not resolvable).
+ * <p>
+ * If the classpath entry denotes a container, it will be resolved and return
+ * the roots corresponding to the set of container entries (empty if not resolvable).
+ *
+ * @param entry the given entry
+ * @return the existing package fragment roots identified by the given entry
+ * @see ILoadpathContainer
+ * @since 1.0.0
+ */
+ ISourceFolderRoot[] findSourceFolderRoots(ILoadpathEntry entry);
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java 2007-03-07 21:40:23 UTC (rev 2105)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/ISourceFolderRoot.java 2007-03-08 16:30:02 UTC (rev 2106)
@@ -109,5 +109,18 @@
Object[] getNonRubyResources() throws RubyModelException;
ISourceFolder getSourceFolder(String packName);
+
+ /**
+ * Returns the first raw loadpath entry that corresponds to this package
+ * fragment root.
+ * A raw loadpath entry corresponds to a package fragment root if once resolved
+ * this entry's path is equal to the root's path.
+ *
+ * @exception RubyModelException if this element does not exist or if an
+ * exception occurs while accessing its corresponding resource.
+ * @return the first raw classpath entry that corresponds to this package fragment root
+ * @since 1.0.0
+ */
+ ILoadpathEntry getRawLoadpathEntry() throws RubyModelException;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-03-07 21:40:23 UTC (rev 2105)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyProject.java 2007-03-08 16:30:02 UTC (rev 2106)
@@ -2382,6 +2382,27 @@
/**
* @see IRubyProject
*/
+ public ISourceFolderRoot[] findSourceFolderRoots(ILoadpathEntry entry) {
+ try {
+ ILoadpathEntry[] classpath = this.getRawLoadpath();
+ for (int i = 0, length = classpath.length; i < length; i++) {
+ if (classpath[i].equals(entry)) { // entry may need to be resolved
+ return
+ computeSourceFolderRoots(
+ getResolvedLoadpath(new ILoadpathEntry[] {entry}, null, true, false, null/*no reverse map*/),
+ false, // don't retrieve exported roots
+ null); /*no reverse map*/
+ }
+ }
+ } catch (RubyModelException e) {
+ // project doesn't exist: return an empty array
+ }
+ return new ISourceFolderRoot[] {};
+ }
+
+ /**
+ * @see IRubyProject
+ */
public ISourceFolderRoot[] getAllSourceFolderRoots()
throws RubyModelException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|