Package org.fife.rsta.ac.java
Class JavaCompletionProvider
- java.lang.Object
-
- org.fife.ui.autocomplete.CompletionProviderBase
-
- org.fife.ui.autocomplete.LanguageAwareCompletionProvider
-
- org.fife.rsta.ac.java.JavaCompletionProvider
-
- All Implemented Interfaces:
org.fife.ui.autocomplete.CompletionProvider,org.fife.ui.rtextarea.ToolTipSupplier
public class JavaCompletionProvider extends org.fife.ui.autocomplete.LanguageAwareCompletionProviderCompletion provider for the Java programming language.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private CompilationUnitcuprivate SourceCompletionProvidersourceProviderThe provider used for source code, kept here since it's used so much.
-
Constructor Summary
Constructors Constructor Description JavaCompletionProvider()Constructor.JavaCompletionProvider(JarManager jarManager)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJar(LibraryInfo info)Adds a jar to the "build path".voidclearJars()Removes all jars from the "build path".java.lang.StringgetAlreadyEnteredText(javax.swing.text.JTextComponent comp)Defers to the source-analyzing completion provider.CompilationUnitgetCompilationUnit()java.util.List<org.fife.ui.autocomplete.Completion>getCompletionsAt(javax.swing.text.JTextComponent tc, java.awt.Point p)java.util.List<LibraryInfo>getJars()Returns the jars on the "build path".java.util.List<org.fife.ui.autocomplete.ParameterizedCompletion>getParameterizedCompletions(javax.swing.text.JTextComponent tc)booleanremoveJar(java.io.File jar)Removes a jar from the "build path".private voidsetCommentCompletions(ShorthandCompletionCache shorthandCache)voidsetCompilationUnit(CompilationUnit cu)voidsetShorthandCompletionCache(ShorthandCompletionCache cache)Set shorthand completion cache (template and comment completions).-
Methods inherited from class org.fife.ui.autocomplete.LanguageAwareCompletionProvider
clearParameterizedCompletionParams, getCommentCompletionProvider, getCompletionsImpl, getDefaultCompletionProvider, getDocCommentCompletionProvider, getParameterListEnd, getParameterListSeparator, getParameterListStart, getStringCompletionProvider, getToolTipText, isAutoActivateOkay, setCommentCompletionProvider, setDefaultCompletionProvider, setDocCommentCompletionProvider, setParameterizedCompletionParams, setStringCompletionProvider
-
-
-
-
Field Detail
-
sourceProvider
private SourceCompletionProvider sourceProvider
The provider used for source code, kept here since it's used so much.
-
cu
private CompilationUnit cu
-
-
Constructor Detail
-
JavaCompletionProvider
public JavaCompletionProvider()
Constructor.
-
JavaCompletionProvider
public JavaCompletionProvider(JarManager jarManager)
Constructor.- Parameters:
jarManager- The jar manager to use when looking up completion choices. This can be passed in to share a single jar manager across multiple RSyntaxTextAreas. This may also benull, in which case this completion provider will have a unique JarManager.
-
-
Method Detail
-
addJar
public void addJar(LibraryInfo info) throws java.io.IOException
Adds a jar to the "build path".- Parameters:
info- The jar to add. If this isnull, then the current JVM's main JRE jar (rt.jar, or classes.jar on OS X) will be added. If this jar has already been added, adding it again will do nothing (except possibly update its attached source location).- Throws:
java.io.IOException- If an IO error occurs.- See Also:
removeJar(File),getJars()
-
clearJars
public void clearJars()
Removes all jars from the "build path".- See Also:
removeJar(File),addJar(LibraryInfo),getJars()
-
getAlreadyEnteredText
public java.lang.String getAlreadyEnteredText(javax.swing.text.JTextComponent comp)
Defers to the source-analyzing completion provider.- Specified by:
getAlreadyEnteredTextin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
getAlreadyEnteredTextin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider- Returns:
- The already entered text.
-
getCompilationUnit
public CompilationUnit getCompilationUnit()
-
getCompletionsAt
public java.util.List<org.fife.ui.autocomplete.Completion> getCompletionsAt(javax.swing.text.JTextComponent tc, java.awt.Point p)- Specified by:
getCompletionsAtin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
getCompletionsAtin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider
-
getJars
public java.util.List<LibraryInfo> getJars()
Returns the jars on the "build path".- Returns:
- A list of
LibraryInfos. Modifying aLibraryInfoin this list will have no effect on this completion provider; in order to do that, you must re-add the jar viaaddJar(LibraryInfo). If there are no jars on the "build path," this will be an empty list. - See Also:
addJar(LibraryInfo)
-
getParameterizedCompletions
public java.util.List<org.fife.ui.autocomplete.ParameterizedCompletion> getParameterizedCompletions(javax.swing.text.JTextComponent tc)
- Specified by:
getParameterizedCompletionsin interfaceorg.fife.ui.autocomplete.CompletionProvider- Overrides:
getParameterizedCompletionsin classorg.fife.ui.autocomplete.LanguageAwareCompletionProvider
-
removeJar
public boolean removeJar(java.io.File jar)
Removes a jar from the "build path".- Parameters:
jar- The jar to remove.- Returns:
- Whether the jar was removed. This will be
falseif the jar was not on the build path. - See Also:
addJar(LibraryInfo)
-
setCommentCompletions
private void setCommentCompletions(ShorthandCompletionCache shorthandCache)
-
setCompilationUnit
public void setCompilationUnit(CompilationUnit cu)
-
setShorthandCompletionCache
public void setShorthandCompletionCache(ShorthandCompletionCache cache)
Set shorthand completion cache (template and comment completions).- Parameters:
cache- The cache to use.
-
-