Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Multiple E4 Applications in one product?
Multiple E4 Applications in one product? [message #916130] Tue, 18 September 2012 15:34 Go to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
OSGi (and eclipse) allow for more than one IApplication in one product. There are various ways about how to determine which IApplication is to be run when eclipse is started.

Enter E4: there is only one IApplication, which is org.eclipse.e4.ui.internal.workbench.swt.E4Application. But there a the model, whose outer element is the Application-element.

So the question about how to use more than one E4-application in one product comes to mind. This could only mean, that there should be more than one application model and that E4Application should load one of them. So there should be a way to tell E4Application about which model to load. Usually this is done by setting the property applicationXMI in the product. I don't know about how to change that dynamically at runtime.

Now the class E4Application first looks at the IApplicationContext for this key and if it is not found it looks at the system properties. This provides a way to specify the model which is to be used.

So I end up with (at least) three questions:

(1) Is this the proper way to specify which model (among several in a product) E4Application should load?

(2) Will this be a permanent feature, i.e. will E4Application always look at the system properties?

(3) Will this work at all? Or: what else do I have to consider? E4 saves the model on exit. So, if eclipse is first run with model1, which is saved on exit, and later is run with model2, will there be any problems? (The elementIDs in the Aplication-Elements in both models will be different.)

On the other hand, I cannot believe that E4-products will only work with one IApplication and one model. So there should be a way to do what I have in mind!?
Re: Multiple E4 Applications in one product? [message #916166 is a reply to message #916130] Tue, 18 September 2012 16:31 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 18.09.12 17:34, schrieb Karl Weber:
> OSGi (and eclipse) allow for more than one IApplication in one product.
> There are various ways about how to determine which IApplication is to
> be run when eclipse is started.
>
> Enter E4: there is only one IApplication, which is
> org.eclipse.e4.ui.internal.workbench.swt.E4Application. But there a the
> model, whose outer element is the Application-element.
>
> So the question about how to use more than one E4-application in one
> product comes to mind. This could only mean, that there should be more
> than one application model and that E4Application should load one of
> them. So there should be a way to tell E4Application about which model
> to load. Usually this is done by setting the property applicationXMI in
> the product. I don't know about how to change that dynamically at runtime.
>

Yes every product has to have it's own MApplication-Root-Element and
below there the DOM used to renderer it

> Now the class E4Application first looks at the IApplicationContext for
> this key and if it is not found it looks at the system properties. This
> provides a way to specify the model which is to be used.
>
> So I end up with (at least) three questions:
>
> (1) Is this the proper way to specify which model (among several in a
> product) E4Application should load?

No but you can set values when you launch the application
programmatically by passing the exact same keys and they'll be part of
the IApplicationContext passed on.

By the default they are read from the product extension point in your
plugin.xml

>
> (2) Will this be a permanent feature, i.e. will E4Application always
> look at the system properties?

As a fall back yes

>
> (3) Will this work at all? Or: what else do I have to consider? E4 saves
> the model on exit. So, if eclipse is first run with model1, which is
> saved on exit, and later is run with model2, will there be any problems?
> (The elementIDs in the Aplication-Elements in both models will be
> different.)
>

No with the default implementatio you get has the problem you have is
the event-broker which is NOT scoping events to your application instance.

Another problem in SWT might be that you can not launch multiple
SWT-Displays in one JVM (dependens on the platform) but I think we need
to have a display for each and every instance because of how we handle
keybindings.

But there's nothing wrong to don't use the E4Application we provide but
launch your custom one doing the same we do in E4Application (e.g. the
Eclipse IDE is not launching the E4Application!)

> On the other hand, I cannot believe that E4-products will only work with
> one IApplication and one model. So there should be a way to do what I
> have in mind!?
>

We designed e4 in a way that multiple instances can be launched, e.g.
this happens in RAP and Vaadin and because we are not using statics and
singletons this is true beside the above mentionned broker scoping bug.

Tom
Re: Multiple E4 Applications in one product? [message #916199 is a reply to message #916166] Tue, 18 September 2012 17:52 Go to previous messageGo to next message
Karl Weber is currently offline Karl WeberFriend
Messages: 63
Registered: September 2010
Member
Thank you, Tom!

Thomas Schindl wrote on Tue, 18 September 2012 18:31
Am 18.09.12 17:34, schrieb Karl Weber:
[...]
> (1) Is this the proper way to specify which model (among several in a
> product) E4Application should load?

No but you can set values when you launch the application
programmatically by passing the exact same keys and they'll be part of
the IApplicationContext passed on.

Yes, I didn't think about that.

Thomas Schindl wrote on Tue, 18 September 2012 18:31

[...]
>
> (3) Will this work at all? Or: what else do I have to consider? E4 saves
> the model on exit. So, if eclipse is first run with model1, which is
> saved on exit, and later is run with model2, will there be any problems?
> (The elementIDs in the Aplication-Elements in both models will be
> different.)
>

No with the default implementatio you get has the problem you have is
the event-broker which is NOT scoping events to your application instance.

Another problem in SWT might be that you can not launch multiple
SWT-Displays in one JVM (dependens on the platform) but I think we need
to have a display for each and every instance because of how we handle
keybindings.

But there's nothing wrong to don't use the E4Application we provide but
launch your custom one doing the same we do in E4Application (e.g. the
Eclipse IDE is not launching the E4Application!)

Sounds very interesting. But E4Application does a lot of things and I don't know how much all the rest of e4 depends on it. Even if I take a copy of it and add only slight modifications, I could not be sure that it will work with another release or so.

Is there any documentation?

Thomas Schindl wrote on Tue, 18 September 2012 18:31

> On the other hand, I cannot believe that E4-products will only work with
> one IApplication and one model. So there should be a way to do what I
> have in mind!?
>

We designed e4 in a way that multiple instances can be launched, e.g.
this happens in RAP and Vaadin and because we are not using statics and
singletons this is true beside the above mentionned broker scoping bug.

I read something like that before without understanding it. Instances of what?
Re: Multiple E4 Applications in one product? [message #916243 is a reply to message #916199] Tue, 18 September 2012 19:45 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

>> Another problem in SWT might be that you can not launch multiple
>> SWT-Displays in one JVM (dependens on the platform) but I think we need
>> to have a display for each and every instance because of how we handle
>> keybindings.
>>
>> But there's nothing wrong to don't use the E4Application we provide but
>> launch your custom one doing the same we do in E4Application (e.g. the
>> Eclipse IDE is not launching the E4Application!)
>
> Sounds very interesting. But E4Application does a lot of things and I
> don't know how much all the rest of e4 depends on it. Even if I take a
> copy of it and add only slight modifications, I could not be sure that
> it will work with another release or so.
> Is there any documentation?

Well you need to keep up with the changes done in the original one (in
case there are any) and there's no documentation because it really
depends on what you want to do. E.g. my JavaFX launcher will not be able
to push a display into the context, ....

>
> Thomas Schindl wrote on Tue, 18 September 2012 18:31
>> > On the other hand, I cannot believe that E4-products will only work
>> with
>> > one IApplication and one model. So there should be a way to do what I
>> > have in mind!?
>> >
>> We designed e4 in a way that multiple instances can be launched, e.g.
>> this happens in RAP and Vaadin and because we are not using statics and
>> singletons this is true beside the above mentionned broker scoping bug.
>
> I read something like that before without understanding it. Instances of
> what?
>

In 3.x all and everything is accessible through statics
(PlatformUI.getWorkbench()...) there are not statics in e4 at all so you
can define the scope of singletons through the IEclipseContext.

Tom
Previous Topic:[E4AP] Hiding Ui Elements
Next Topic:Eclipse Product export wizard
Goto Forum:
  


Current Time: Tue Apr 23 07:17:45 GMT 2024

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

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

Back to the top