public interface SourceForBinaryQueryImplementation
A default implementation is registered by the
org.netbeans.modules.java.project
module which looks up the
project corresponding to the file (if any; jar
-protocol URLs
actually check the owner of the JAR file itself) and checks whether that
project has an implementation of this interface in its lookup. If so, it
delegates to that implementation. Therefore it is not generally necessary
for a project type provider to register its own global implementation of
this query, if it depends on the Java Project module and uses this style.
Note that if you supply a SourceForBinaryQueryImplementation
corresponding to an entry in a ClassPathProvider
for some source
files, there needs to be a ClassPathProvider
for the sources
used as dependencies as well. Otherwise code completion will not work well;
the current parser database creation strategy uses the following search order
when deciding what to parse for a binary classpath element:
SourceForBinaryQueryImplementation
,
if these have at least a bootclasspath specified as well by some
ClassPathProvider
.SourceForBinaryQuery
,
FileOwnerQuery,
org.netbeans.api.project.Project#getLookupModifier and Type | Method and Description |
---|---|
SourceForBinaryQuery.Result |
findSourceRoots(URL binaryRoot)
Returns the source root(s) for a given binary root.
|
SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot)
The returned SourceForBinaryQuery.Result must be a singleton. It means that for
repeated calling of this method with the same recognized root the method has to
return the same instance of SourceForBinaryQuery.Result.
The typical implementation of the findSourceRoots contains 3 steps:
Any absolute URL may be used but typically it will use the file
protocol for directory entries and jar
protocol for JAR entries
(e.g. jar:file:/tmp/foo.jar!/
).
binaryRoot
- the class path root of Java class files