Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Integrate an EMF generated editor in a e4 RCP application  () 1 Vote
Integrate an EMF generated editor in a e4 RCP application [message #704082] Thu, 28 July 2011 08:58 Go to next message
Missing name Missing name is currently offline 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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
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 #704126 is a reply to message #704082] Thu, 28 July 2011 09:52 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
Hello,

Thanks Tom for you reply.
I add org.eclipse.e4.tools.compat, and org.eclipse.e4.tools.services to the running configuration (with auto-start to true).

org.eclipse.e4.tools.compat is ACTIVE.

My editor does not appear in the part.

Have you got another idea ?

Val
Re: Integrate an EMF generated editor in a e4 RCP application [message #704137 is a reply to message #704126] Thu, 28 July 2011 10:07 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
Registered: July 2009
Senior Member
This has nothing to do with tools.compat! If you want to use stuff found
in org.eclipse.ui you need to launch your RCP application like you did
it in 3.x

org.eclipse.ui is the so called compat layer which makes things written
for 3.x run in a 4.x env and because EMF generates code for 3.x you need
to run with this compat layer turned on.

I've published a tutorial on this some weeks ago [1]

Tom

[1]http://tomsondev.bestsolution.at/2011/07/01/eclipse-4-1-run-your-3-x-rcp-in-4-1/

Am 28.07.11 11:52, schrieb val.dupin:
> Hello,
>
> Thanks Tom for you reply.
> I add org.eclipse.e4.tools.compat, and org.eclipse.e4.tools.services to
> the running configuration (with auto-start to true).
>
> org.eclipse.e4.tools.compat is ACTIVE.
>
> My editor does not appear in the part.
>
> Have you got another idea ?
>
> Val
Re: Integrate an EMF generated editor in a e4 RCP application [message #704231 is a reply to message #704137] Thu, 28 July 2011 12:04 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
This means that I can't use my e4 RCP application using e4xmi file ?
I have to make my application programmatically like 3.x version ?
Re: Integrate an EMF generated editor in a e4 RCP application [message #704265 is a reply to message #704231] Thu, 28 July 2011 12:09 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
Registered: July 2009
Senior Member
Did you read my blog post? An Eclipse 4 RCP application does use an
e4xmi-File but you need to bring up the framework like you did in 3.x.

Tom

Am 28.07.11 14:04, schrieb val.dupin:
> This means that I can't use my e4 RCP application using e4xmi file ?
> I have to make my application programmatically like 3.x version ?
Re: Integrate an EMF generated editor in a e4 RCP application [message #708106 is a reply to message #704265] Tue, 02 August 2011 13:26 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
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 ?

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.

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 ?

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 ...

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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
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 #708179 is a reply to message #708141] Tue, 02 August 2011 14:41 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
I can have several "applicationXMI" properties in a plugin.xml ?
I try to add my own e4xmi as another applicationXMI property (I let the LegacyIDE.e4xmi file on applicationXMI property). No effects ... I only see the Resource perspective.

Val
Re: Integrate an EMF generated editor in a e4 RCP application [message #708191 is a reply to message #708179] Tue, 02 August 2011 14:44 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
Registered: July 2009
Senior Member
You should copy the LegacyIDE.e4xmi as MyLegacyIDE.e4xmi to your own
project and add your own stuff in there. Afterwards modify the
plugin.xml to point to your local MyLegacyIDE.e4xmi.

Tom

Am 02.08.11 16:41, schrieb val.dupin:
> I can have several "applicationXMI" properties in a plugin.xml ?
> I try to add my own e4xmi as another applicationXMI property (I let the
> LegacyIDE.e4xmi file on applicationXMI property). No effects ... I only
> see the Resource perspective.
>
> Val
Re: Integrate an EMF generated editor in a e4 RCP application [message #708908 is a reply to message #708191] Wed, 03 August 2011 09:21 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 57
Registered: September 2009
Member
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 ...
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 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5400
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 ...
Previous Topic:running xwt on rap
Next Topic:documentation
Goto Forum:
  


Current Time: Tue Oct 21 13:40:44 GMT 2014

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

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