[EMF Forms] save changes? [message #1719678] |
Mon, 11 January 2016 12:35 |
Eclipse Friend Messages: 2 Registered: January 2016 |
Junior Member |
|
|
Hi there,
I embedded an emf forms generated view in my Editor (type: org.eclipse.ui.part.EditorPart).
This is my createPartControl how integrate the generated view.
@Override
public void createPartControl(Composite parent)
{
try {
final Composite content = new Composite(parent, SWT.NONE);
content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
content.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
content.setLayoutData(GridDataFactory.fillDefaults().create());
final ViewModelContext vmc = ViewModelContextFactory.INSTANCE.createViewModelContext(
ViewProviderHelper.getView(object, null), object, new DefaultReferenceService());
ecpView = ECPSWTViewRenderer.INSTANCE.render(content, vmc);
content.layout();
} catch (final ECPRendererException e) {
e.printStackTrace();
}
parent.layout();
}
How can i implement now the doSave method?
Is there an example how to implement the setDirty() mechanism and a doSave() in a correct way.
Thanks for your help!
[Updated on: Tue, 12 January 2016 08:42] Report message to a moderator
|
|
|
Re: [EMF Forms] save changes? [message #1719756 is a reply to message #1719678] |
Mon, 11 January 2016 19:58 |
Jonas Helming Messages: 699 Registered: July 2009 |
Senior Member |
|
|
Hi,
yes in the new release stream, EMF Forms contains a ready to use Editor.
It is fully generic, so it works with any kind of emf model. You need to
install it from the latest milestone build, though (1.8.x)
https://www.eclipse.org/ecp/emfforms/download.html
You can either have a look at it to see how it is implemented:
https://git.eclipse.org/c/emfclient/org.eclipse.emf.ecp.core.git/tree/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java?h=develop
Or you can just use it, by registering it for you file extension:
<?xml version="1.0" encoding="UTF8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
class="org.eclipse.emfforms.spi.editor.GenericEditor"
default="true"
extensions="myModel"
id="org.eclipse.emf.ecp.makeithappen.model.editor.myEditor"
name="My Model Editor">
</editor>
</extension>
</plugin>
With this registration, all files with the *.myModel extension will be
opened using the generic EMFForms Editor
Best regards
Jonas
Am 11.01.2016 um 17:40 schrieb Eclipse Friend:
> Hi there,
>
> I embedded an emf forms generated view in my Editor (type:
> org.eclipse.ui.part.EditorPart).
>
> This is my createPartControl how integrate the generated view.
>
> @Override
> public void createPartControl(Composite parent)
> {
>
> try {
> final Composite content = new Composite(parent, SWT.NONE);
>
> content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
>
> content.setLayout(GridLayoutFactory.fillDefaults().margins(10,
> 10).create());
> content.setLayoutData(GridDataFactory.fillDefaults().create());
>
> final ViewModelContext vmc =
> ViewModelContextFactory.INSTANCE.createViewModelContext(
> ViewProviderHelper.getView(textModule, null),
> textModule, new DefaultReferenceService());
>
> ecpView = ECPSWTViewRenderer.INSTANCE.render(content, vmc);
> content.layout();
> } catch (final ECPRendererException e) {
> e.printStackTrace();
> }
> parent.layout();
>
> }
>
>
> How can i implement now the doSave method? Is there an example how to
> implement the setDirty() mechanism and a doSave() in a correct way.
>
> Thanks for your help!
--
--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03897 seconds