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.LanguageAwareCompletionProvider
Completion provider for the Java programming language.
Version:
1.0
  • Field Details

  • Constructor Details

    • 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 be null, in which case this completion provider will have a unique JarManager.
  • Method Details

    • addJar

      public void addJar(LibraryInfo info) throws IOException
      Adds a jar to the "build path".
      Parameters:
      info - The jar 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 jar has already been added, adding it again will do nothing (except possibly update its attached source location).
      Throws:
      IOException - If an IO error occurs.
      See Also:
    • clearJars

      public void clearJars()
      Removes all jars from the "build path".
      See Also:
    • getAlreadyEnteredText

      public String getAlreadyEnteredText(JTextComponent comp)
      Defers to the source-analyzing completion provider.
      Specified by:
      getAlreadyEnteredText in interface org.fife.ui.autocomplete.CompletionProvider
      Overrides:
      getAlreadyEnteredText in class org.fife.ui.autocomplete.LanguageAwareCompletionProvider
      Returns:
      The already entered text.
    • getCompilationUnit

      public CompilationUnit getCompilationUnit()
    • getCompletionsAt

      public List<org.fife.ui.autocomplete.Completion> getCompletionsAt(JTextComponent tc, Point p)
      Specified by:
      getCompletionsAt in interface org.fife.ui.autocomplete.CompletionProvider
      Overrides:
      getCompletionsAt in class org.fife.ui.autocomplete.LanguageAwareCompletionProvider
    • getJars

      public List<LibraryInfo> getJars()
      Returns the jars on the "build path".
      Returns:
      A list of 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 addJar(LibraryInfo). If there are no jars on the "build path," this will be an empty list.
      See Also:
    • getParameterizedCompletions

      public List<org.fife.ui.autocomplete.ParameterizedCompletion> getParameterizedCompletions(JTextComponent tc)
      Specified by:
      getParameterizedCompletions in interface org.fife.ui.autocomplete.CompletionProvider
      Overrides:
      getParameterizedCompletions in class org.fife.ui.autocomplete.LanguageAwareCompletionProvider
    • removeJar

      public boolean removeJar(File jar)
      Removes a jar from the "build path".
      Parameters:
      jar - The jar to remove.
      Returns:
      Whether the jar was removed. This will be false if the jar was not on the build path.
      See Also:
    • 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.