Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » [E4 Incubator] Creating Display in E4EntryPointFactory
[E4 Incubator] Creating Display in E4EntryPointFactory [message #1319944] Mon, 28 April 2014 13:40 Go to next message
M. Herrmann is currently offline M. Herrmann
Messages: 25
Registered: March 2010
Junior Member
Hi,

I am using the E4 incubator project and I'm quite happy so far.
Thanks for the great work.

I have just one problem:
before I open the main application window, I sometimes need to display dialogs and stuff.

If I do that before displaying the application window this exception is thrown:

org.eclipse.swt.SWTError: Not implemented [multiple displays]
	at org.eclipse.swt.SWT.error(SWT.java:3668)
	at org.eclipse.swt.widgets.Display.<init>(Display.java:270)
	at org.eclipse.rap.e4.E4EntryPointFactory.createWorkbench(E4EntryPointFactory.java:61)



After diggin' into the code a little bit i found out why:
If I open a dialog before the application window a display is created (somewhere along the way of displaying the dialog).
Then, in the E4EntryPointFactory.java in the method createWorkbench another display is created instead of using the existing one.

This is the code in E4EntryPointFactory:

private int createWorkbench() {
   Display display = new Display();
   E4Application e4App = new E4Application();
   E4Workbench workbench = e4App.createE4Workbench(getApplicationContext(config), display);
.....
}


So the E4EntryPointFactory is ALWAYS creating a new display.

Should'nt this be something like this?:


private int createWorkbench() {
        Display display = Display.getCurrent();
        if (display == null) {
            display = new Display();
        }
...
}



Re: [E4 Incubator] Creating Display in E4EntryPointFactory [message #1320090 is a reply to message #1319944] Mon, 28 April 2014 15:32 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5407
Registered: July 2009
Senior Member
Hi,

In e4 you would typically do what you want using a lifecycle handler.
I'm not yet sure if we support that! Anyways please file a bugzilla and
CC me on the bug so that we can find a solution to your problem.

Tom

On 28.04.14 15:40, M. Herrmann wrote:
> Hi,
>
> I am using the E4 incubator project and I'm quite happy so far.
> Thanks for the great work.
>
> I have just one problem:
> before I open the main application window, I sometimes need to display
> dialogs and stuff.
>
> If I do that before displaying the application window this exception is
> thrown:
>
> org.eclipse.swt.SWTError: Not implemented [multiple displays]
> at org.eclipse.swt.SWT.error(SWT.java:3668)
> at org.eclipse.swt.widgets.Display.<init>(Display.java:270)
> at
> org.eclipse.rap.e4.E4EntryPointFactory.createWorkbench(E4EntryPointFactory.java:61)
>
>
>
> After diggin' into the code a little bit i found out why:
> If I open a dialog before the application window a display is created
> (somewhere along the way of displaying the dialog).
> Then, in the E4EntryPointFactory.java in the method createWorkbench
> another display is created instead of using the existing one.
>
> This is the code in E4EntryPointFactory:
>
> private int createWorkbench() {
> Display display = new Display();
> E4Application e4App = new E4Application();
> E4Workbench workbench =
> e4App.createE4Workbench(getApplicationContext(config), display);
> ....
> }
>
> So the E4EntryPointFactory is ALWAYS creating a new display.
>
> Should'nt this be something like this?:
>
>
> private int createWorkbench() {
> Display display = Display.getCurrent();
> if (display == null) {
> display = new Display();
> }
> ..
> }
>
>
>
Re: [E4 Incubator] Creating Display in E4EntryPointFactory [message #1343483 is a reply to message #1320090] Fri, 09 May 2014 10:02 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5407
Registered: July 2009
Senior Member
Hi,

Lifecycle support was already added but to stop the start up process I
added the possibility to return a boolean from the @PostContextCreate.

Filed as https://bugs.eclipse.org/bugs/show_bug.cgi?id=434481 and fixed
with
http://git.eclipse.org/c/rap/incubator/org.eclipse.rap.incubator.e4.git/commit/?id=e827a4415c2d09dc845dd984d77a2dfb79785ac2

You can take a look at the demo application to see this in action.

Tom

On 28.04.14 17:32, Tom Schindl wrote:
> Hi,
>
> In e4 you would typically do what you want using a lifecycle handler.
> I'm not yet sure if we support that! Anyways please file a bugzilla and
> CC me on the bug so that we can find a solution to your problem.
>
> Tom
>
> On 28.04.14 15:40, M. Herrmann wrote:
>> Hi,
>>
>> I am using the E4 incubator project and I'm quite happy so far.
>> Thanks for the great work.
>>
>> I have just one problem:
>> before I open the main application window, I sometimes need to display
>> dialogs and stuff.
>>
>> If I do that before displaying the application window this exception is
>> thrown:
>>
>> org.eclipse.swt.SWTError: Not implemented [multiple displays]
>> at org.eclipse.swt.SWT.error(SWT.java:3668)
>> at org.eclipse.swt.widgets.Display.<init>(Display.java:270)
>> at
>> org.eclipse.rap.e4.E4EntryPointFactory.createWorkbench(E4EntryPointFactory.java:61)
>>
>>
>>
>> After diggin' into the code a little bit i found out why:
>> If I open a dialog before the application window a display is created
>> (somewhere along the way of displaying the dialog).
>> Then, in the E4EntryPointFactory.java in the method createWorkbench
>> another display is created instead of using the existing one.
>>
>> This is the code in E4EntryPointFactory:
>>
>> private int createWorkbench() {
>> Display display = new Display();
>> E4Application e4App = new E4Application();
>> E4Workbench workbench =
>> e4App.createE4Workbench(getApplicationContext(config), display);
>> ....
>> }
>>
>> So the E4EntryPointFactory is ALWAYS creating a new display.
>>
>> Should'nt this be something like this?:
>>
>>
>> private int createWorkbench() {
>> Display display = Display.getCurrent();
>> if (display == null) {
>> display = new Display();
>> }
>> ..
>> }
>>
>>
>>
>
Previous Topic:Is Copy operation supported in Drag And Drop ?
Next Topic:[ANN] RAP 2.3M3 is here
Goto Forum:
  


Current Time: Thu Oct 23 04:41:56 GMT 2014

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

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