简体   繁体   中英

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. 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...

PS Am I thinking about this wrong? 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
  • init(IWorkbenchPartSite) - extend to provide additional initialization when view is assigned its site
  • dispose - extend to provide additional cleanup
  • getAdapter - reimplement to make their view adaptable

So yeah: dispose() is the answer. I'm still getting used to the naming conventions here.

Anyway, I hope this is useful to somebody except me :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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