Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFForms] Embedding EMFForms to my own RAP App
[EMFForms] Embedding EMFForms to my own RAP App [message #1277201] Tue, 25 March 2014 16:56 Go to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi there,

i'm currently working on an integration of EMFForms into my rap application. Eugen helped me getting started with rap and ecp. My actual goal is to pass my own CDO EObject to ECPSWTViewRenderer which renders the attributes as seen in ECP.


As an easy example, I tried it with the following code (embedded in a extended viewpart view):

            Task comp = TaskFactory.eINSTANCE.createTask();
            comp.setName("TestName");
            System.out.println(comp.getName());                       
            ECPSWTViewRenderer.INSTANCE.render(parent, comp);


When i execute the view i receive the following exception:

!MESSAGE Unable to create view ID com.ph.formtest.ui.emfFormsView: An unexpected exception was thrown.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.emf.ecp.view.spi.model.util.ViewModelUtil.resolveDomainReferences(ViewModelUtil.java:45)
	at org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl.instantiate(ViewModelContextImpl.java:120)
	at org.eclipse.emf.ecp.view.internal.context.ViewModelContextImpl.<init>(ViewModelContextImpl.java:95)
	at org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory.createViewModelContext(ViewModelContextFactory.java:42)
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:54)
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:44)
	at com.ph.formtest.ui.example.views.EmfFormsView.createPartControl(EmfFormsView.java:64)
	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:599)
	at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2246)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1073)
	at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3815)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3812)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3788)
	at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:162)
	at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:77)
	at org.eclipse.ui.internal.handlers.Handlformtestroxy.execute(Handlformtestroxy.java:304)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:167)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:239)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:843)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:819)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:85)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:699)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:601)
	at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1208)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1189)
	at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1164)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2733)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2694)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:701)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:684)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at com.ph.formtest.rap.Application.start(Application.java:18)
	at org.eclipse.rap.ui.internal.application.EntryPointApplicationWrapper.createUI(EntryPointApplicationWrapper.java:38)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:186)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:298)
	at java.lang.Thread.run(Thread.java:744)
	at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:104)


What am i missing?

Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1277794 is a reply to message #1277201] Wed, 26 March 2014 13:27 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 63
Registered: March 2012
Member
Hi Phil,
you are just missing a plugin.
You have to add org.eclipse.emf.ecp.view.model.provider.generator to your launch config.
If you want to provide your own view models you should add org.eclipse.emf.ecp.view.model.provider.xmi, too.

Cheers,
Eugen
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1278314 is a reply to message #1277794] Thu, 27 March 2014 06:52 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi Eugen,

i have to excuse myself. Indeed, I didn't include these bundles. But in my first test I had them in my launch conf. Then the previous exception occurred again: No renders found. Now I copied all bundles from your mentioned ecpDevelopmentDemo (except of epc.ui.e3). NoRendersFound Exception disappeared. Now I have trouble with:
 
!MESSAGE Unable to create view ID com.ph.formtest.ui.emfFormsView: A null service reference is not allowed.
!STACK 0
java.lang.NullPointerException: A null service reference is not allowed.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService(BundleContextImpl.java:586)
	at org.eclipse.emf.ecp.view.internal.core.swt.Activator.getECPControlFactory(Activator.java:77)
	at org.eclipse.emf.ecp.view.spi.core.swt.SWTControlRenderer.renderModel(SWTControlRenderer.java:79)
	at org.eclipse.emf.ecp.view.spi.core.swt.SWTControlRenderer.render(SWTControlRenderer.java:67)
	at org.eclipse.emf.ecp.view.spi.core.swt.SWTControlRenderer.render(SWTControlRenderer.java:1)
	at org.eclipse.emf.ecp.view.spi.swt.SWTRendererFactory.render(SWTRendererFactory.java:112)
	at org.eclipse.emf.ecp.view.spi.core.swt.SWTViewRenderer.renderModel(SWTViewRenderer.java:66)
	at org.eclipse.emf.ecp.view.spi.core.swt.SWTViewRenderer.renderModel(SWTViewRenderer.java:1)
	at org.eclipse.emf.ecp.view.spi.swt.AbstractSWTRenderer.render(AbstractSWTRenderer.java:67)
	at org.eclipse.emf.ecp.view.spi.swt.SWTRendererFactory.render(SWTRendererFactory.java:112)
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:66)
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:56)
	at org.eclipse.emf.ecp.view.internal.swt.ECPSWTViewRendererImpl.render(ECPSWTViewRendererImpl.java:44)
	at com.ph.formtest.ui.example.views.EmfFormsView.createPartControl(EmfFormsView.java:64)
	at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:375)
	at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:226)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:599)
	at org.eclipse.ui.internal.Perspective.showView(Perspective.java:2246)
	at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1073)
	at org.eclipse.ui.internal.WorkbenchPage$20.run(WorkbenchPage.java:3815)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:66)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3812)
	at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3788)
	at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:162)
	at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:77)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:304)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:167)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:239)
	at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:843)
	at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:829)
	at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:819)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:85)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:699)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:601)
	at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1208)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1189)
	at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1164)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2733)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2694)
	at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:701)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:684)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
	at com.ph.formtest.rap.Application.start(Application.java:18)
	at org.eclipse.rap.ui.internal.application.EntryPointApplicationWrapper.createUI(EntryPointApplicationWrapper.java:38)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:186)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:298)
	at java.lang.Thread.run(Thread.java:744)
	at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:104)


