Package org.fife.rsta.ac
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
public abstract class AbstractLanguageSupport extends java.lang.Object implements LanguageSupport
A base class for language support implementations.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private intautoActivationDelayThe delay for auto-activation, in milliseconds.private booleanautoActivationEnabledWhether auto-activation for completion choices is enabled for this language.private booleanautoCompleteEnabledWhether auto-completion is enabled for this language.private booleanparameterAssistanceEnabledWhether parameter assistance should be enabled for this language.private javax.swing.ListCellRenderer<java.lang.Object>rendererThe default renderer for the completion list.private booleanshowDescWindowWhether the description window is displayed when the completion list window is displayed.private java.util.Map<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea,org.fife.ui.autocomplete.AutoCompletion>textAreaToAutoCompletionMap of all text areas using this language support to their installedAutoCompletioninstances.-
Fields inherited from interface org.fife.rsta.ac.LanguageSupport
PROPERTY_LANGUAGE_PARSER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLanguageSupport()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.fife.ui.autocomplete.AutoCompletioncreateAutoCompletion(org.fife.ui.autocomplete.CompletionProvider p)Creates an auto-completion instance pre-configured and usable by mostLanguageSupports.protected javax.swing.ListCellRenderer<java.lang.Object>createDefaultCompletionCellRenderer()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.intgetAutoActivationDelay()Returns 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.javax.swing.ListCellRenderer<java.lang.Object>getDefaultCompletionCellRenderer()Returns the default list cell renderer to install for all text areas with this language support installed.booleangetShowDescWindow()REturns whether the description window is also shown when the completion list is displayed, for editors of this language.protected java.util.Set<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea>getTextAreas()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.booleanisAutoActivationEnabled()Returns whether auto-activation is enabled (that is, whether the completion popup will automatically appear after a delay when the user types an appropriate character).booleanisAutoCompleteEnabled()Returns whether auto-completion is enabled for this language.booleanisParameterAssistanceEnabled()Returns 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.voidsetDefaultCompletionCellRenderer(javax.swing.ListCellRenderer<java.lang.Object> r)Sets 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.fife.rsta.ac.LanguageSupport
install, uninstall
-
-
-
-
Field Detail
-
textAreaToAutoCompletion
private java.util.Map<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea,org.fife.ui.autocomplete.AutoCompletion> textAreaToAutoCompletion
Map 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 autoCompleteEnabled
Whether auto-completion is enabled for this language.
-
autoActivationEnabled
private boolean autoActivationEnabled
Whether auto-activation for completion choices is enabled for this language. Note that this parameter only matters ifautoCompleteEnabledistrue.
-
autoActivationDelay
private int autoActivationDelay
The delay for auto-activation, in milliseconds. This parameter is only honored if bothautoCompleteEnabledandautoActivationEnabledaretrue.
-
parameterAssistanceEnabled
private boolean parameterAssistanceEnabled
Whether parameter assistance should be enabled for this language.
-
showDescWindow
private boolean showDescWindow
Whether the description window is displayed when the completion list window is displayed.
-
renderer
private javax.swing.ListCellRenderer<java.lang.Object> renderer
The default renderer for the completion list.
-
-
Method Detail
-
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
protected javax.swing.ListCellRenderer<java.lang.Object> 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:
LanguageSupport.setAutoActivationDelay(int)
-
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
public javax.swing.ListCellRenderer<java.lang.Object> 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:
LanguageSupport.setDefaultCompletionCellRenderer(ListCellRenderer)
-
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:
LanguageSupport.setShowDescWindow(boolean)
-
getTextAreas
protected java.util.Set<org.fife.ui.rsyntaxtextarea.RSyntaxTextArea> 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:
uninstallImpl(RSyntaxTextArea)
-
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:
LanguageSupport.setAutoActivationEnabled(boolean),LanguageSupport.getAutoActivationDelay(),LanguageSupport.isAutoCompleteEnabled()
-
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:
LanguageSupport.setAutoCompleteEnabled(boolean)
-
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:
LanguageSupport.setParameterAssistanceEnabled(boolean)
-
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:
LanguageSupport.getAutoActivationDelay()
-
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:
LanguageSupport.isAutoActivationEnabled(),LanguageSupport.setAutoActivationDelay(int)
-
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:
LanguageSupport.isAutoCompleteEnabled()
-
setDefaultCompletionCellRenderer
public void setDefaultCompletionCellRenderer(javax.swing.ListCellRenderer<java.lang.Object> r)
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:
LanguageSupport.getDefaultCompletionCellRenderer()
-
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:
LanguageSupport.isParameterAssistanceEnabled()
-
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:
LanguageSupport.getShowDescWindow()
-
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:
installImpl(RSyntaxTextArea, AutoCompletion)
-
-