Class XmlLanguageSupport

  • All Implemented Interfaces:
    LanguageSupport

    public class XmlLanguageSupport
    extends AbstractMarkupLanguageSupport
    Language support for XML. Currently supported features include:
    • Squiggle underlining of basic XML structure errors.
    • Usage of XmlOutlineTree, a tree view modeling the XML in the RSyntaxTextArea.
    Possible future features include:
    • DTD/Schema validation.
    • Code completion based off of other tags in the XML.
    • Code completion based off of the relevant DTD or schema.
    Version:
    1.0
    See Also:
    XmlOutlineTree
    • Field Detail

      • provider

        private XmlCompletionProvider provider
        The shared completion provider instance for all XML editors.
      • showSyntaxErrors

        private boolean showSyntaxErrors
        Whether syntax errors are squiggle-underlined in the editor.
    • Constructor Detail

      • XmlLanguageSupport

        public XmlLanguageSupport()
        Constructor.
    • Method Detail

      • 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.
        Overrides:
        createDefaultCompletionCellRenderer in class AbstractLanguageSupport
        Returns:
        The default renderer for the completion list.
      • getProvider

        private XmlCompletionProvider getProvider()
        Lazily creates the shared completion provider instance for XML.
        Returns:
        The completion provider.
      • getParser

        public XmlParser getParser​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Returns the XML parser running on a text area with this XML language support installed.
        Parameters:
        textArea - The text area.
        Returns:
        The XML parser. This will be null if the text area does not have this XmlLanguageSupport installed.
      • getShowSyntaxErrors

        public boolean getShowSyntaxErrors()
        Returns whether syntax errors are squiggle-underlined in the editor.
        Returns:
        Whether errors are squiggle-underlined.
        See Also:
        setShowSyntaxErrors(boolean)
      • install

        public void install​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Installs this support.
        Parameters:
        textArea - The text area to install onto.
        See Also:
        LanguageSupport.uninstall(RSyntaxTextArea)
      • setShowSyntaxErrors

        public void setShowSyntaxErrors​(boolean show)
        Sets whether syntax errors are squiggle-underlined in the editor.
        Parameters:
        show - Whether syntax errors are squiggle-underlined.
        See Also:
        getShowSyntaxErrors()
      • shouldAutoCloseTag

        protected boolean shouldAutoCloseTag​(java.lang.String tag)
        Subclasses should override this method to return whether a specified tag should have its closing tag auto-inserted.
        Specified by:
        shouldAutoCloseTag in class AbstractMarkupLanguageSupport
        Parameters:
        tag - The name of the tag to check.
        Returns:
        Whether the tag should have its closing tag auto-inserted.
      • uninstall

        public void uninstall​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)
        Uninstalls this support.
        Parameters:
        textArea - The text area to uninstall from.
        See Also:
        LanguageSupport.install(RSyntaxTextArea)