Class AbstractMarkupLanguageSupport

java.lang.Object
org.fife.rsta.ac.AbstractLanguageSupport
org.fife.rsta.ac.AbstractMarkupLanguageSupport
All Implemented Interfaces:
LanguageSupport
Direct Known Subclasses:
HtmlLanguageSupport, JspLanguageSupport, PhpLanguageSupport, XmlLanguageSupport

public abstract class AbstractMarkupLanguageSupport extends AbstractLanguageSupport
Base class for language supports for markup languages, such as HTML, PHP, and JSP. This class facilitates support for automatically adding a closing tag (e.g. "</foo>") when the user types an opening tag (e.g. "<foo attr='val'>").
Version:
1.0
  • Field Details

    • INSERT_CLOSING_TAG_ACTION

      protected static final String INSERT_CLOSING_TAG_ACTION
      See Also:
    • autoAddClosingTags

      private boolean autoAddClosingTags
      Whether closing tags are automatically added when the user types opening tags. For HTML, this will only occur for tags that are allowed to have closing tags, based on the doctype. For XML, this will always occur if this property is set to true.
  • Constructor Details

    • AbstractMarkupLanguageSupport

      protected AbstractMarkupLanguageSupport()
  • Method Details

    • getAutoAddClosingTags

      public boolean getAutoAddClosingTags()
      Returns whether closing tags should be automatically added when the user types a (non-self-closing) start tag. This will only be done for tags where closing tags are accepted and valid, based on the doctype.
      Returns:
      Whether to automatically add closing tags.
      See Also:
    • installKeyboardShortcuts

      protected void installKeyboardShortcuts(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Installs extra keyboard shortcuts supported by this language support. The default implementation maps an action to automatically add closing tags when '>' is pressed; subclasses can override and add additional shortcuts if desired.

      Subclasses should call this method in their LanguageSupport.install(RSyntaxTextArea) methods.

      Parameters:
      textArea - The text area to install the shortcuts into.
      See Also:
    • shouldAutoCloseTag

      protected abstract boolean shouldAutoCloseTag(String tag)
      Subclasses should override this method to return whether a specified tag should have its closing tag auto-inserted.
      Parameters:
      tag - The name of the tag to check.
      Returns:
      Whether the tag should have its closing tag auto-inserted.
    • setAutoAddClosingTags

      public void setAutoAddClosingTags(boolean autoAdd)
      Sets whether closing tags should be automatically added when the user types a (non-self-closing) start tag. This will only be done for tags where closing tags are accepted and valid, based on the doctype.
      Parameters:
      autoAdd - Whether to automatically add closing tags.
      See Also:
    • uninstallKeyboardShortcuts

      protected void uninstallKeyboardShortcuts(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
      Uninstalls any keyboard shortcuts specific to this language support.

      Subclasses should call this method in their LanguageSupport.uninstall(RSyntaxTextArea) methods.

      Parameters:
      textArea - The text area to uninstall the actions from.
      See Also: