org.fife.rsta.ac
Class AbstractLanguageSupport

java.lang.Object
  extended by org.fife.rsta.ac.AbstractLanguageSupport
All Implemented Interfaces:
LanguageSupport
Direct Known Subclasses:
CLanguageSupport, GroovyLanguageSupport, HtmlLanguageSupport, JavaLanguageSupport, PerlLanguageSupport, PhpLanguageSupport, ShellLanguageSupport

public abstract class AbstractLanguageSupport
extends Object
implements LanguageSupport

A base class for language support implementations.

Version:
1.0
Author:
Robert Futrell

Field Summary
 
Fields inherited from interface org.fife.rsta.ac.LanguageSupport
PROPERTY_LANGUAGE_PARSER
 
Constructor Summary
protected AbstractLanguageSupport()
          Constructor.
 
Method Summary
protected  AutoCompletion createAutoCompletion(CompletionProvider p)
          Creates an auto-completion instance pre-configured and usable by most LanguageSupports.
protected  ListCellRenderer createDefaultCompletionCellRenderer()
          Creates the default cell renderer to use when none is specified.
 int getAutoActivationDelay()
          Returns the delay between when the user types a character and when the code completion popup should automatically appear (if applicable).
protected  AutoCompletion getAutoCompletionFor(RSyntaxTextArea textArea)
          Returns the auto completion instance used by a text area.
 ListCellRenderer getDefaultCompletionCellRenderer()
          Returns the default list cell renderer to install for all text areas with this language support installed.
 boolean getShowDescWindow()
          REturns whether the description window is also shown when the completion list is displayed, for editors of this language.
protected  Set getTextAreas()
          Returns the text areas with this language support currently installed.
protected  void installImpl(RSyntaxTextArea textArea, AutoCompletion ac)
          Registers an auto-completion instance.
 boolean isAutoActivationEnabled()
          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).
 boolean isAutoCompleteEnabled()
          Returns whether auto-completion is enabled for this language.
 boolean isParameterAssistanceEnabled()
          Returns whether parameter assistance is enabled for editors of this language.
 void setAutoActivationDelay(int ms)
          Sets the delay between when the user types a character and when the code completion popup should automatically appear (if applicable).
 void setAutoActivationEnabled(boolean enabled)
          Toggles whether auto-activation is enabled.
 void setAutoCompleteEnabled(boolean enabled)
          Toggles whether auto-completion is enabled for this language.
 void setDefaultCompletionCellRenderer(ListCellRenderer r)
          Sets the default list cell renderer to install for all text areas with this language support installed.
 void setParameterAssistanceEnabled(boolean enabled)
          Toggles whether parameter assistance is enabled for editors of this language.
 void setShowDescWindow(boolean show)
          Toggles whether the description window should also be shown when the completion list is displayed, for editors of this language.
protected  void uninstallImpl(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
 

Constructor Detail

AbstractLanguageSupport

protected AbstractLanguageSupport()
Constructor.

Method Detail

createAutoCompletion

protected AutoCompletion createAutoCompletion(CompletionProvider p)
Creates an auto-completion instance pre-configured and usable by most LanguageSupports.

Parameters:
p - The completion provider.
Returns:
The auto-completion instance.

createDefaultCompletionCellRenderer

protected ListCellRenderer 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.

getAutoActivationDelay

public int getAutoActivationDelay()
Returns 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 if LanguageSupport.isAutoActivationEnabled() returns true.

Specified by:
getAutoActivationDelay in interface LanguageSupport
Returns:
The delay, in milliseconds.
See Also:
LanguageSupport.setAutoActivationDelay(int)

getAutoCompletionFor

protected AutoCompletion getAutoCompletionFor(RSyntaxTextArea textArea)
Returns the auto completion instance used by a text area.

Parameters:
textArea - The text area.
Returns:
The auto completion instance, or null if none is installed on the text area.

getDefaultCompletionCellRenderer

public ListCellRenderer getDefaultCompletionCellRenderer()
Returns the default list cell renderer to install for all text areas with this language support installed.

Specified by:
getDefaultCompletionCellRenderer in interface LanguageSupport
Returns:
The renderer. This will never be null.
See Also:
LanguageSupport.setDefaultCompletionCellRenderer(ListCellRenderer)

getShowDescWindow

public boolean getShowDescWindow()
REturns whether the description window is also shown when the completion list is displayed, for editors of this language.

Specified by:
getShowDescWindow in interface LanguageSupport
Returns:
Whether the description window is shown.
See Also:
LanguageSupport.setShowDescWindow(boolean)

getTextAreas

protected Set getTextAreas()
Returns the text areas with this language support currently installed.

Returns:
The text areas.

installImpl

protected void installImpl(RSyntaxTextArea textArea,
                           AutoCompletion ac)
Registers an auto-completion instance. This should be called by subclasses in their LanguageSupport.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()
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). Note that this parameter will be ignored if auto-completion is disabled.

