FAQ How do I make my plug-in dynamic enabled?
Most of the effort required to make a plug-in dynamic enabled can be summed up as doing what you should be doing anyway as part of good programming practice. Most importantly, to be dynamic enabled, your plug-in has to properly clean up after itself in the Plugin shutdown method. You need to keep in mind the following checklist for your plug-ins shutdown method.
If you have added listeners to notification services in other plug-ins, you need to remove them. This generally excludes any listeners on SWT controls created by your plug-in. When those controls are disposed of, your listeners are garbage collected anyway. </li>
If you have allocated SWT resources, such as images, fonts, or colors, they need to be disposed of. </li>
Any open file handles, sockets, or pipes must be closed. </li>
Any metadata stored by other plug-ins that may contain references to your classes needs to be removed. For example, session properties stored on resources in the workspace need to be removed. </li>
Other services that require explicit uninstall need to be cleaned up. For example, the runtime plug-ins adapter manager requires you to unregister any adapter factories that you have manually registered. </li>
If your plug-in has forked background threads or jobs, they must be canceled and joined to make sure that they finish before your plug-in shuts down.</li>
Prior to Eclipse 3.0, the consequences of failing to clean up properly were not as apparent as plug-ins were shut down only when the VM was about to exit. In a potentially dynamic world, the consequence of not being tidy is that your plug-in cannot be dynamic enabled.
This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.