Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Extending XML Syntax Highlighting
Extending XML Syntax Highlighting [message #201405] Sun, 07 October 2007 07:38 Go to next message
Eclipse User
Originally posted by: uh5d.rz.uni-karlsruhe.de

I want to recolor a special tag-name with a defined color in my xml
document.
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
IStructuredDocument?

Regards

A.Gallus
Re: Extending XML Syntax Highlighting [message #201459 is a reply to message #201405] Sun, 07 October 2007 16:48 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2253
Registered: July 2009
Senior Member
A.G. wrote:
> 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
> IStructuredDocument?

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.

--
Nitin Dahyabhai
Structured Source Editing


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Question about WTP 2.0.1 support for JSP EL
Next Topic:Extending SSE Editor based on JSP
Goto Forum:
  


Current Time: Sun Aug 31 04:44:07 EDT 2014

Powered by FUDForum. Page generated in 0.02033 seconds