Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "E4/EAS/Life Cycle"
Line 1: | Line 1: | ||
Components (UI or non-UI) very often manage resources that need to be initialized when the component is instantiated, or disposed when the component itself is disposed. This is a long-winded way of saying that a container should call a method after a component is instantiated and ready to go, and call another method just before disposing the component. | Components (UI or non-UI) very often manage resources that need to be initialized when the component is instantiated, or disposed when the component itself is disposed. This is a long-winded way of saying that a container should call a method after a component is instantiated and ready to go, and call another method just before disposing the component. | ||
+ | |||
+ | ==Eclipse 3.x API== | ||
+ | In Eclipse 3.x, there is the contract for construction and disposal is usually defined via abstract methods or interfaces. | ||
==e4 (Java)== | ==e4 (Java)== |
Revision as of 15:26, 23 October 2009
Components (UI or non-UI) very often manage resources that need to be initialized when the component is instantiated, or disposed when the component itself is disposed. This is a long-winded way of saying that a container should call a method after a component is instantiated and ready to go, and call another method just before disposing the component.
Eclipse 3.x API
In Eclipse 3.x, there is the contract for construction and disposal is usually defined via abstract methods or interfaces.
e4 (Java)
Use JSR-250 annotations @PostConstruct and @PreDestroy to mark methods that should be called by the framework.
Alternatively, if a component implements IDisposable, the framework should call IDisposable.dispose().
JavaScript
Initialization is often handled by registering an "on load" handler from the script that is evaluated as part of instantiating the component. Not sure if "on unload" is widely used. It would make sense to list functions to call on load and unload in the component metadata.