TreeViewer, TreeEditor & HyperLink [message #913490] |
Sat, 15 September 2012 19:52 |
Aravindhan Annamalai Messages: 89 Registered: July 2009 Location: Chennai |
Member |
|
|
Hi,
I am using treeviewer and have added hyperlink for my second column using the snippet below,
private void createLinks(Tree tree){
TreeItem[] items = tree.getItems();
for(TreeItem item : items){
TreeEditor treeEditor = new TreeEditor(tree);
Hyperlink link = new Hyperlink(tree.getColumn(2).getParent(), SWT.FILL | SWT.READ_ONLY);
Color blue = link.getDisplay().getSystemColor(SWT.COLOR_BLUE);
link.setText(value);
link.setToolTipText(value);
Cursor cursor = new Cursor(link.getDisplay(), SWT.CURSOR_HAND);
link.setForeground(blue);
link.setUnderlined(true);
link.setCursor(cursor);
link.setBackground(new Color(link.getDisplay(), new RGB(255, 255, 255)));
treeEditor.grabHorizontal = true;
treeEditor.setEditor(link, item, 2);
}
}
The hyperlinks are created fine for the second column,
For ex: for the two inputs to the tree viewer the display is as below,
Column1 Column2
---------------------
Col1Data Col2Link
------- -> link
Col2Data Col2Llink
-------
The next time when I update my treeviewer input and now it is one, the display is as below,
Column1 Column2
---------------------
Col1Data Col2Link
------- -> link
Col2Link
------- -> link
The second column displays the link text in the second column for the second row as well. I verified my content provider which returns only one data.
Commenting out createLinks method.. resolves the issue.
But, as i need the hyperlink, how to fix this?
[Updated on: Sat, 15 September 2012 19:55] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02235 seconds