Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFForms] How to enable creation and linking of Reference Features when embedding the Editor?
[EMFForms] How to enable creation and linking of Reference Features when embedding the Editor? [message #1266526] Fri, 07 March 2014 15:24 Go to next message
Marina Knieling is currently offline Marina KnielingFriend
Messages: 83
Registered: February 2013
Member
Hey guys, me again ;-)

I managed to create my own viewmodel and open it from my own ListViewer.
I simply used the ECPE4Editor (removed the reference to the ECPProject)
and wrote and registered my own E4ModelElementOpener. Everything works
fine and the reference features show up in the editor. Nevertheless it
is not possible to add or link new / existing elements. You mention in
your tutorial
(http://eclipsesource.com/blogs/tutorials/emf-client-platform-how-to-customize-the-editor-layout/#embbededitor)
that this is not supported out of the box. So my question is: what do I
need to do in order to make this work?

Actually I'm getting a ConcurrentModificationException when trying to
add a new element and a NullPointerException when trying to link an
existing element. Stack trace below:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2014-03-07 15:56:15.209
!MESSAGE Internal Error
!STACK 0
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
at org.eclipse.emf.ecp.core.util.ECPUtil.getSubClasses(ECPUtil.java:139)
at
org.eclipse.emf.ecp.spi.ui.ECPReferenceServiceImpl.getNewElementFor(ECPReferenceServiceImpl.java:109)
at
org.eclipse.emf.ecp.edit.internal.swt.reference.NewReferenceAction.run(NewReferenceAction.java:155)
at
org.eclipse.emf.ecp.edit.internal.swt.util.SWTControl$4.widgetSelected(SWTControl.java:326)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at
org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)


and number two:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2014-03-07 16:04:36.197
!MESSAGE Internal Error
!STACK 0
java.lang.NullPointerException
at
org.eclipse.emf.ecp.spi.ui.ECPReferenceServiceImpl.getExistingElementFor(ECPReferenceServiceImpl.java:149)
at
org.eclipse.emf.ecp.edit.internal.swt.reference.AddReferenceAction.run(AddReferenceAction.java:106)
at
org.eclipse.emf.ecp.edit.internal.swt.util.SWTControl$4.widgetSelected(SWTControl.java:326)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at
org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:162)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

Thanks and have a nice weekend

Marina
Re: [EMFForms] How to enable creation and linking of Reference Features when embedding the Editor? [message #1270158 is a reply to message #1266526] Wed, 12 March 2014 15:11 Go to previous message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 63
Registered: March 2012
Member
Hi Marina,
In order to reference an EObject, EMF Forms needs to know where to search for possible elements. The default implementation relies on the ECPProject of the currently opened EObject. The NullPointerException you get is caused by the missing ECPProject.
So you would need to provide your own ReferenceService. As you already have your own e4 editor class, you will find this line:
final ViewModelContext vmc = ViewModelContextFactory.INSTANCE.createViewModelContext(view, modelElement,
				new ECPReferenceServiceImpl());

Instead of the ECPReferenceServiceImpl that is provided there you have to provide your own ReferenceService.

The ConcurrentModificationException should not be there. I will have to check this, maybe it has something to do with the wrong uri that caused the EMFStore errors?
The exception occurs, because EMF adds additional EPackages to the EPackageRegistry while reading all EPackages. This shouldn't happen normally.

Cheers,
Eugen
Previous Topic:[Texo] Project status and ease of development
Next Topic:[Ecore Tools] Outline Model Navigator Empty
Goto Forum:
  


Current Time: Fri Apr 19 12:45:02 GMT 2024

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

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

Back to the top