Community
Participate
Working Groups
This patch provides a new extension point to register task activation listeners. This enables plugins to register their listeners without the need to start the plugin itself, which would be necessary with programmatic registering.
Created attachment 198316 [details] Patch for extension point
Created attachment 198317 [details] mylyn/context/zip
Thanks for the patch! The proposed change looks good. I have a few minor suggestions for improvement: * Construct listeners lazily, i.e. on the first event. * Iterate over all IConfigurationElement objects. Would you be able to iterate on this?
I'll look into this.
Yep, looks good. Minor comments from my side: * I'd also add a test for this, should not be too hard to provide a simple mock extension in the tests bundle and ensure it is called. * Extracting @ITasksCoreConstants.ID_PLUGIN + ".taskActivationListeners"@ should also go into a constant
(In reply to comment #3) > * Iterate over all IConfigurationElement objects. One question here: Is there a specific reason to iterate over all objects? Wouldn't that have a lower performance? Or doesn't the implementation of getConfigurationElementsFor guarantee, that i get really all configuration elements for an extension point?
> One question here: Is there a specific reason to iterate over all objects? Equinox gives no guarantee about the order extensions are listed. Only adding the first one may work in your config but as soon as another extension comes along, it may break yours. Thus we should read all extensions and add all available listeners. I don't see a performance degradation in this case once you do it lazily.
Created attachment 200857 [details] Added tests, iterate over all configuration elements Tests added, iterate over all configuration elements, extracted string to constant, initialize listeners on first task activation or deactivation.
Thanks a lot for the updated patch! I have applied it with a few minor modifications: * I renamed the schema attribute from "listenerClass" to "class" * I guarded the creation of extensions with a catch Throwable. Not pretty but some extensions have the bad habit of throwing LinkageErrors which would propagate otherwise. * Moved the constant to TaskActivityManager * The test stub is now an inner class and test cases are separate