IHighlightedPositionAcceptor acceptor) {
if( resource == null || resource.getParseResult() == null) {
return;
}
INode root = resource.getParseResult().getRootNode();
BidiTreeIterator<INode> it = root.getAsTreeIterable().iterator();
while( it.hasNext() ) {
INode node = it.next();
if (node.getSemanticElement() instanceof CSSRuleRef) {
CSSRuleRef ref = (CSSRuleRef) node.getSemanticElement();
if (ref.getRef() instanceof CSSRuleDefinition) {
acceptor.addPosition(node.getOffset(), node.getLength(), CssExtHighlightingConfiguration.REFERENCES_ID);
}
else if (ref.getRef() instanceof PropertyDefinition) {
acceptor.addPosition(node.getOffset(), node.getLength(), CssExtHighlightingConfiguration.PROPERTY_ID);
}
}
else if (node.getSemanticElement() instanceof Doku) {
acceptor.addPosition(node.getOffset(), node.getLength(), CssExtHighlightingConfiguration.CSSDOC_ID);
}
else if (node.getSemanticElement() instanceof ElementDefinition) {
ElementDefinition el = (ElementDefinition) node.getSemanticElement();
BidiTreeIterator<INode> innerIt = node.getAsTreeIterable().iterator();
while(innerIt.hasNext()) {
INode n = innerIt.next();
if (n.getText().equals(el.getName())) {
acceptor.addPosition(n.getOffset(), n.getLength(), CssExtHighlightingConfiguration.ELEMENT_ID);
break;
}
}
}
else if (node.getSemanticElement() instanceof PseudoClassDefinition) {
acceptor.addPosition(node.getOffset(), node.getLength(), CssExtHighlightingConfiguration.ELEMENT_ID);
}
else if (node.getSemanticElement() instanceof PropertyDefinition) {
PropertyDefinition el = (PropertyDefinition) node.getSemanticElement();
BidiTreeIterator<INode> innerIt = node.getAsTreeIterable().iterator();
while(innerIt.hasNext()) {
INode n = innerIt.next();
if (n.getText().equals(el.getName())) {
acceptor.addPosition(n.getOffset(), n.getLength(), CssExtHighlightingConfiguration.PROPERTY_ID);
break;
}
}
}
else if (node.getSemanticElement() instanceof CSSRuleDefinition) {
CSSRuleDefinition el = (CSSRuleDefinition) node.getSemanticElement();
BidiTreeIterator<INode> innerIt = node.getAsTreeIterable().iterator();
while(innerIt.hasNext()) {
INode n = innerIt.next();
if (n.getText().equals(el.getName())) {
acceptor.addPosition(n.getOffset(), n.getLength(), CssExtHighlightingConfiguration.RULE_ID);
break;
}
}
// acceptor.addPosition(node.getOffset(), node.getLength(), CssExtHighlightingConfiguration.RULE_ID);
// CSSRuleDefinition el = (CSSRuleDefinition) node.getSemanticElement();