Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Cannot edit models in Forms
[EMF Forms] Cannot edit models in Forms [message #1710176] Mon, 05 October 2015 08:07 Go to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 30
Registered: January 2015
Member
Hi there,

I'm doing my first steps with EMF-Forms and have some problems with the
e4-Example application.

I adapted the code a little bit to support my own model (Xtext based)
and in the Part I set a correct EMF-Model that I loaded from a EMF
resource (actually loaded from an Xtext parsed file).
So far so good, my contents is correctly shown in the forms-editor.

Below is the code.
The problem is that I cannot change the model. If I manually edit any
String-Field in the editor, the change is immediately discarded when I
close and reopen that view. If I add an object to a list I get an NPE
like the one below.
Did I miss anything to enable edit support?

Cheers,
Hauke

EList<EObject> input;

@PostConstruct
public void createComposite(Composite parent) {
this.parent = parent;
content = new Composite(parent, SWT.NONE);
try {
content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
content.setLayout(GridLayoutFactory.fillDefaults().margins(10,
10).create());
content.setLayoutData(GridDataFactory.fillDefaults().create());
if (input == null || input.isEmpty())
return;
final ViewModelContext vmc =
ViewModelContextFactory.INSTANCE.createViewModelContext(
ViewProviderHelper.getView(input.get(0), null), input.get(0), new
DefaultReferenceService());
ECPSWTViewRenderer.INSTANCE.render(content, vmc);
content.layout();
} catch (final ECPRendererException e) {
e.printStackTrace();
}
parent.layout();
}

java.lang.NullPointerException
at
org.eclipse.emf.ecp.internal.edit.ECPControlHelper.addModelElementInReference(ECPControlHelper.java:44)
at
org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceService.addNewModelElements(DefaultReferenceService.java:120)
at
org.eclipse.emf.ecp.view.internal.control.multireference.MultiReferenceSWTRenderer.handleAddNew(MultiReferenceSWTRenderer.java:428)
at
org.eclipse.emf.ecp.view.internal.control.multireference.MultiReferenceSWTRenderer$2.widgetSelected(MultiReferenceSWTRenderer.java:269)
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.Display.sendEvent(Display.java:4362)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
at
org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:159)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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:669)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Re: [EMF Forms] Cannot edit models in Forms [message #1710323 is a reply to message #1710176] Tue, 06 October 2015 06:37 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

seems like there is no EditingDomain for your model instance. You can
attach it to the ressource your EObjects are contained in.

Best regards

Jonas

Am 05.10.2015 um 10:07 schrieb Hauke Fuhrmann:
> at
> org.eclipse.emf.ecp.internal.edit.ECPControlHelper.addModelElementInReference(ECPControlHelper.java:44)
>


--
--

Jonas Helming

Get professional Eclipse developer support:

http://eclipsesource.com/en/services/developer-support/
Previous Topic:[ECP] Custom E4 Application
Next Topic:[EMF Forms] render views read-only dynamically
Goto Forum:
  


Current Time: Fri Dec 04 00:07:46 GMT 2020

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

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

Back to the top