简体   繁体   English

Eclipse插件-开关文件的侦听器

[英]Eclipse Plugin - Listener for switch file

I am creating currently an eclipse-plugin that has both an editor and a view, both shell display the same data from an EMF Model... So now my wish is that everytime you change the opened file in the editor, the ViewPart refreshes, too... I have already in the init() function of my editor a call to a method of my view that refresh() its viewer... Problem is just that init() is only called when you open the file. 目前,我正在创建一个同时具有编辑器和视图的eclipse插件,这两个Shell都显示来自EMF模型的相同数据。因此,现在我的愿望是每次您在编辑器中更改打开的文件时,ViewPart都会刷新,我也已经在编辑器的init()函数中调用了视图的方法,该方法调用了refresh()它的查看器...问题只是init()仅在打开文件时被调用。 But when you have 2 or more files opened at the same time and you switch between them, init() is not called, so my view doesnt refresh... Anybody a solution for that? 但是,当您同时打开2个或更多文件并在它们之间切换时,不会调用init(),因此我的视图不会刷新...有人为此提供解决方案吗?

Best regards, Anton 最好的问候,安东

Just override the setFocus() method of your editor. 只需重写编辑器的setFocus()方法即可。 It will be called each time a switch to an opened file occurs. 每次切换到打开的文件时都会调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM