Lines 71-118
Link Here
|
71 |
|
71 |
|
72 |
public ClassPath findClassPath(FileObject file, String type) { |
72 |
public ClassPath findClassPath(FileObject file, String type) { |
73 |
// See if the file is under the Ruby libraries |
73 |
// See if the file is under the Ruby libraries |
74 |
if (RubyInstallation.getInstance().isSystemFile(file)) { |
74 |
FileObject systemRoot = RubyInstallation.getInstance().getSystemRoot(file); |
75 |
return getRubyClassPaths(file, type); |
75 |
if (systemRoot != null) { |
|
|
76 |
return getRubyClassPaths(file, type, systemRoot); |
76 |
} |
77 |
} |
77 |
|
78 |
|
78 |
return null; |
79 |
return null; |
79 |
} |
80 |
} |
80 |
|
81 |
|
81 |
private ClassPath getRubyClassPaths(FileObject file, String type) { |
82 |
private ClassPath getRubyClassPaths(FileObject file, String type, FileObject systemRoot) { |
82 |
// Default provider - do this for things like Ruby library files |
83 |
// Default provider - do this for things like Ruby library files |
83 |
synchronized (this) { |
84 |
synchronized (this) { |
84 |
ClassPath cp = null; |
85 |
ClassPath cp = null; |
85 |
if (file.isFolder()) { |
86 |
if (!file.isFolder()) { |
86 |
Reference ref = (Reference) this.sourceClassPathsCache.get (file); |
87 |
file = systemRoot; |
87 |
if (ref == null || (cp = (ClassPath)ref.get()) == null ) { |
88 |
} |
88 |
cp = ClassPathSupport.createClassPath(new FileObject[] {file}); |
89 |
if (file.isFolder()) { |
89 |
this.sourceClassPathsCache.put(file, new WeakReference<ClassPath>(cp)); |
90 |
Reference ref = (Reference) this.sourceClassPathsCache.get (file); |
90 |
} |
91 |
if (ref == null || (cp = (ClassPath)ref.get()) == null ) { |
91 |
} |
92 |
cp = ClassPathSupport.createClassPath(new FileObject[] {file}); |
92 |
else { |
93 |
this.sourceClassPathsCache.put(file, new WeakReference<ClassPath>(cp)); |
93 |
//Reference ref = (Reference) this.sourceRootsCache.get (file); |
|
|
94 |
//FileObject sourceRoot = null; |
95 |
//if (ref == null || (sourceRoot = (FileObject)ref.get()) == null ) { |
96 |
// sourceRoot = getRootForFile (file, TYPE_JAVA); |
97 |
// if (sourceRoot == null) { |
98 |
// return null; |
99 |
// } |
100 |
// this.sourceRootsCache.put (file, new WeakReference(sourceRoot)); |
101 |
//} |
102 |
//if (!sourceRoot.isValid()) { |
103 |
// this.sourceClasPathsCache.remove(sourceRoot); |
104 |
//} |
105 |
//else { |
106 |
// ref = (Reference) this.sourceClasPathsCache.get(sourceRoot); |
107 |
// if (ref == null || (cp = (ClassPath)ref.get()) == null ) { |
108 |
// cp = ClassPathSupport.createClassPath(new FileObject[] {sourceRoot}); |
109 |
// this.sourceClasPathsCache.put (sourceRoot, new WeakReference(cp)); |
110 |
// } |
111 |
//} |
112 |
return null; |
113 |
} |
114 |
return cp; |
115 |
} |
94 |
} |
|
|
95 |
} |
96 |
return cp; |
97 |
} |
116 |
} |
98 |
} |
117 |
|
|
|
118 |
} |
99 |
} |