Package org.fife.rsta.ac.xml
Class XmlLanguageSupport
- java.lang.Object
-
- org.fife.rsta.ac.AbstractLanguageSupport
-
- org.fife.rsta.ac.AbstractMarkupLanguageSupport
-
- org.fife.rsta.ac.xml.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 theRSyntaxTextArea.
- 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 Summary
Fields Modifier and Type Field Description private XmlCompletionProviderproviderThe shared completion provider instance for all XML editors.private booleanshowSyntaxErrorsWhether syntax errors are squiggle-underlined in the editor.-
Fields inherited from class org.fife.rsta.ac.AbstractMarkupLanguageSupport
INSERT_CLOSING_TAG_ACTION
-
Fields inherited from interface org.fife.rsta.ac.LanguageSupport
PROPERTY_LANGUAGE_PARSER
-
-
Constructor Summary
Constructors Constructor Description XmlLanguageSupport()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.swing.ListCellRenderer<java.lang.Object>createDefaultCompletionCellRenderer()Creates the default cell renderer to use when none is specified.XmlParsergetParser(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)Returns the XML parser running on a text area with this XML language support installed.private XmlCompletionProvidergetProvider()Lazily creates the shared completion provider instance for XML.booleangetShowSyntaxErrors()Returns whether syntax errors are squiggle-underlined in the editor.voidinstall(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)Installs this support.protected voidinstallKeyboardShortcuts(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)Installs extra keyboard shortcuts supported by this language support.voidsetShowSyntaxErrors(boolean show)Sets whether syntax errors are squiggle-underlined in the editor.protected booleanshouldAutoCloseTag(java.lang.String tag)Subclasses should override this method to return whether a specified tag should have its closing tag auto-inserted.voiduninstall(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)Uninstalls this support.protected voiduninstallKeyboardShortcuts(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea)Uninstalls any keyboard shortcuts specific to this language support.-
Methods inherited from class org.fife.rsta.ac.AbstractMarkupLanguageSupport
getAutoAddClosingTags, setAutoAddClosingTags
-
Methods inherited from class org.fife.rsta.ac.AbstractLanguageSupport
createAutoCompletion, getAutoActivationDelay, getAutoCompletionFor, getDefaultCompletionCellRenderer, getShowDescWindow, getTextAreas, installImpl, isAutoActivationEnabled, isAutoCompleteEnabled, isParameterAssistanceEnabled, setAutoActivationDelay, setAutoActivationEnabled, setAutoCompleteEnabled, setDefaultCompletionCellRenderer, setParameterAssistanceEnabled, setShowDescWindow, uninstallImpl
-
-
-
-
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.
-
-
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:
createDefaultCompletionCellRendererin classAbstractLanguageSupport- 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
nullif 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)
-
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.- Overrides:
installKeyboardShortcutsin classAbstractMarkupLanguageSupport- Parameters:
textArea- The text area to install the shortcuts into.- See Also:
AbstractMarkupLanguageSupport.uninstallKeyboardShortcuts(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:
shouldAutoCloseTagin classAbstractMarkupLanguageSupport- 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)
-
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.- Overrides:
uninstallKeyboardShortcutsin classAbstractMarkupLanguageSupport- Parameters:
textArea- The text area to uninstall the actions from.- See Also:
AbstractMarkupLanguageSupport.installKeyboardShortcuts(RSyntaxTextArea)
-
-