|Extending XML Syntax Highlighting [message #201405]
||Sun, 07 October 2007 07:38
Originally posted by: uh5d.rz.uni-karlsruhe.de|
I want to recolor a special tag-name with a defined color in my xml
I figured out, that i must edit/extend the getAttributeFor( ITextRegion
region) method of the LineStyleProviderForXML class.
To identify my recoloring tag <BEHAVIOUR> I extract the Start and Length
( region.getStart(), region.getLength() ) of the Region if
region.getType() == DomRegionContext.XML_TAG_NAME
and then try to get the actual text of this tag by
Doc.get ( Start, Length ) where Doc is the underlying IStructuredDocument.
The problem is that region.getStart(), region.getLength() are relative to
the regions beginning and not the document beginning.
How can i find out what offset an ITextRegion has to the underlying
|Re: Extending XML Syntax Highlighting [message #201459 is a reply to message #201405]
||Sun, 07 October 2007 16:48
|| Nitin Dahyabhai
Registered: July 2009
> The problem is that region.getStart(), region.getLength() are relative to
> the regions beginning and not the document beginning.
> How can i find out what offset an ITextRegion has to the underlying
Knowledge of the underlying document as well as absolute offset
information aren't kept in most of the ITextRegions--memory for
those references and numbers can add up fast. You can get the
absolute offsets from the
ITextRegionCollection/IStructuredDocumentRegion containing the text
region. The start and length values in the text region are relative
to the region collection or document region that contains them.
Structured Source Editing
Eclipse WTP, IBM
Powered by FUDForum
. Page generated in 0.02033 seconds