Are you aware of the Albireo project [1]? You might also want to subscribe to the dev mailing list [2].
----- Original Message ----
From: Christopher Deckers <chrriis@xxxxxxxxx>
To: Eclipse Platform SWT component developers list. <platform-swt-dev@xxxxxxxxxxx>
Sent: Monday, March 3, 2008 3:14:42 PM
Subject: [platform-swt-dev]
SWT_AWT bridge enhancements for dual-process approaches
Hi,
I
noticed
many
stability
issues
with
the
SWT_AWT
bridge
(I
am
reporting
some
bugs
about
it),
and
I
came
up
with
a
solution
that
favors
a
dual-process
approach
(which
happens
to
be
quite
stable).
The
idea
is
to
get
the
handle
of
the
Canvas
from
one
VM,
communicate
it
to
the
second
VM
and
use
that
handle
to
create
a
Shell.
The
problem
is
that
the
APIs
to
create
an
embedded
Shell
using
a
handle
are
not
an
official
and
uniform
API,
and
to
get
the
handle
I
have
to
use
an
external
library.
What
I
would
love
to
have
is
an
object
that
is
serializable
that
contains
a
native
handle
that
can
be
passed
to
a
Shell.
Something
like:
SWT_AWT
public
static
HandleData
getHandleData(Canvas
c)
{}
public
static
Shell
newShell(Display
display,
HandleData
parentHandleData)
{}
HandleData
implements
Serializable
int
/*
long
*/
handle;
What
do
you
think?
Any
comments
and
suggestions?
-Christopher
Here
is
the
code
I
use
to
create
the
Shell.
It
is
only
tested
on
a
few
of
these
systems
in
fact.
/*
The
handle
is
a
long
but
contains
the
int
if
the
platform
uses
int
handles.
*/
public
Shell
createShell(long
handle)
throws
Exception
{
//
These
are
the
methods
that
are
in
the
Shell
class,
and
can
create
the
embedded
shell:
//
win32:
public
static
Shell
win32_new
(Display
display,
int
handle)
{
//
photon:
public
static
Shell
photon_new
(Display
display,
int
handle)
{
//
motif:
public
static
Shell
motif_new
(Display
display,
int
handle)
{
//
gtk:
public
static
Shell
gtk_new
(Display
display,
int
/*long*/
handle)
{
//
carbon:
Shell
(Display
display,
Shell
parent,
int
style,
int
handle)
{
Method
shellCreationMethod
=
null;
try
{
shellCreationMethod
=
Shell.class.getMethod(SWT.getPlatform()
+
"_new",
Display.class,
int.class);
}
catch(Exception
e)
{}
if(shellCreationMethod
!=
null)
{
return
(Shell)shellCreationMethod.invoke(null,
NativeInterfaceHandler.getDisplay(),
(int)handle);
}
try
{
shellCreationMethod
=
Shell.class.getMethod(SWT.getPlatform()
+
"_new",
Display.class,
long.class);
}
catch(Exception
e)
{}
if(shellCreationMethod
!=
null)
{
return
(Shell)shellCreationMethod.invoke(null,
NativeInterfaceHandler.getDisplay(),
handle);
}
Constructor<Shell>
shellConstructor
=
null;
try
{
shellConstructor
=
Shell.class.getConstructor(Display.class,
Shell.class,
int.class,
int.class);
}
catch(Exception
e)
{}
if(shellConstructor
!=
null)
{
shellConstructor.setAccessible(true);
return
shellConstructor.newInstance(NativeInterfaceHandler.getDisplay(),
null,
SWT.NO_TRIM,
(int)handle);
}
try
{
shellConstructor
=
Shell.class.getConstructor(Display.class,
Shell.class,
int.class,
long.class);
}
catch(Exception
e)
{}
if(shellConstructor
!=
null)
{
shellConstructor.setAccessible(true);
return
shellConstructor.newInstance(NativeInterfaceHandler.getDisplay(),
null,
SWT.NO_TRIM,
handle);
}
throw
new
IllegalStateException("Failed
to
create
a
Shell!");
}
_______________________________________________
platform-swt-dev
mailing
list
platform-swt-dev@xxxxxxxxxxxhttps://dev.eclipse.org/mailman/listinfo/platform-swt-dev