Integrate an EMF generated editor in a e4 RCP application [message #704082] |
Thu, 28 July 2011 08:58 |
Missing name Missing name Messages: 57 Registered: September 2009 |
Member |
|
|
Hello,
I try to integrate an EMF generated editor in a e4 RCP application.
In my application project, I defined a e4xmi file, detailing each area with id, handlers and commands.
The open handler have to allows the user to select a file and open my EMF generated editor.
In the openHandler, I open a FileDialog to get the selected file to open, and:
MPartStack stack = (MPartStack) modelService.find("centralDataStack", application);
try {
MInputPart part = MBasicFactory.INSTANCE.createInputPart();
part.setLabel(name);
part.setTooltip(file);
part.setContributionURI("platform:/plugin/Myeditor/presentation.MyEditor");
part.setInputURI(filePath);
part.setCloseable(true);
stack.getChildren().add(part);
stack.setSelectedElement(part);
} catch (Exception e) {
e.printStackTrace();
}
This code opens a part in the good area, but the part is empty. My editor is not opened. There is no exception.
MyEditor project has been generated using an ecore model and a genmodel using EMF (2.7).
Do you know why the editor is not opened ?
Is it a good solution to open the editor ?
Thanks in advance,
Val
[Updated on: Thu, 28 July 2011 09:06] Report message to a moderator
|
|
|
Re: Integrate an EMF generated editor in a e4 RCP application [message #704097 is a reply to message #704082] |
Thu, 28 July 2011 09:06 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
If you are not running the compat layer this can't work! Pure e4 has no
knowledge about IEditorPart and friends.
Tom
Am 28.07.11 10:58, schrieb val.dupin:
> Hello,
>
> I try to integrate an EMF generated editor in a e4 RCP application.
>
> In my application project, I defined a e4xmi file, detailing each area
> with id, handlers and commands.
>
> The open handler have to allows the user to select a file and open my
> EMF generated editor.
>
> In the openHandler, I open a FileDialog to get the selected file to
> open, and:
>
> MPartStack stack = (MPartStack) modelService.find("centralDataStack",
> application);
>
> try {
> MInputPart part = MBasicFactory.INSTANCE.createInputPart();
> part.setLabel(name);
> part.setTooltip(file);
>
> part.setContributionURI("platform:/plugin/Myeditor/presentation.MyEditor");
> part.setInputURI(filePath);
> part.setCloseable(true);
> stack.getChildren().add(part);
> stack.setSelectedElement(part);
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> This code opens a part in the good area, but the part is empty. My
> editor is not opened. There is no exception.
>
> MyEditor project has been generated using an ecore model and a genmodel
> using EMF (2.7).
>
> Do you know why the editor is not opened ?
> Is it a good solution to open the editor ?
>
> Thanks in advance,
>
> Val
>
|
|
|
|
|
|
|
|
Re: Integrate an EMF generated editor in a e4 RCP application [message #708141 is a reply to message #708106] |
Tue, 02 August 2011 13:54 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Am 02.08.11 15:26, schrieb val.dupin:
> Thanks Tom for your reply.
>
> I read your blog, and my application runs.
> The editor is well loaded and is automatically called when I open a file
> using its extensions. Thanks. But it's a 3.x application ?
Yes and no. It is an 3.x style RCP application running on the Eclipse
4.1 platform which means the "Eclipse 4.x Application Platform" is used
to host everything.
>
> But, I would like to use my own e4xmi file. I add the applicationXMI
> property on launch to give my e4xmi file, but it's is not used by the
> application.
You need at least the core e4xmi-File from the workbench. You can
naturally add can copy the e4xmi from the location given and add your
own stuff.
>
> As written in your blog, the application used is
> "org.eclipse.ui.ide.workbench". It's an error no ? If I want the
> application loads an e4xmi, I have to create an
> "org.eclipse.e4.ui.workbench.swt.E4Application", no ?
>
No "org.eclipse.ui.ide.workbench" is the correct product, it bootstraps
the EAP 4.1 and the compat layer which translates 3.x API calls to EAP calls
> The type org.eclipse.ui.ide.workbench allows to create a 3x application
> ... and org.eclipse.e4.ui.workbench.swt.E4Application allows to create
> an e4 application ...
>
Technically any application developed on top of Eclipse 4 is running on
top of EAP, so you are free interface with the model, contribute model
fragments, ... .
Naturally it would be much better if you could run without the compat
layer but this would mean that:
a) We add a native editor story to EAP 4.2
b) EMF adjust its code to generate stuff not dependending on Eclipse
3.x APIs (e.g. subclassing of EditorPart, ...)
I think a) will come with 4.2 (we have already experimented with such a
thing in our SimpleIDE and InputPart is already in the model to support
things backed by an URL) but I'm quite sure without someone stepping up
and doing b) it won't happen - i don't think this is rocket sience but
some has to do it.
Tom
|
|
|
Re: Integrate an EMF generated editor in a e4 RCP application [message #708143 is a reply to message #708106] |
Tue, 02 August 2011 13:54 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Am 02.08.11 15:26, schrieb val.dupin:
> Thanks Tom for your reply.
>
> I read your blog, and my application runs.
> The editor is well loaded and is automatically called when I open a file
> using its extensions. Thanks. But it's a 3.x application ?
Yes and no. It is an 3.x style RCP application running on the Eclipse
4.1 platform which means the "Eclipse 4.x Application Platform" is used
to host everything.
>
> But, I would like to use my own e4xmi file. I add the applicationXMI
> property on launch to give my e4xmi file, but it's is not used by the
> application.
You need at least the core e4xmi-File from the workbench. You can
naturally add can copy the e4xmi from the location given and add your
own stuff.
>
> As written in your blog, the application used is
> "org.eclipse.ui.ide.workbench". It's an error no ? If I want the
> application loads an e4xmi, I have to create an
> "org.eclipse.e4.ui.workbench.swt.E4Application", no ?
>
No "org.eclipse.ui.ide.workbench" is the correct product, it bootstraps
the EAP 4.1 and the compat layer which translates 3.x API calls to EAP calls
> The type org.eclipse.ui.ide.workbench allows to create a 3x application
> ... and org.eclipse.e4.ui.workbench.swt.E4Application allows to create
> an e4 application ...
>
Technically any application developed on top of Eclipse 4 is running on
top of EAP, so you are free interface with the model, contribute model
fragments, ... .
Naturally it would be much better if you could run without the compat
layer but this would mean that:
a) We add a native editor story to EAP 4.2
b) EMF adjust its code to generate stuff not dependending on Eclipse
3.x APIs (e.g. subclassing of EditorPart, ...)
I think a) will come with 4.2 (we have already experimented with such a
thing in our SimpleIDE and InputPart is already in the model to support
things backed by an URL) but I'm quite sure without someone stepping up
and doing b) it won't happen - i don't think this is rocket sience but
some has to do it.
Tom
|
|
|
|
|
|
Re: Integrate an EMF generated editor in a e4 RCP application [message #709024 is a reply to message #708908] |
Wed, 03 August 2011 11:47 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
applicationXMI is used - but the launch is done differently.
The IDEApplication is doing the same bootstraping the E4Application does
but it also launches the compat layer so that ALL 3.x API calls that are
made are translated into EAP calls, all 3.x extension points
(view,editor,...) are translated into model elements, ...
Tom
Am 03.08.11 11:21, schrieb val.dupin:
> Hello,
>
> Sorry to ask you a lot of questions, but I have to understand how does
> it work !
>
> When I launch my application using your advises, the IDEApplication is
> run, and not the E4Application class. So, the applicationXMI property is
> not used ...
|
|
|
Powered by
FUDForum. Page generated in 0.04540 seconds