Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Select renderer in view model(Support selection rules for renderers)
Select renderer in view model [message #1775987] Wed, 08 November 2017 21:39 Go to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
I've made a new SWT renderer for editing boolean attributes in a dropdown with false/no and true/yes options. This provides better usability in some cases.

To use it, you must create a service that gives it priority above the default one. I find this cumbersome, it would be better if you could add a "renderer selection rule" to the control element of the view model, so you avoid the code. Something along the following:
- The renderer implementation is registered using an extension point with, and the datatype it supports is indicated, e.g. EBoolean in my case, as well as a "style" key for selecting it, e.g. "dropDown"
- The control element of the view model has a style key attribute, so you can indicate that you prefer a specific renderer if it is supported by the runtime platform
- Alternatively a control element could support a renderer child element that can both provide the style key, as well as configuration options, e.g. in my whether to use false/true or yes/no labels.
- Having an extensible renderer model element, that can be used for selecting and configuring renderers, will increase the power considerably. So when you create a renderer, you may also add an Ecore model with a RendererConfig subclass with features that allow the renderer to be configured. The instance of this RendererConfig is provided when activating the actual renderer.

I understand there's a balance between simplicity and complexity, but by supporting a renderer sub-element, you don't reduce the simplicity, but increase the power.
Re: Select renderer in view model [message #1778470 is a reply to message #1775987] Thu, 14 December 2017 15:20 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 109
Registered: September 2016
Senior Member
Hi Hallvard,

again sorry for the late answer.

About your proposals:
1. A declarative tester for renderers (e.g. by attribute type)
We had this in the past, but it turned off to be less flexible than required. We had to add more and more criteria (attribute type, attribute name, velement type). Therefore, we decided to switch to code completly. However, at least for the simple cases, we could add some declaritive ways again. If you want to do so, please open a BR

2. Style Properties
Are you aware of the template model? This is pretty much like CSS for EMF Forms. It allows you to specify style attributes based on selectors. E.g. you could sepcify "dropDownBoolean=true" and then the rendere or the tester would react accordingly. The same is possible based on criteria, e.g. based on the concrete attribute

3. Renderer Hints in the view model
From time to time we add options in the view model as hints for the renderer. We only do this if they are really generic, e.g. "collapsible" for Group. If you have proposals for extending the view model, please report them as BRs. Additionally you can add key/value pairs to the view model in case you wan to add some custom information there.

Please let me know, if you have any follow up questions.

Best regards,


Jonas Helming
Get professional Eclipse developer support:
Previous Topic:Toolbar actions for GenericEditor
Next Topic:Example implementation of ECPModelElementOpener
Goto Forum:

Current Time: Tue May 24 20:52:44 GMT 2022

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

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

Back to the top