Pregunta

I am adding a plugin to my application to extend functionality of an existing plugin (for advanced reporting). The application already has a preference page in place. I need to "refresh" the reporting of the new plugin when the user changes the preferences for the existing plugin.

My thought is to "extend" the preference page of the existing plugin to add a checkbox to "propagate changes to open reports" and cause a refresh. This refresh is only applicable when the new plugin is in use (it is optional and the existing plugin can be used standalone). How can I extend the preference page to add the checkbox and load THAT preference page instead of the existing one when the new plugin is loaded?

This question also applies to extend views and editors, but I'm unsure how to extend (in the Java definition) GUI components from different plugins. I can only see how to contribute new interfaces.

¿Fue útil?

Solución

You can use an OSGi fragment for this. In a nutshell, a fragment is added to the host bundle (i.e. the one which "hosts" the fragment) and it can overwrite anything in the host bundle. If you think in terms of a classpath, then the fragment always comes first and then the host bundle.

That means you can take the existing preferences page, copy this single source file into a fragment, change it as needed and then compile it into a fragment.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top