How to draw hyperlink in TreeViewer column? [message #655622] |
Tue, 22 February 2011 01:16 |
David Whiteman Messages: 5 Registered: July 2009 Location: Research Triangle Park, N... |
Junior Member |
|
|
I'm trying to use a StyledString to draw text as if it were a hyperlink. I am doing this in the update() method of the column's label provider. It seems that simple methods on the ViewerCell such as setText(), setForeground(), and setFont() work as expected, but when I try to use setStyleRanges(), there is no effect.
Here's an excerpt:
Styler style = new Styler()
{
public void applyStyles(TextStyle textStyle)
{
textStyle.font = boldFont;
textStyle.foreground = display.getSystemColor(SWT.COLOR_BLUE);
textStyle.underline = true;
}
};
StyledString styledString = new StyledString(cell.getText(), style);
cell.setStyleRanges(styledString.getStyleRanges());
cell.setText(styledString.getString());
The style ranges appear to have no effect. The font, foreground, and underline settings are ignored, unlike when I call setFont() or setForeground() on the cell.
I also tried creating a StyleRange directly and set the characteristics that way, but still no luck in changing the cell's appearance.
Is style ranges simply unsupported by the TreeViewer?
I'm I going about this in too hard of a way? I just want to have hyperlink capability in one of the columns of my tree viewer.
Thanks in advance,
David
---
David Whiteman
Cisco Systems
[Updated on: Tue, 22 February 2011 01:19] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03617 seconds