Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vertical align 2 jface TreeViewers to specific element.
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent arg0) {
- TreeViewer mirrorTree = (treeViewer == treeVwrSource ? treeVwrTarget : treeVwrSource);
- // find position of selected element (element x) in treeViewer
- // set position of element x in mirrorTree, it is already selected.
- }
- });
- Tree tree1 = ...;
- Tree tree2 = ...;
- int topIndex = tree1.indexOf(tree1.getTopItem());
- tree2.setTopItem(tree2.getItem(topIndex));
- viewer.setSelection(otherViewer.getSelection)
Advertisement
Add Comment
Please, Sign In to add comment