Index: projects/src/org/netbeans/modules/ruby/rubyproject/BootClassPathProvider.java =================================================================== RCS file: /cvs/ruby/projects/src/org/netbeans/modules/ruby/rubyproject/BootClassPathProvider.java,v retrieving revision 1.4 diff -u -u -r1.4 BootClassPathProvider.java --- projects/src/org/netbeans/modules/ruby/rubyproject/BootClassPathProvider.java 26 Oct 2007 21:07:47 -0000 1.4 +++ projects/src/org/netbeans/modules/ruby/rubyproject/BootClassPathProvider.java 10 Nov 2007 17:23:59 -0000 @@ -71,48 +71,29 @@ public ClassPath findClassPath(FileObject file, String type) { // See if the file is under the Ruby libraries - if (RubyInstallation.getInstance().isSystemFile(file)) { - return getRubyClassPaths(file, type); + FileObject systemRoot = RubyInstallation.getInstance().getSystemRoot(file); + if (systemRoot != null) { + return getRubyClassPaths(file, type, systemRoot); } return null; } - private ClassPath getRubyClassPaths(FileObject file, String type) { - // Default provider - do this for things like Ruby library files - synchronized (this) { - ClassPath cp = null; - if (file.isFolder()) { - Reference ref = (Reference) this.sourceClassPathsCache.get (file); - if (ref == null || (cp = (ClassPath)ref.get()) == null ) { - cp = ClassPathSupport.createClassPath(new FileObject[] {file}); - this.sourceClassPathsCache.put(file, new WeakReference(cp)); - } - } - else { - //Reference ref = (Reference) this.sourceRootsCache.get (file); - //FileObject sourceRoot = null; - //if (ref == null || (sourceRoot = (FileObject)ref.get()) == null ) { - // sourceRoot = getRootForFile (file, TYPE_JAVA); - // if (sourceRoot == null) { - // return null; - // } - // this.sourceRootsCache.put (file, new WeakReference(sourceRoot)); - //} - //if (!sourceRoot.isValid()) { - // this.sourceClasPathsCache.remove(sourceRoot); - //} - //else { - // ref = (Reference) this.sourceClasPathsCache.get(sourceRoot); - // if (ref == null || (cp = (ClassPath)ref.get()) == null ) { - // cp = ClassPathSupport.createClassPath(new FileObject[] {sourceRoot}); - // this.sourceClasPathsCache.put (sourceRoot, new WeakReference(cp)); - // } - //} - return null; - } - return cp; + private ClassPath getRubyClassPaths(FileObject file, String type, FileObject systemRoot) { + // Default provider - do this for things like Ruby library files + synchronized (this) { + ClassPath cp = null; + if (!file.isFolder()) { + file = systemRoot; + } + if (file.isFolder()) { + Reference ref = (Reference) this.sourceClassPathsCache.get (file); + if (ref == null || (cp = (ClassPath)ref.get()) == null ) { + cp = ClassPathSupport.createClassPath(new FileObject[] {file}); + this.sourceClassPathsCache.put(file, new WeakReference(cp)); } + } + return cp; + } } - } Index: platform/src/org/netbeans/api/ruby/platform/RubyInstallation.java =================================================================== RCS file: /cvs/ruby/platform/src/org/netbeans/api/ruby/platform/RubyInstallation.java,v retrieving revision 1.35 diff -u -u -r1.35 RubyInstallation.java --- platform/src/org/netbeans/api/ruby/platform/RubyInstallation.java 3 Nov 2007 01:24:13 -0000 1.35 +++ platform/src/org/netbeans/api/ruby/platform/RubyInstallation.java 10 Nov 2007 17:23:59 -0000 @@ -773,11 +773,12 @@ return null; } - /** Return true iff the given file is a "system" file - e.g. it's part + /** Return non-null iff the given file is a "system" file - e.g. it's part * of the Ruby 1.8 libraries, or the Java support libraries, or the user's rubygems, * or something under $GEM_HOME... + * @return The actual root the in the system the file is under. */ - public boolean isSystemFile(FileObject file) { + public FileObject getSystemRoot(FileObject file) { // See if the file is under the Ruby libraries FileObject rubyLibFo = getRubyLibFo(); FileObject rubyStubs = getRubyStubs(); @@ -790,15 +791,15 @@ while (file != null) { if (file == rubyLibFo || file == rubyStubs || file == gemHome) { - return true; + return file; } file = file.getParent(); } - return false; + return null; } - + public String getRake() { if (rake == null) { rake = findGemExecutable("rake"); // NOI18N