Metadata in TreeViewer [message #1087593] |
Thu, 15 August 2013 18:05  |
Eclipse User |
|
|
|
I have been trying to figure this out for a couple of days:
I have a TreeViewer with nodes that extend:
public abstract class TreeNode implements ITreeNode, IAdaptable
{
...
public ITreeNode getParent() {
return fParent;
}
...
}
I would like to store a unique database table key for each item in the tree (as well as the item name) and retrieve the key on RMB selection of the item so that I can show a popup with details of the selected item. The names could be duplicates so a unique key is required.
As I want to get the key on RMB click (not doubleclick where I could use IStructuredSelection) I can't access the selected node to check against node model objects, RMB is SWT world.
Also as TreeLabelProvider does not have a getData() method there is no way to retrieve data as per SWT treeItem.
As far as I can tell my options are:
1) Use SWT Tree and TreeItem instead of TreeViewer and build the tree manually and use .setData(uniqueKey) of the TreeItems.
2) Use IPropertySource from eclipse 3.x but I need to research more to see If I would be able to link up a RMB click to SelectionService. Also I would prefer to keep the application pure e4.
3) Extend jface.viewers.StructureViewer? to implement a right mouse button listener - which might be fun but seems a bit more than I can chew at the moment.
Has anyone else come accross this issue and found a solution using TreeViewer?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05606 seconds