Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFForms] Render and RenderTester in different Bundles
[EMFForms] Render and RenderTester in different Bundles [message #1555051] Fri, 09 January 2015 10:29 Go to next message
Eclipse UserFriend
Hi,

I tried to setup render and rendertester in different bundles, to archive project specific rendertesters.

In my case it's not working because the render needs the corresponding rendertester in the same bundle, same for rendertester.

I took a look to SWTRenderFactoryImpl.readBundle and saw that this is the actual behavior.
loadClass(configurationElement.getContributor().getName()...

Therefore I patched the renders.exsd to add a optional bundle name as string. Maybe there's a nicer way to archive that instead of a string. But this did the trick. Here's the modified readRender
	private void readRenderer() {
		final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(RENDER_EXTENSION);
		for (final IExtension extension : extensionPoint.getExtensions()) {

			for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {
				try {
// PATCH START
					String bundleName = configurationElement.getContributor().getName();
					if (configurationElement.getAttribute("bundle") != null
							&& !configurationElement.getAttribute("bundle").isEmpty()
							&& Platform.getBundle(configurationElement.getAttribute("bundle")) != null) {
						bundleName = configurationElement.getAttribute("bundle");
					}
					//ORIG:final Class<AbstractSWTRenderer<VElement>> renderer = loadClass(configurationElement.getContributor().getName(), configurationElement.getAttribute("renderer")); //$NON-NLS-1$
					final Class<AbstractSWTRenderer<VElement>> renderer = loadClass(bundleName, configurationElement.getAttribute("renderer")); //$NON-NLS-1$
// PATCH END

					final Set<ECPRendererTester> tester = new LinkedHashSet<ECPRendererTester>();
					for (final IConfigurationElement testerExtension : configurationElement.getChildren()) {
						if (TEST_DYNAMIC.equals(testerExtension.getName())) {
							tester.add((ECPRendererTester) testerExtension.createExecutableExtension(RENDERER_TESTER));
						} else if (TEST_STATIC.equals(testerExtension.getName())) {

							final int priority = Integer.parseInt(testerExtension.getAttribute(TESTER_PRIORITY));

							final String vElement = testerExtension.getAttribute(TESTER_VELEMENT);
							final Class<? extends VElement> supportedEObject = loadClass(testerExtension.getContributor().getName(), vElement);

							tester.add(new ECPStaticRendererTester(priority, supportedEObject));
						}
					}

					rendererDescriptors.add(new ECPRendererDescription(renderer, tester));
				} catch (final CoreException ex) {
					ex.printStackTrace();
				} catch (final ClassNotFoundException e) {
					e.printStackTrace();
				} catch (final InvalidRegistryObjectException e) {
					e.printStackTrace();
				}
			}
		}
	}


Or is there a different way to archive that? When exactly do i use additionalRenders extension point?

Cheers
Philippe

[Updated on: Fri, 09 January 2015 10:29] by Moderator

Re: [EMFForms] [message #1556494 is a reply to message #1555051] Sat, 10 January 2015 05:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I see your issue. I acually wonder, why "createExecutableExtension" is
not used here. This would IMHO solve the problem.
Could you kindly report a BR for this and add me to CC?

Best regards

Jonas

Am 09.01.2015 um 16:29 schrieb Phil Wim:
> Hi,
>
> I tried to setup render and rendertester in different bundles, to
> archive project specific rendertesters.
> In my case it's not working because the render needs the corresponding
> rendertester in the same bundle, same for rendertester.
> I took a look to SWTRenderFactoryImpl.readBundle and saw that this is
> the actual behavior.
> loadClass(configurationElement.getContributor().getName()...
> Therefore I patched the renders.exsd to add a optional bundle name as
> string. Maybe there's a nicer way to archive that instead of a string.
> But this did the trick. Here's the modified readRender
> private void readRenderer() {
> final IExtensionPoint extensionPoint =
> Platform.getExtensionRegistry().getExtensionPoint(RENDER_EXTENSION);
> for (final IExtension extension : extensionPoint.getExtensions()) {
>
> for (final IConfigurationElement configurationElement :
> extension.getConfigurationElements()) {
> try {
> // PATCH START
> String bundleName =
> configurationElement.getContributor().getName();
> if (configurationElement.getAttribute("bundle") != null
> &&
> !configurationElement.getAttribute("bundle").isEmpty()
> &&
> Platform.getBundle(configurationElement.getAttribute("bundle")) != null) {
> bundleName =
> configurationElement.getAttribute("bundle");
> }
> //ORIG:final Class<AbstractSWTRenderer<VElement>>
> renderer = loadClass(configurationElement.getContributor().getName(),
> configurationElement.getAttribute("renderer")); //$NON-NLS-1$
> final Class<AbstractSWTRenderer<VElement>> renderer
> = loadClass(bundleName, configurationElement.getAttribute("renderer"));
> //$NON-NLS-1$
> // PATCH END
>
> final Set<ECPRendererTester> tester = new
> LinkedHashSet<ECPRendererTester>();
> for (final IConfigurationElement testerExtension :
> configurationElement.getChildren()) {
> if
> (TEST_DYNAMIC.equals(testerExtension.getName())) {
> tester.add((ECPRendererTester)
> testerExtension.createExecutableExtension(RENDERER_TESTER));
> } else if
> (TEST_STATIC.equals(testerExtension.getName())) {
>
> final int priority =
> Integer.parseInt(testerExtension.getAttribute(TESTER_PRIORITY));
>
> final String vElement =
> testerExtension.getAttribute(TESTER_VELEMENT);
> final Class<? extends VElement>
> supportedEObject = loadClass(testerExtension.getContributor().getName(),
> vElement);
>
> tester.add(new
> ECPStaticRendererTester(priority, supportedEObject));
> }
> }
>
> rendererDescriptors.add(new
> ECPRendererDescription(renderer, tester));
> } catch (final CoreException ex) {
> ex.printStackTrace();
> } catch (final ClassNotFoundException e) {
> e.printStackTrace();
> } catch (final InvalidRegistryObjectException e) {
> e.printStackTrace();
> }
> }
> }
> }
>
> Or is there a different way to archive that? When exactly do i use
> additionalRenders extension point?
>
> Cheers
> Philippe


--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMFForms] Render and RenderTester in different Bundles [message #1559967 is a reply to message #1556494] Mon, 12 January 2015 05:02 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jonas,

reported it here and added you to cc https://bugs.eclipse.org/bugs/show_bug.cgi?id=457220

When exactly should i use "additional renders" extension point?

I read somewhere that you have multiple commercial renders available? If so could you provide a list?

Thanks
Phil
Re: [EMFForms] Render and RenderTester in different Bundles [message #1561891 is a reply to message #1559967] Tue, 13 January 2015 06:09 Go to previous message
Eclipse UserFriend
Hi,

thanks! "Additional Renderers" is a very specific concept to replace
renderers for a certain GridCell. It is not really officially supported.
For your use cases, I believe you will just need the regular renderer
extension, not the "additional renderer".
About the comercial renderers: This is refering to renderers, which we
implemented for customer projects and which are not open source. We
currently do not sell licenses for any renderers. We do provide support
and/or development ressources to adapt existing renderers or even
develop new one. If you are interested in learning more about that,
please contact me. (https://www.eclipse.org/ecp/emfforms/communication.html)

Best regards

Jonas

Am 12.01.2015 um 11:02 schrieb Phil Wim:
> Hi Jonas,
>
> reported it here and added you to cc
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=457220
>
> When exactly should i use "additional renders" extension point?
>
> I read somewhere that you have multiple commercial renders available? If
> so could you provide a list?
>
> Thanks
> Phil


--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:[Texo] Problems unsetting attributes
Next Topic:[EMFForms] Additional model-specific services
Goto Forum:
  


Current Time: Wed Jul 23 09:48:08 EDT 2025

Powered by FUDForum. Page generated in 0.06061 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top