public class JarManager
extends java.lang.Object
JavaCompletionProvider instances.| Constructor and Description |
|---|
JarManager()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addClassFileSource(java.io.File jarFile)
Adds a jar to read from.
|
boolean |
addClassFileSource(LibraryInfo info)
Adds a class file source to read from.
|
void |
addCompletions(CompletionProvider p,
java.lang.String text,
java.util.Set<Completion> addTo)
Adds completions matching the specified text to a list.
|
void |
addCurrentJreClassFileSource()
Adds the current JVM's rt.jar (or class.jar if on OS X) to the list of
class file sources.
|
void |
clearClassFileSources()
Removes all class file sources from the "build path."
|
static boolean |
getCheckModifiedDatestamps()
Returns whether the "last modified" time stamp on jars and class
directories should be checked whenever completions are requested, and
if the jar/directory has been modified since the last time, reload any
cached class file data.
|
ClassFile |
getClassEntry(java.lang.String className) |
java.util.List<ClassFile> |
getClassesInPackage(java.lang.String pkgName,
boolean inPkg) |
java.util.List<ClassFile> |
getClassesWithUnqualifiedName(java.lang.String name,
java.util.List<ImportDeclaration> importDeclarations)
Returns a list of all classes/interfaces/enums with a given (unqualified)
name.
|
java.util.List<LibraryInfo> |
getClassFileSources()
Returns the jars on the "build path."
|
SourceLocation |
getSourceLocForClass(java.lang.String className) |
boolean |
removeClassFileSource(java.io.File jar)
Removes a jar from the "build path." This is a convenience method for
folks only adding and removing jar sources.
|
boolean |
removeClassFileSource(LibraryInfo toRemove)
Removes a class file source from the "build path."
|
static void |
setCheckModifiedDatestamps(boolean check)
Sets whether the "last modified" time stamp on jars and class
directories should be checked whenever completions are requested, and
if the jar/directory has been modified since the last time, reload any
cached class file data.
|
public void addCompletions(CompletionProvider p,
java.lang.String text,
java.util.Set<Completion> addTo)
p - The parent completion provider.text - The text to match.addTo - The list to add completion choices to.public boolean addClassFileSource(java.io.File jarFile)
throws java.io.IOException
jarFile - The jar to add. This cannot be null.java.io.IOException - If an IO error occurs.addClassFileSource(LibraryInfo),
addCurrentJreClassFileSource(),
getClassFileSources(),
removeClassFileSource(File)public boolean addClassFileSource(LibraryInfo info) throws java.io.IOException
info - The source to add. If this is null, then
the current JVM's main JRE jar (rt.jar, or classes.jar on OS X)
will be added. If this source has already been added, adding it
again will do nothing (except possibly update its attached source
location).java.io.IOException - If an IO error occurs.addClassFileSource(File),
addCurrentJreClassFileSource(),
getClassFileSources(),
removeClassFileSource(LibraryInfo)public void addCurrentJreClassFileSource()
throws java.io.IOException
java.io.IOException - If an IO error occurs.addClassFileSource(LibraryInfo)public void clearClassFileSources()
public static boolean getCheckModifiedDatestamps()
setCheckModifiedDatestamps(boolean)public ClassFile getClassEntry(java.lang.String className)
public java.util.List<ClassFile> getClassesWithUnqualifiedName(java.lang.String name, java.util.List<ImportDeclaration> importDeclarations)
name - The unqualified name of a type declaration.importDeclarations - The imports of the compilation unit, if any.null if there are none.public java.util.List<ClassFile> getClassesInPackage(java.lang.String pkgName, boolean inPkg)
pkgName - A package name.public java.util.List<LibraryInfo> getClassFileSources()
LibraryInfos. Modifying a
LibraryInfo in this list will have no effect on
this completion provider; in order to do that, you must re-add
the jar via addClassFileSource(LibraryInfo). If there
are no jars on the "build path," this will be an empty list.addClassFileSource(LibraryInfo)public SourceLocation getSourceLocForClass(java.lang.String className)
public boolean removeClassFileSource(java.io.File jar)
jar - The jar to remove.false
if the jar was not on the build path.removeClassFileSource(LibraryInfo),
addClassFileSource(LibraryInfo),
getClassFileSources()public boolean removeClassFileSource(LibraryInfo toRemove)
toRemove - The source to remove.false
if the source was not on the build path.removeClassFileSource(File),
addClassFileSource(LibraryInfo),
getClassFileSources()public static void setCheckModifiedDatestamps(boolean check)
check - Whether to check if any jars/directories have been
modified since the last access, and clear any cached completion
information if so.getCheckModifiedDatestamps()