Class 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 java.lang.String replacementTextPrefix  
      private org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String getCurrentLineText()  
      protected java.lang.String getReplacementText​(org.fife.ui.autocomplete.Completion c, javax.swing.text.Document doc, int start, int len)
      Overridden to allow for prepending to the replacement text.
      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.
      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 refreshPopupWindow()  
      • 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 Detail

      • textArea

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

        private java.lang.String replacementTextPrefix
    • Constructor Detail

      • JavaAutoCompletion

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

      • getCurrentLineText

        private java.lang.String getCurrentLineText()
      • getReplacementText

        protected java.lang.String getReplacementText​(org.fife.ui.autocomplete.Completion c,
                                                      javax.swing.text.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