从命令处理程序更新视图
我从菜单中打开一个文件对话框,用户可以在其中选择文件。 FileDialog 在execute() 中从菜单命令的处理程序类调用。
根据用户选择的文件,我想更新一个视图,为此(我相信)我需要与 createPartControl() 中传递给视图的相同 Composite 元素。
是否可以从命令处理程序访问它,或者通过 ISourceProviderListener 或 PropertyChangeListener 之类的东西触发视图更新会更好吗?
谢谢。
I have a file dialogue opening from the menu where a user can select a file. The FileDialog is called from the menu command's handler class in execute().
Based on the file the user selected, I would like to update a view, for which (I believe) I'd need the same Composite element that's passed to the view in createPartControl().
Is it possible to get access to it from the command handler, or would it be better to trigger the view updating via something like ISourceProviderListener or PropertyChangeListener?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的:
最好首先更新视图正在显示的数据(MVC 中的模型),并且数据的更改应该触发视图刷新。在不了解所有细节的情况下,很难说哪个听众更好。
Yes, it's possible:
It would be better to first update the data that your view is displaying (the model in MVC) and the change in data should trigger view refresh. It's hard to say which listener is better without knowing all the details.