Class AbstractLanguageSupport
java.lang.Object
org.fife.rsta.ac.AbstractLanguageSupport
- All Implemented Interfaces:
LanguageSupport
- Direct Known Subclasses:
AbstractMarkupLanguageSupport, Asm6502LanguageSupport, CLanguageSupport, CssLanguageSupport, GroovyLanguageSupport, JavaLanguageSupport, JavaScriptLanguageSupport, PerlLanguageSupport, ShellLanguageSupport, TypeScriptLanguageSupport
A base class for language support implementations.
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe delay for auto-activation, in milliseconds.private booleanWhether auto-activation for completion choices is enabled for this language.private booleanWhether auto-completion is enabled for this language.private booleanWhether parameter assistance should be enabled for this language.private ListCellRenderer<Object> The default renderer for the completion list.private booleanWhether the description window is displayed when the completion list window is displayed.private Map<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea, org.fife.ui.autocomplete.AutoCompletion> Map of all text areas using this language support to their installedAutoCompletioninstances.Fields inherited from interface LanguageSupport
PROPERTY_LANGUAGE_PARSER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.fife.ui.autocomplete.AutoCompletioncreateAutoCompletion(org.fife.ui.autocomplete.CompletionProvider p) Creates an auto-completion instance pre-configured and usable by mostLanguageSupports.protected ListCellRenderer<Object> Creates the default cell renderer to use when none is specified.private voiddelegateToSubstanceRenderer(org.fife.ui.autocomplete.CompletionCellRenderer ccr) Attempts to delegate rendering to a Substance cell renderer.intReturns the delay between when the user types a character and when the code completion popup should automatically appear (if applicable).protected org.fife.ui.autocomplete.AutoCompletiongetAutoCompletionFor(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea) Returns the auto-completion instance used by a text area.Returns the default list cell renderer to install for all text areas with this language support installed.booleanREturns whether the description window is also shown when the completion list is displayed, for editors of this language.protected Set<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea> Returns the text areas with this language support currently installed.protected voidinstallImpl(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, org.fife.ui.autocomplete.AutoCompletion ac) Registers an auto-completion instance.booleanReturns whether auto-activation is enabled (that is, whether the completion popup will automatically appear after a delay when the user types an appropriate character).booleanReturns whether auto-completion is enabled for this language.booleanReturns whether parameter assistance is enabled for editors of this language.voidsetAutoActivationDelay(int ms) Sets the delay between when the user types a character and when the code completion popup should automatically appear (if applicable).voidsetAutoActivationEnabled(boolean enabled) Toggles whether auto-activation is enabled.voidsetAutoCompleteEnabled(boolean enabled) Toggles whether auto-completion is enabled for this language.voidSets the default list cell renderer to install for all text areas with this language support installed.voidsetParameterAssistanceEnabled(boolean enabled) Toggles whether parameter assistance is enabled for editors of this language.voidsetShowDescWindow(boolean show) Toggles whether the description window should also be shown when the completion list is displayed, for editors of this language.protected voiduninstallImpl(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea) Unregisters an textArea.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface LanguageSupport
install, uninstall
-
Field Details
-
textAreaToAutoCompletion
private Map<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea, org.fife.ui.autocomplete.AutoCompletion> textAreaToAutoCompletionMap of all text areas using this language support to their installedAutoCompletioninstances. This should be maintained by subclasses by adding to, and removing from, it in theirLanguageSupport.install(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea)andLanguageSupport.uninstall(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea)methods. -
autoCompleteEnabled
private boolean autoCompleteEnabledWhether auto-completion is enabled for this language. -
autoActivationEnabled
private boolean autoActivationEnabledWhether auto-activation for completion choices is enabled for this language. Note that this parameter only matters ifautoCompleteEnabledistrue. -
autoActivationDelay
private int autoActivationDelayThe delay for auto-activation, in milliseconds. This parameter is only honored if bothautoCompleteEnabledandautoActivationEnabledaretrue. -
parameterAssistanceEnabled
private boolean parameterAssistanceEnabledWhether parameter assistance should be enabled for this language. -
showDescWindow
private boolean showDescWindowWhether the description window is displayed when the completion list window is displayed. -
renderer
The default renderer for the completion list.
-
-
Constructor Details
-
AbstractLanguageSupport
protected AbstractLanguageSupport()Constructor.
-
-
Method Details
-
createAutoCompletion
protected org.fife.ui.autocomplete.AutoCompletion createAutoCompletion(org.fife.ui.autocomplete.CompletionProvider p) Creates an auto-completion instance pre-configured and usable by mostLanguageSupports.- Parameters:
p- The completion provider.- Returns:
- The auto-completion instance.
-
createDefaultCompletionCellRenderer
Creates the default cell renderer to use when none is specified. Subclasses can override this method if there is a "better" default renderer for a specific language.- Returns:
- The default renderer for the completion list.
-
delegateToSubstanceRenderer
private void delegateToSubstanceRenderer(org.fife.ui.autocomplete.CompletionCellRenderer ccr) Attempts to delegate rendering to a Substance cell renderer.- Parameters:
ccr- The cell renderer to modify.
-
getAutoActivationDelay
public int getAutoActivationDelay()Description copied from interface:LanguageSupportReturns the delay between when the user types a character and when the code completion popup should automatically appear (if applicable). This parameter is only honored ifLanguageSupport.isAutoActivationEnabled()returnstrue.- Specified by:
getAutoActivationDelayin interfaceLanguageSupport- Returns:
- The delay, in milliseconds.
- See Also:
-
getAutoCompletionFor
protected org.fife.ui.autocomplete.AutoCompletion getAutoCompletionFor(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea) Returns the auto-completion instance used by a text area.- Parameters:
textArea- The text area.- Returns:
- The auto-completion instance, or
nullif none is installed on the text area.
-
getDefaultCompletionCellRenderer
Description copied from interface:LanguageSupportReturns the default list cell renderer to install for all text areas with this language support installed.- Specified by:
getDefaultCompletionCellRendererin interfaceLanguageSupport- Returns:
- The renderer. This will never be
null. - See Also:
-
getShowDescWindow
public boolean getShowDescWindow()Description copied from interface:LanguageSupportREturns whether the description window is also shown when the completion list is displayed, for editors of this language.- Specified by:
getShowDescWindowin interfaceLanguageSupport- Returns:
- Whether the description window is shown.
- See Also:
-
getTextAreas
Returns the text areas with this language support currently installed.- Returns:
- The text areas.
-
installImpl
protected void installImpl(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, org.fife.ui.autocomplete.AutoCompletion ac) Registers an auto-completion instance. This should be called by subclasses in theirLanguageSupport.install(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea)methods so that this language support can update all of them at once.- Parameters:
textArea- The text area that just installed the auto-completion.ac- The auto-completion instance.- See Also:
-
isAutoActivationEnabled
public boolean isAutoActivationEnabled()Description copied from interface:LanguageSupportReturns whether auto-activation is enabled (that is, whether the completion popup will automatically appear after a delay when the user types an appropriate character). Note that this parameter will be ignored if auto-completion is disabled.- Specified by:
isAutoActivationEnabledin interfaceLanguageSupport- Returns:
- Whether auto-activation is enabled.
- See Also:
-
isAutoCompleteEnabled
public boolean isAutoCompleteEnabled()Description copied from interface:LanguageSupportReturns whether auto-completion is enabled for this language. If this value isfalse, thenctrl+spacewill do nothing.- Specified by:
isAutoCompleteEnabledin interfaceLanguageSupport- Returns:
- Whether auto-completion is enabled.
- See Also:
-
isParameterAssistanceEnabled
public boolean isParameterAssistanceEnabled()Description copied from interface:LanguageSupportReturns whether parameter assistance is enabled for editors of this language. Note that some language do not support parameter assistance at all; in those cases, this parameter does nothing.- Specified by:
isParameterAssistanceEnabledin interfaceLanguageSupport- Returns:
- Whether parameter assistance is enabled for editors of this language.
- See Also:
-
setAutoActivationDelay
public void setAutoActivationDelay(int ms) Description copied from interface:LanguageSupportSets the delay between when the user types a character and when the code completion popup should automatically appear (if applicable). This parameter is only honored ifLanguageSupport.isAutoActivationEnabled()returnstrue.- Specified by:
setAutoActivationDelayin interfaceLanguageSupport- Parameters:
ms- The delay, in milliseconds. This should be greater than zero.- See Also:
-
setAutoActivationEnabled
public void setAutoActivationEnabled(boolean enabled) Description copied from interface:LanguageSupportToggles whether auto-activation is enabled. Note that auto-activation also depends on auto-completion itself being enabled.- Specified by:
setAutoActivationEnabledin interfaceLanguageSupport- Parameters:
enabled- Whether auto-activation is enabled.- See Also:
-
setAutoCompleteEnabled
public void setAutoCompleteEnabled(boolean enabled) Description copied from interface:LanguageSupportToggles whether auto-completion is enabled for this language. If this is set tofalse, thenctrl+spacewill do nothing.- Specified by:
setAutoCompleteEnabledin interfaceLanguageSupport- Parameters:
enabled- Whether auto-completion should be enabled.- See Also:
-
setDefaultCompletionCellRenderer
Description copied from interface:LanguageSupportSets the default list cell renderer to install for all text areas with this language support installed. This renderer will be shared amongst all text areas.- Specified by:
setDefaultCompletionCellRendererin interfaceLanguageSupport- Parameters:
r- The renderer. If this isnull, a default will be used.- See Also:
-
setParameterAssistanceEnabled
public void setParameterAssistanceEnabled(boolean enabled) Description copied from interface:LanguageSupportToggles whether parameter assistance is enabled for editors of this language.- Specified by:
setParameterAssistanceEnabledin interfaceLanguageSupport- Parameters:
enabled- Whether parameter assistance is enabled.- See Also:
-
setShowDescWindow
public void setShowDescWindow(boolean show) Description copied from interface:LanguageSupportToggles whether the description window should also be shown when the completion list is displayed, for editors of this language.- Specified by:
setShowDescWindowin interfaceLanguageSupport- Parameters:
show- Whether to show the description window.- See Also:
-
uninstallImpl
protected void uninstallImpl(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea) Unregisters an textArea. This should be called by subclasses in theirLanguageSupport.uninstall(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea)methods. This method will also call theuninstallmethod on theAutoCompletion.- Parameters:
textArea- The text area.- See Also:
-