Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Extending XML Syntax Highlighting
Extending XML Syntax Highlighting [message #201405] Sun, 07 October 2007 11:38 Go to next message
Eclipse UserFriend
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 20:48 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4490
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 Web Tools Platform
Previous Topic:Question about WTP 2.0.1 support for JSP EL
Next Topic:Extending SSE Editor based on JSP
Goto Forum:
  


Current Time: Sat Sep 21 12:36:29 GMT 2024

Powered by FUDForum. Page generated in 0.02988 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top