Specified by:
isAutoActivationEnabled in interface LanguageSupport
Returns:
Whether auto-activation is enabled.
See Also:
LanguageSupport.setAutoActivationEnabled(boolean), LanguageSupport.getAutoActivationDelay(), LanguageSupport.isAutoCompleteEnabled()

isAutoCompleteEnabled

public boolean isAutoCompleteEnabled()
Returns whether auto-completion is enabled for this language. If this value is false, then ctrl+space will do nothing.

Specified by:
isAutoCompleteEnabled in interface LanguageSupport
Returns:
Whether auto-completion is enabled.
See Also:
LanguageSupport.setAutoCompleteEnabled(boolean)

isParameterAssistanceEnabled

public boolean isParameterAssistanceEnabled()
Returns 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:
isParameterAssistanceEnabled in interface LanguageSupport
Returns:
Whether parameter assistance is enabled for editors of this language.
See Also:
LanguageSupport.setParameterAssistanceEnabled(boolean)

setAutoActivationDelay

public void setAutoActivationDelay(int ms)
Sets 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 if LanguageSupport.isAutoActivationEnabled() returns true.

Specified by:
setAutoActivationDelay in interface LanguageSupport
Parameters:
ms - The delay, in milliseconds. This should be greater than zero.
See Also:
LanguageSupport.getAutoActivationDelay()

setAutoActivationEnabled

public void setAutoActivationEnabled(boolean enabled)
Toggles whether auto-activation is enabled. Note that auto-activation also depends on auto-completion itself being enabled.

Specified by:
setAutoActivationEnabled in interface LanguageSupport
Parameters:
enabled - Whether auto-activation is enabled.
See Also:
LanguageSupport.isAutoActivationEnabled(), LanguageSupport.setAutoActivationDelay(int)

setAutoCompleteEnabled

public void setAutoCompleteEnabled(boolean enabled)
Toggles whether auto-completion is enabled for this language. If this is set to false, then ctrl+space will do nothing.

Specified by:
setAutoCompleteEnabled in interface LanguageSupport
Parameters:
enabled - Whether auto-completion should be enabled.
See Also:
LanguageSupport.isAutoCompleteEnabled()

setDefaultCompletionCellRenderer

public void setDefaultCompletionCellRenderer(ListCellRenderer r)
Sets 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:
setDefaultCompletionCellRenderer in interface LanguageSupport
Parameters:
r - The renderer. If this is null, a default will be used.
See Also:
LanguageSupport.getDefaultCompletionCellRenderer()

setParameterAssistanceEnabled

public void setParameterAssistanceEnabled(boolean enabled)
Toggles whether parameter assistance is enabled for editors of this language.

Specified by:
setParameterAssistanceEnabled in interface LanguageSupport
Parameters:
enabled - Whether parameter assistance is enabled.
See Also:
LanguageSupport.isParameterAssistanceEnabled()

setShowDescWindow

public void setShowDescWindow(boolean show)
Toggles whether the description window should also be shown when the completion list is displayed, for editors of this language.

Specified by:
setShowDescWindow in interface LanguageSupport
Parameters:
show - Whether to show the description window.
See Also:
LanguageSupport.getShowDescWindow()

uninstallImpl

protected void uninstallImpl(RSyntaxTextArea textArea)
Unregisters an textArea. This should be called by subclasses in their LanguageSupport.uninstall(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea) methods. This method will also call the uninstall method on the AutoComplete.

Parameters:
textArea - The text area.
See Also:
installImpl(RSyntaxTextArea, AutoCompletion)


Copyright © 2003-2011. All Rights Reserved.