JFace ContentProposalAdapter 在无效位置显示弹出窗口
我在表中的编辑器上使用 ContentProposalAdapter:
String[] newProposals = getAllProposals();
SimpleContentProposalProvider scp = new SimpleContentProposalProvider( newProposals );
adapter = new ContentProposalAdapter(editor, new TextContentAdapter(), scp,null,null);
adapter.setPopupSize(new Point(100, 200));
编辑器是这样创建的文本:
final Text editor = new Text(cursor, SWT.NONE)
光标是表光标;
UI 具有以下结构:
shell
main-view
table
editor
现在,当显示内容辅助弹出窗口时,它位于 shell 窗口的左侧,而不是表中的编辑器下方。
我如何修复它的位置?
I use ContentProposalAdapter on editor in table:
String[] newProposals = getAllProposals();
SimpleContentProposalProvider scp = new SimpleContentProposalProvider( newProposals );
adapter = new ContentProposalAdapter(editor, new TextContentAdapter(), scp,null,null);
adapter.setPopupSize(new Point(100, 200));
editor is a text created like this:
final Text editor = new Text(cursor, SWT.NONE)
cursor is a table cursor;
The UI has following structure:
shell
main-view
table
editor
Now when popup is displayed for content assist it's located at the left of the shell window instead of under editor in table.
How do I fix it's location?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是每次输入更改时创建的内容提案适配器都会导致意外行为。
正确的方法是仅创建一次内容提案适配器实例并附加到文本字段。
The problem is that content proposal adapter created each time on input changed this resulted into unexpected behavior.
The correct way is to create content proposal adapter instance only once and attach to the text field.