Class 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 Summary

      Fields 
      Modifier and Type Field Description
      private CompilationUnit cu  
      private SourceCompletionProvider sourceProvider
      The provider used for source code, kept here since it's used so much.
      • Fields inherited from class org.fife.ui.autocomplete.CompletionProviderBase

        EMPTY_STRING
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addJar​(LibraryInfo info)
      Adds a jar to the "build path".
      void clearJars()
      Removes all jars from the "build path".
      java.lang.String getAlreadyEnteredText​(javax.swing.text.JTextComponent comp)
      Defers to the source-analyzing completion provider.
      CompilationUnit getCompilationUnit()  
      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)  
      boolean removeJar​(java.io.File jar)
      Removes a jar from the "build path".
      private void setCommentCompletions​(ShorthandCompletionCache shorthandCache)  
      void setCompilationUnit​(CompilationUnit cu)  
      void setShorthandCompletionCache​(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
      • Methods inherited from class org.fife.ui.autocomplete.CompletionProviderBase

        getCompletions, getListCellRenderer, getParameterChoicesProvider, getParent, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParent
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 be null, 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 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:
        java.io.IOException - If an IO error occurs.
        See Also:
        removeJar(File), getJars()
      • getAlreadyEnteredText

        public java.lang.String getAlreadyEnteredText​(javax.swing.text.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.
      • getCompletionsAt

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

        public java.util.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:
        addJar(LibraryInfo)
      • getParameterizedCompletions

        public java.util.List<org.fife.ui.autocomplete.ParameterizedCompletion> getParameterizedCompletions​(javax.swing.text.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​(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 false if the jar was not on the build path.
        See Also:
        addJar(LibraryInfo)
      • 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.