Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何选择一个节点并开始重命名SWT Tree?鼠标单击节点后,只有我能够使用F2. 我的用例是 - 在添加一个新的树节点后,我应该能够立即按下F2并开始重命名。但是仅在树上设置焦点和选择并不会显式选择节点。还有其他代码吗?
SWT
Tree
treeViewer.setSelection(new StructuredSelection(newNode), true); treeViewer.getTree().setFocus();
这似乎不起作用。
究竟是newNode什么?它应该是来自您的内容提供商的元素。
newNode
此外,很多人一直在为SWT/JFace工具包的这种限制而烦恼。请参阅此错误和此问题。