Class JavaLanguageSupport.JavaAutoCompletion

java.lang.Object
org.fife.ui.autocomplete.AutoCompletion
org.fife.rsta.ac.java.JavaLanguageSupport.JavaAutoCompletion
Enclosing class:
JavaLanguageSupport

private class JavaLanguageSupport.JavaAutoCompletion extends org.fife.ui.autocomplete.AutoCompletion
A hack of AutoCompletion that forces the JavaParser to re-parse the document when the user presses ctrl+space.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.fife.ui.autocomplete.AutoCompletion

    org.fife.ui.autocomplete.AutoCompletion.AutoCompleteAction
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
     
    private org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    JavaAutoCompletion(JavaCompletionProvider provider, org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private String
     
    protected String
    getReplacementText(org.fife.ui.autocomplete.Completion c, Document doc, int start, int len)
    Overridden to allow for prepending to the replacement text.
    Determines whether the class name being completed has been imported, and if it hasn't, returns the import statement that should be added for it.
    protected void
    insertCompletion(org.fife.ui.autocomplete.Completion c, boolean typedParamListStartChar)
    Overridden to handle special cases, because sometimes Java code completions will edit more in the source file than just the text at the current caret position.
    protected int
     

    Methods inherited from class org.fife.ui.autocomplete.AutoCompletion

    addAutoCompletionListener, createAutoCompleteAction, doCompletion, fireAutoCompletionEvent, getAutoActivationDelay, getAutoCompleteSingleChoices, getCompletionProvider, getDefaultTriggerKey, getDescWindowColor, getExternalURLHandler, getLinkRedirector, getListCellRenderer, getParamChoicesRenderer, getParameterDescriptionTruncateThreshold, getShowDescWindow, getStyleContext, getTextComponent, getTriggerKey, hideChildWindows, hidePopupWindow, insertCompletion, install, isAutoActivationEnabled, isAutoCompleteEnabled, isHideOnCompletionProviderChange, isHideOnNoText, isParameterAssistanceEnabled, isPopupVisible, removeAutoCompletionListener, setAutoActivationDelay, setAutoActivationEnabled, setAutoCompleteEnabled, setAutoCompleteSingleChoices, setChoicesWindowSize, setCompletionProvider, setDescriptionWindowColor, setDescriptionWindowSize, setExternalURLHandler, setHideOnCompletionProviderChange, setHideOnNoText, setLinkRedirector, setListCellRenderer, setParamChoicesRenderer, setParameterAssistanceEnabled, setParameterDescriptionTruncateThreshold, setPopupVisible, setShowDescWindow, setTriggerKey, uninstall

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • textArea

      private org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea
    • replacementTextPrefix

      private String replacementTextPrefix
  • Constructor Details

    • JavaAutoCompletion

      JavaAutoCompletion(JavaCompletionProvider provider, org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
  • Method Details

    • getCurrentLineText

      private String getCurrentLineText()
    • getReplacementText

      protected String getReplacementText(org.fife.ui.autocomplete.Completion c, Document doc, int start, int len)
      Overridden to allow for prepending to the replacement text. This allows us to insert fully qualified class names. instead of unqualified ones, if necessary (i.e. if the user tries to auto-complete javax.swing.text.Document, but they've explicitly imported org.w3c.dom.Document - we need to insert the fully qualified name in that case).
      Overrides:
      getReplacementText in class org.fife.ui.autocomplete.AutoCompletion
    • getShouldAddImport

      private JavaLanguageSupport.ImportToAddInfo getShouldAddImport(ClassCompletion cc)
      Determines whether the class name being completed has been imported, and if it hasn't, returns the import statement that should be added for it. Alternatively, if the class hasn't been imported, but a class with the same (unqualified) name HAS been imported, this method sets things up so the fully-qualified version of this class's name is inserted.

      Thanks to Guilherme Joao Frantz and Jonatas Schuler for helping with the patch!

      Parameters:
      cc - The completion being inserted.
      Returns:
      Whether an import was added.
    • insertCompletion

      protected void insertCompletion(org.fife.ui.autocomplete.Completion c, boolean typedParamListStartChar)
      Overridden to handle special cases, because sometimes Java code completions will edit more in the source file than just the text at the current caret position.
      Overrides:
      insertCompletion in class org.fife.ui.autocomplete.AutoCompletion
    • refreshPopupWindow

      protected int refreshPopupWindow()
      Overrides:
      refreshPopupWindow in class org.fife.ui.autocomplete.AutoCompletion