[英]Eclipse PDE - ViewPart onExit command?
I have an issue with a view that showed a Tree that made a lot of connections to a SQLite database, and want to make just one instead. 我有一个问题,一个视图显示一个树与SQLite数据库建立了很多连接,并希望只改为一个。 I therefore need to use something that controls its lifecycle, so that the connection would be opened and closed together with the view.
因此,我需要使用控制其生命周期的东西,以便连接与视图一起打开和关闭。
So I looked here and I looked directly at the methods that it had, but can't find nothing with exit . 所以我看了看这里 ,直接看了它的方法,但是没有找到退出的东西 。 I did have the constructor I could overwrite instead of an init method...
我确实有我可以覆盖的构造函数而不是init方法...
PS Am I thinking about this wrong? PS我在想这个错吗? Should the connection be opened and closed differently?
连接是否应以不同方式打开和关闭?
Upon further inspection I've spotted in the exact link I shared this: 经过进一步检查,我发现了我分享的确切链接 :
Subclasses may extend or reimplement the following methods as required:
子类可以根据需要扩展或重新实现以下方法:
- setInitializationData - extend to provide additional initialization when view extension is instantiated
setInitializationData - 在实例化视图扩展时进行扩展以提供其他初始化
- init(IWorkbenchPartSite) - extend to provide additional initialization when view is assigned its site
init(IWorkbenchPartSite) - 在为视图分配其站点时进行扩展以提供额外的初始化
- dispose - extend to provide additional cleanup
处置 - 扩展以提供额外的清理
- getAdapter - reimplement to make their view adaptable
getAdapter - 重新实现以使其视图适应性强
So yeah: dispose() is the answer. 所以是的: dispose()就是答案。 I'm still getting used to the naming conventions here.
我仍然习惯于这里的命名约定。
Anyway, I hope this is useful to somebody except me :) 无论如何,我希望这对除了我以外的人有用:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.