Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » StyledCellLabelProvider ignores fontStyle
StyledCellLabelProvider ignores fontStyle [message #532313] Fri, 07 May 2010 22:47 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
I can use a StyleRange to create a bold, red text field:

StyledText text = new StyledText(composite, SWT.NONE);
text.setText("bla bla");
StyleRange style = new StyleRange();
style.fontStyle = SWT.BOLD;
style.foreground = getSystemColor(SWT.COLOR_RED);
style.length = text.getText().length();
text.setStyleRanges(new StyleRange[] { style });


But using the same StyleRange in a StyledCellLabelProvider results in a cell that is red, but not bold!

class TestLabelProvider extends StyledCellLabelProvider {
    @Override
    public void update(ViewerCell cell) {
        cell.setText("bla bla");
        StyleRange style = new StyleRange();
        style.fontStyle = SWT.BOLD;
        style.foreground = getSystemColor(SWT.COLOR_RED);
        style.length = cell.getText().length();
        cell.setStyleRanges(new StyleRange[] { style });
    }
}


On the other hand setting style.font to a bold red font works.

Bug?
Re: StyledCellLabelProvider ignores fontStyle [message #532816 is a reply to message #532313] Tue, 11 May 2010 09:52 Go to previous messageGo to next message
Praveen  is currently offline Praveen Friend
Messages: 86
Registered: July 2009
Member
Since the problem is related to StyledCellLabelProvider rather than
StyledRange, the best answer is available @ eclipse.platform.jface
newsgroup. Please cross-post this question at that newsgroup.

PS: I have verified that setting fontStyle to BOLD works fine with a
simple StyledText editor (using snippet163). So, the problem is tend to
be with StyledCellLabelProvider.
Re: StyledCellLabelProvider ignores fontStyle [message #532817 is a reply to message #532816] Tue, 11 May 2010 09:56 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What version of Eclipse? We added font-support in 3.5. See this bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=228397

Am 11.05.10 11:52, schrieb Praveen:
> Since the problem is related to StyledCellLabelProvider rather than
> StyledRange, the best answer is available @ eclipse.platform.jface
> newsgroup. Please cross-post this question at that newsgroup.
>
> PS: I have verified that setting fontStyle to BOLD works fine with a
> simple StyledText editor (using snippet163). So, the problem is tend to
> be with StyledCellLabelProvider.
Re: StyledCellLabelProvider ignores fontStyle [message #532960 is a reply to message #532817] Tue, 11 May 2010 17:06 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Tom Schindl wrote on Tue, 11 May 2010 05:56
What version of Eclipse? We added font-support in 3.5. See this bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=228397


Eclipse 3.5 (20100218-1602). Can set style.font, but style.fontStyle is ignored.

[Updated on: Tue, 11 May 2010 17:06]

Report message to a moderator

Re: StyledCellLabelProvider ignores fontStyle [message #533046 is a reply to message #532313] Wed, 12 May 2010 06:40 Go to previous message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=131988
Previous Topic:Scroll within a tableItem
Next Topic:UI layout suggestions
Goto Forum:
  


Current Time: Fri Mar 29 08:33:18 GMT 2024

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

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

Back to the top