Is that still a ECP related Exception?
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1278376 is a reply to message #1278314] Thu, 27 March 2014 08:43 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 63
Registered: March 2012
Member
Hi Phil,
please check whether org.eclipse.equinox.ds is running and the bundle org.eclipse.emf.ecp.edit.swt is also in your run configuration.

Cheers,
Eugen
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1278632 is a reply to message #1278376] Thu, 27 March 2014 16:12 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi Eugen,

it was the missing bundle. Thx!

In "Getting started with EMFForms" Jonas mentioned that referencing features are not working out of the box. Which API do I have to use to get it running? Would it work if I use ECP related Provider (in my case CDOProvider)? If so, is there any manual next to Javadoc which explains the ecp api. E.g. What I need to retrieve an EObject of an DataProvider?

Cheers
Philippe
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1279245 is a reply to message #1278632] Fri, 28 March 2014 12:59 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Phil,

in general, if you use the provider layer, you will not need to
implement a reference service. There is a bridge, an implementation of
the reference service, which accesses an ECPProject
Another comment: If you run ECP on RAP, there are open issues (at least
for the EMFStore provider):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=428912
I would guess, that some of them also apply for the CDO Provider
(especially https://bugs.eclipse.org/bugs/show_bug.cgi?id=429222), so
please test at least the multi-user case.

Regards

Jonas

Am 27.03.2014 17:12, schrieb Phil Wim:
> Hi Eugen,
>
> it was the missing bundle. Thx!
>
> In "Getting started with EMFForms" Jonas mentioned that referencing
> features are not working out of the box. Which API do I have to use to
> get it running? Would it work if I use ECP related Provider (in my case
> CDOProvider)? If so, is there any manual next to Javadoc which explains
> the ecp api. E.g. What I need to retrieve an EObject of an DataProvider?
>
> Cheers
> Philippe
>
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1281756 is a reply to message #1279245] Tue, 01 April 2014 09:57 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi Jonas,

thanks!

That sound like a serious issue. For now, I am going with my own CDOSessionProvider implementation. That means I have to implement a ReferenceService as well.

You depicted a "bridge" as a implementation of the reference Service. Do you mean explorereditorbrindge?
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1282353 is a reply to message #1281756] Wed, 02 April 2014 07:00 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

yes the explorereditorbridge should show you how to implement the
service. What kind of provider are you implementing? An online provider?

Regards

Jonas

Am 01.04.2014 11:57, schrieb Phil Wim:
> Hi Jonas,
>
> thanks!
>
> That sound like a serious issue. For now, I am going with my own
> CDOSessionProvider implementation. That means I have to implement a
> ReferenceService as well.
>
> You depicted a "bridge" as a implementation of the reference Service. Do
> you mean explorereditorbrindge?
>
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1310363 is a reply to message #1277201] Wed, 23 April 2014 06:26 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
Hi Jonas,

yes, that is my intention. I need an online CDO Provider. I thought it is enough to create my own ReferenceServiceImpl. Therefor I adapted the methods to work with my CDOSession and added it as an extension point. Then, the trouble started. Smile

I can add the container to my parent editor. I see a minor formatted ecp-form (no margins, no title bar, etc). With my adaption of "openInNewContext" (see following listing) I'm able to open a reference eObject (I used the method EditorModelElementOpener .openModelElement of the bridge) . Than it looks like a real ecp-form. But there's no validation and the ReferenceService which is used for the real looking ecp-form is switched back to ECPReferenceServiceImpl. That's probably because I'm using the MEEditorInput.

	public void openInNewContext(EObject eObject) {
		System.out.println("MyReferenceService: openInNewContext");
		final MEEditorInput input = new MEEditorInput(new EditorContext((EObject) eObject,null));
		
		try {
			PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
				.openEditor(input, "org.eclipse.emf.ecp.editor", true);
		} catch (final PartInitException e) {
			Activator.logException(e);
		}
		
		ECPHandlerHelper.openModelElement(eObject, null);
	}


I really want to integrate it into my own application. But I have no idea how to proceed or to write my own EMFForms ReferenceService without ECP related artifacts (ECPProject, ECPRepository).

Can you provide a simple example of how to implement it?

Are you guys planning an online CDOProvider?

Thanks Philippe
Re: [EMFForms] Embedding EMFForms to my own RAP App [message #1310637 is a reply to message #1310363] Wed, 23 April 2014 09:51 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi Phil,

to avoid any misunderstandings. There are two options for you:

1. You implement a CDO online provider. We had plans to do this since
quite some time, so we will be happy to accept this contribution. The
Provider SPI is provided and offered by EMF Client Platform. It is not
directly related to EMF Forms.
If you implement a Provider, you will be able to use the model explorer,
the repositories view and the editor. To implement a CDO provider, you
should look at the bundles
- org.eclipse.emf.ecp.cdo.core
- org.eclipse.emf.ecp.cdo.ui
These implement the current offline CDO provider.
I also expect you need a customized implementation for the reference
service, even if you implement the online provider. As an example, the
select reference dialog, should probably not load all availabel objects,
but allow to query.

2. You only implement the reference service. This interface is provided
by EMF Forms and has nothing to do with ECP. It is the abstraction of
the backend, which is required by the reference controls in EMF Forms.
In this case, you should avoid all dependencies to ECPProject and ecp
core bundles.

About your question: How do you opened the editor in the first place?

Best regards

Jonas


Am 23.04.2014 08:26, schrieb Phil Wim:
> Hi Jonas,
>
> yes, that is my intention. I need an online CDO Provider. I thought it
> is enough to create my own ReferenceServiceImpl. Therefor I adapted the
> methods to work with my CDOSession and added it as an extension point.
> Then, the trouble started. :)
> I can add the container to my parent editor. I see a minor formatted
> ecp-form (no margins, no title bar, etc). With my adaption of
> "openInNewContext" (see following listing) I'm able to open a reference
> eObject (I used the method EditorModelElementOpener .openModelElement of
> the bridge) . Than it looks like a real ecp-form. But there's no
> validation and the ReferenceService which is used for the real looking
> ecp-form is switched back to ECPReferenceServiceImpl. That's probably
> because I'm using the MEEditorInput.
>
> public void openInNewContext(EObject eObject) {
> System.out.println("MyReferenceService: openInNewContext");
> final MEEditorInput input = new MEEditorInput(new
> EditorConecptext((EObject) eObject,null));
>
> try {
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
> .openEditor(input, "org.eclipse.emf.ecp.editor", true);
> } catch (final PartInitException e) {
> Activator.logException(e);
> }
>
> ECPHandlerHelper.openModelElement(eObject, null);
> }
>
>
> I really want to integrate it into my own application. But I have no
> idea how to proceed or to write my own EMFForms ReferenceService without
> ECP related artifacts (ECPProject, ECPRepository).
> Can you provide a simple example of how to implement it?
> Are you guys planning an online CDOProvider?
> Thanks Philippe
>
Previous Topic:Create ecoretools 2 diagram from ecore file
Next Topic:[EMF Client Platform] Multi-Page Editor
Goto Forum:
  


Current Time: Thu Apr 18 12:14:43 GMT 2024

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

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

Back to the top