Package org.fife.ui.autocomplete
Class RoundRobinAutoCompletion
- java.lang.Object
-
- org.fife.ui.autocomplete.AutoCompletion
-
- org.fife.ui.autocomplete.RoundRobinAutoCompletion
-
public class RoundRobinAutoCompletion extends AutoCompletion
AnAutoCompletionthat adds the ability to cycle through a set ofCompletionProviders via the trigger key. This allows the application to logically "group together" completions of similar kinds; for example, Java code completions vs. template completions.Usage:
XPathDynamicCompletionProvider dynamicProvider = new XPathDynamicCompletionProvider(); RoundRobinAutoCompletion ac = new RoundRobinAutoCompletion(dynamicProvider); XPathCompletionProvider staticProvider = new XPathCompletionProvider(); ac.addCompletionProvider(staticProvider); ac.setXXX(..); ... ac.install(textArea);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRoundRobinAutoCompletion.CycleAutoCompleteActionAn implementation of the auto-complete action that ensures the properCompletionProvideris displayed based on the context in which the user presses the trigger key.-
Nested classes/interfaces inherited from class org.fife.ui.autocomplete.AutoCompletion
AutoCompletion.AutoCompleteAction
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<CompletionProvider>cycleThe List of CompletionProviders to use.
-
Constructor Summary
Constructors Constructor Description RoundRobinAutoCompletion(CompletionProvider provider)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCompletionProvider(CompletionProvider provider)Adds an additionalCompletionProviderto the list to cycle through.booleanadvanceProvider()Moves to the next Provider internally.protected javax.swing.ActioncreateAutoCompleteAction()Overridden to provide our own implementation of the action.voidresetProvider()Resets the cycle to use the default provider on next refresh.-
Methods inherited from class org.fife.ui.autocomplete.AutoCompletion
addAutoCompletionListener, doCompletion, fireAutoCompletionEvent, getAutoActivationDelay, getAutoCompleteSingleChoices, getCompletionProvider, getDebug, getDefaultTriggerKey, getDescWindowColor, getExternalURLHandler, getLineOfCaret, getLinkRedirector, getListCellRenderer, getParamChoicesRenderer, getParameterDescriptionTruncateThreshold, getReplacementText, getShowDescWindow, getStyleContext, getTextComponent, getTextComponentOrientation, getTriggerKey, hideChildWindows, hidePopupWindow, insertCompletion, insertCompletion, install, isAutoActivationEnabled, isAutoCompleteEnabled, isHideOnCompletionProviderChange, isHideOnNoText, isParameterAssistanceEnabled, isPopupVisible, refreshPopupWindow, removeAutoCompletionListener, setAutoActivationDelay, setAutoActivationEnabled, setAutoCompleteEnabled, setAutoCompleteSingleChoices, setChoicesWindowSize, setCompletionProvider, setDescriptionWindowColor, setDescriptionWindowSize, setExternalURLHandler, setHideOnCompletionProviderChange, setHideOnNoText, setLinkRedirector, setListCellRenderer, setParamChoicesRenderer, setParameterAssistanceEnabled, setParameterDescriptionTruncateThreshold, setPopupVisible, setShowDescWindow, setTriggerKey, uninstall
-
-
-
-
Field Detail
-
cycle
private java.util.List<CompletionProvider> cycle
The List of CompletionProviders to use.
-
-
Constructor Detail
-
RoundRobinAutoCompletion
public RoundRobinAutoCompletion(CompletionProvider provider)
Constructor.- Parameters:
provider- A single completion provider.- See Also:
addCompletionProvider(CompletionProvider)
-
-
Method Detail
-
addCompletionProvider
public void addCompletionProvider(CompletionProvider provider)
Adds an additionalCompletionProviderto the list to cycle through.- Parameters:
provider- The new completion provider.
-
advanceProvider
public boolean advanceProvider()
Moves to the next Provider internally. Needs refresh of the popup window to display the changes.- Returns:
- true if the next provider was the default one (thus returned to the default view). May be used in case you like to hide the popup in this case.
-
createAutoCompleteAction
protected javax.swing.Action createAutoCompleteAction()
Overridden to provide our own implementation of the action.- Overrides:
createAutoCompleteActionin classAutoCompletion- Returns:
- The action to use.
- See Also:
AutoCompletion.AutoCompleteAction
-
resetProvider
public void resetProvider()
Resets the cycle to use the default provider on next refresh.
-
-