Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] New custom controls
[EMF Forms] New custom controls [message #1799590] Mon, 10 December 2018 17:07 Go to next message
sri pamarti is currently offline sri pamartiFriend
Messages: 19
Registered: August 2015
Junior Member
I'm trying to create a new custom control for child objects. I could only find two examples PGroupRenderer and Custom Emailfield renderer.

Which baseclass should I extend if I want to render my own control?

I've used the following in the view model definition for "Custom Control"

Domain Model Reference -> Linked Domain model EFeature for the children

Bundle Name -> bundle name where the RendererService resides
Class Name -> FQN Renderer service class

I tried to emulate the PGroupControl. However I'm getting the following exception
I'm using the latest version 1.18 with eclipse Photon

Custom Control class
public class RolePermissionsControl extends ContainerSWTRenderer<VControl> {

	// private ReportService reportService;

	public RolePermissionsControl(VControl vElement, ViewModelContext viewContext, ReportService reportService,
			EMFFormsRendererFactory factory, EMFFormsDatabinding emfFormsDatabinding) {
		super(vElement, viewContext, reportService, factory, emfFormsDatabinding);

	private SWTGridDescription rendererGridDescription;
	private CheckboxTreeViewer treeViewer = null;

	public SWTGridDescription getGridDescription(SWTGridDescription gridDescription) {
		if (rendererGridDescription == null) {
			rendererGridDescription = GridDescriptionFactory.INSTANCE.createSimpleGrid(1, 1, this);
			final SWTGridCell swtGridCell = rendererGridDescription.getGrid().get(0);
		return rendererGridDescription;

	public Control renderControl(SWTGridCell cell, Composite composite)
			throws NoRendererFoundException, NoPropertyDescriptorFoundExeption {
		Composite parent = new Composite(composite, SWT.NONE);
		parent.setLayout(new FillLayout(SWT.VERTICAL));[/size]

Renderer Service
public class RolePermissionsRendererService implements EMFFormsDIRendererService<VControl> {

	private EMFFormsDatabinding databindingService;
	private ReportService reportService;

	 * Called by the initializer to set the EMFFormsDatabinding.
	 * @param databindingService The EMFFormsDatabinding
	protected void setEMFFormsDatabinding(EMFFormsDatabinding databindingService) {
		this.databindingService = databindingService;

	 * Called by the initializer to set the ReportService.
	 * @param reportService The ReportService
	protected void setReportService(ReportService reportService) {
		this.reportService = reportService;

	public double isApplicable(VElement vElement, ViewModelContext viewModelContext) {
		if (!VCustomControl.class.isInstance(vElement)) {
		return 10;

	public Class<? extends AbstractSWTRenderer<VControl>> getRendererClass() {
		// TODO Auto-generated method stub
		return RolePermissionsControl.class;

org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in mypackage.ui.controls.rolepermissions.RolePermissionsControl
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(
	at org.eclipse.e4.core.internal.di.InjectorImpl.make(
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(
	at org.eclipse.emfforms.spi.swt.core.di.EMFFormsDIRendererFactory.getRendererInstance(
	at org.eclipse.emfforms.internal.swt.core.EMFFormsRendererFactoryImpl.getRendererInstance(
	at org.eclipse.emf.ecp.view.spi.core.swt.ContainerSWTRenderer.renderControl(
	at org.eclipse.emf.ecp.view.internal.core.swt.renderer.ViewSWTRenderer.renderControl(
	at org.eclipse.emfforms.spi.swt.core.AbstractSWTRenderer.render(
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(
	at org.eclipse.emf.ecp.ui.e4.editor.ECPE4Editor.setInput(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(

[Updated on: Tue, 11 December 2018 04:34]

Report message to a moderator

Re: [EMF Forms] New custom controls [message #1799616 is a reply to message #1799590] Tue, 11 December 2018 08:41 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 111
Registered: September 2016
Senior Member

custom controls are deprecated, please just implement a custom renderer following the examples (Mail and PGroup). No need to add a custom control in the view model, in the view model, it is just a regular control.
Does this help?

Best regards,

Jonas Helming
Get professional Eclipse developer support:
Re: [EMF Forms] New custom controls [message #1799630 is a reply to message #1799616] Tue, 11 December 2018 15:25 Go to previous message
sri pamarti is currently offline sri pamartiFriend
Messages: 19
Registered: August 2015
Junior Member
Thanks Jonas! It worked like a charm. Appreciate your help.

[Updated on: Tue, 11 December 2018 15:26]

Report message to a moderator

Previous Topic:Use of ecore2xml mappings
Next Topic:[EMF FORMS] TableControl WithDialog
Goto Forum:

Current Time: Fri Dec 01 03:19:56 GMT 2023

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

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

Back to the top