Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problem using multiple StyleRange for my StyledText
Problem using multiple StyleRange for my StyledText [message #981617] Mon, 12 November 2012 15:06 Go to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 83
Registered: July 2009
Member
I use a StyledText instance as an editor to create command files.
When keywords are recognised while the user is typing, I colorise them using a StyleRange instance.
This process works perfectly until now.

Last week, I have been asked to add line numbers in my editor (i.e. in the StyledText).
I found a way to do it using a LineStyleListener :

    styledText.addLineStyleListener(new LineStyleListener() {
        public void lineGetStyle(LineStyleEvent e) {
	    e.bulletIndex = styledText.getLineAtOffset(e.lineOffset);

	    StyleRange style = new StyleRange();
	    style.metrics = new GlyphMetrics(0, 0, Integer.toString(styledText.getLineCount() + 1).length() * 12);

	    e.bullet = new Bullet(ST.BULLET_NUMBER, style);
	}
    });


My problem now is that the colorisation does not work any more.
How can I do ?
Thanks
Helene
Re: Problem using multiple StyleRange for my StyledText [message #985658 is a reply to message #981617] Thu, 15 November 2012 15:59 Go to previous message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 83
Registered: July 2009
Member
I solved my problem by moving all the code concerning style range stuff in the lineGetStyle method of the LineStyleListener.

Previous Topic:Drawing Artifacts on UI space
Next Topic:Can I embed SWT Widgets into webpage
Goto Forum:
  


Current Time: Thu Nov 27 18:56:09 GMT 2014

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

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