我TreeViewer
在一个页面上有两个对象(2 列,TreeViewer
每列一个),我想在滚动或选择另一个对象时垂直对齐一棵树。
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Tree;
我认为解决方案应该类似于
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.
}
});
有什么建议吗?