Allow platform:/ URIs in templates extension include element#4029
Allow platform:/ URIs in templates extension include element#4029tobiasmelcher wants to merge 1 commit into
Conversation
The 'file' and 'translations' attributes of the <include> element in the org.eclipse.ui.editors.templates extension point previously only accepted plug-in local file paths, resolved relative to the contributing bundle via FileLocator.find(Bundle, IPath, Map). This change extends ContributionTemplateStore.readIncludedTemplates to also accept platform:/ URIs (e.g. platform:/plugin/<bundle-id>/<path>), allowing a contributor to reference template files that live in another plug-in. Bundle-relative paths continue to work unchanged; platform:/ URIs are resolved via FileLocator.find(URL).
|
In our product ABAP Development Tools for Eclipse we want to share and reuse code templates across multiple components. To enable this, the template definitions need to live in a non-UI (headless) plug-in so that non-UI consumers can use them as well. The org.eclipse.ui.editors.templates extension point is — correctly — defined in the UI layer, and the contributing plugin.xml therefore has to sit in a UI plug-in. Today the attribute is resolved only relative to the contributing bundle, which forces the actual template XML file to live in that same UI plug-in. By allowing platform:/ URIs in the file (and translations) attribute, the UI plug-in can keep the extension contribution but reference the template file from the headless plug-in where it really belongs — e.g.:
This is a small, backwards-compatible extension: plain bundle-relative paths continue to work unchanged. |
merks
left a comment
There was a problem hiding this comment.
Seems like a simple and reasonable change.
The 'file' and 'translations' attributes of the element in the org.eclipse.ui.editors.templates extension point previously only accepted plug-in local file paths, resolved relative to the contributing bundle via FileLocator.find(Bundle, IPath, Map).
This change extends ContributionTemplateStore.readIncludedTemplates to also accept platform:/ URIs (e.g. platform:/plugin//), allowing a contributor to reference template files that live in another plug-in. Bundle-relative paths continue to work unchanged; platform:/ URIs are resolved via FileLocator.find(URL).