Package org.fife.rsta.ac.java
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.AutoCompletionA hack of AutoCompletion that forces the JavaParser to re-parse the document when the user presses ctrl+space.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringreplacementTextPrefixprivate org.fife.ui.rsyntaxtextarea.RSyntaxTextAreatextArea
-
Constructor Summary
Constructors Constructor Description JavaAutoCompletion(JavaCompletionProvider provider, org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringgetCurrentLineText()protected java.lang.StringgetReplacementText(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.ImportToAddInfogetShouldAddImport(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 voidinsertCompletion(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 intrefreshPopupWindow()-
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
-
-
-
-
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-completejavax.swing.text.Document, but they've explicitly importedorg.w3c.dom.Document- we need to insert the fully qualified name in that case).- Overrides:
getReplacementTextin classorg.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:
insertCompletionin classorg.fife.ui.autocomplete.AutoCompletion
-
refreshPopupWindow
protected int refreshPopupWindow()
- Overrides:
refreshPopupWindowin classorg.fife.ui.autocomplete.AutoCompletion
-
-