Package org.eclipse.lemminx.settings
Class XMLSymbolFilter
- java.lang.Object
-
- org.eclipse.lemminx.settings.PathPatternMatcher
-
- org.eclipse.lemminx.settings.XMLSymbolFilter
-
public class XMLSymbolFilter extends PathPatternMatcher
XML symbol filter used to show/hide DOM attributes, text nodes specified with XPath expressions:"xml.symbols.filters": [ // Declaration of symbols filter for maven 'pom.xml' to show all text nodes in the Outline. { "pattern": "pom.xml", "expressions" :[ { "xpath": "//text()" } ] }, // Declaration of symbols filter for Spring beans to show all @id of the elements in the Outline. { "pattern": "bean*.xml", "expressions" :[ { "xpath": "//@id" } ] }, // Declaration of symbols filter for ant/phing build.xml files to show all target names and property // names/files in the Outline. { "pattern": "build*.xml", "expressions" :[ { // keep the value of the attribute "name" on the same line // as the "target" element, and only show the attribute value "xpath": "//target/@name", "inlineAttribute" : true, "showAttributeName": false }, // show "unless" and "depends" as nested attributes for // "target" elements { "xpath": "//target/@unless" }, { "xpath": "//target/@depends" }, { // keep the value of the attribute "name" on the same line // as the "property" element, and only show the attribute value "xpath": "//property/@name", "inlineAttribute" : true, "showAttributeName": false }, { // keep the value of the attribute "file" on the same line // as the "property" element, and show the attribute name // along with the value to distinguish it from the more common // "name" attribute "xpath": "//property/@file", "inlineAttribute" : true, "showAttributeName": true } } ]
-
-
Field Summary
Fields Modifier and Type Field Description static XMLSymbolFilterDEFAULT
-
Constructor Summary
Constructors Constructor Description XMLSymbolFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLSymbolExpressionFilter[]getExpressions()Returns the expression list filter.XMLSymbolExpressionFiltergetFilterForInlineAttr(DOMAttr attrNode)Gets the first matched attribute node that is set as an inline attribute for an element.booleanhasFilterFor(IXPathNodeMatcher.MatcherType matcherType)Returns true if the filter have an expression for the given type (element, attribute, text) and false otherwise.booleanisNodeSymbol(DOMNode node)Returns true if the given node is a symbol and false otherwise.voidsetExpressions(XMLSymbolExpressionFilter[] expressions)Set the expression list filter.-
Methods inherited from class org.eclipse.lemminx.settings.PathPatternMatcher
equals, getPathMatcher, getPattern, matches, matches, setPathMatcher, setPattern
-
-
-
-
Field Detail
-
DEFAULT
public static final XMLSymbolFilter DEFAULT
-
-
Method Detail
-
setExpressions
public void setExpressions(XMLSymbolExpressionFilter[] expressions)
Set the expression list filter.- Parameters:
expressions- the expression list filter.
-
getExpressions
public XMLSymbolExpressionFilter[] getExpressions()
Returns the expression list filter.- Returns:
- the expression list filter.
-
getFilterForInlineAttr
public XMLSymbolExpressionFilter getFilterForInlineAttr(DOMAttr attrNode)
Gets the first matched attribute node that is set as an inline attribute for an element.- Parameters:
attrNode- the DOMElement attribute node to check for.- Returns:
- the first matched attribute node that is set as an inline attribute for an element, or null if there isn't one.
-
isNodeSymbol
public boolean isNodeSymbol(DOMNode node)
Returns true if the given node is a symbol and false otherwise.- Parameters:
node- the DOM node.- Returns:
- true if the given node is a symbol and false otherwise.
-
hasFilterFor
public boolean hasFilterFor(IXPathNodeMatcher.MatcherType matcherType)
Returns true if the filter have an expression for the given type (element, attribute, text) and false otherwise.- Parameters:
matcherType- the matcher type.- Returns:
- true if the filter have an expression for the given type (element, attribute, text) and false otherwise.
-
-