You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Christopher BROWN <br...@reflexe.fr> on 2011/10/23 22:54:56 UTC

Using SWT and JFace with Apache Felix

Hello,

Having developed with Java Swing for a long time, and having seen that
Oracle seem to have decided to place Swing into "maintenance mode" (with
emphasis going to JavaFX, which doesn't yet seem very cross-platform and
doesn't have anything like native UI widgets), I'm currently investigating
whether I can find the functionality I need by moving to SWT.

At this point, I don't want the full Eclipse RCP platform (I don't actually
like Eclipse as an IDE, I prefer IntelliJ, but that's got nothing to do with
my decision process here).  I figured that SWT on its own, along with JFace,
seems like a good fit.

However, I'm not really sure what the best approach is with regards to using
that in Felix.  I'm running Felix in embedded mode (so no interactive shell)
and would welcome advice as to how I might load SWT as an OSGi bundle (or in
the system classpath) in an application primarily targeting Windows, Linux,
and Mac OS.  I've seen (vague, no detail) tips about splitting up SWT into a
JAR and using fragments for platform-specific stuff, but I'm not sure how to
perform this splitting and how to select which fragment to load (remember,
I'm not expecting users to mess around with an interactive shell to set it
up, I aim to provide a "It Just Works" type of experience).

Furthermore, it appears that JFace requires the Equinox OSGi runtime from
the documentation.  If this is the case, does that rule out JFace/SWT from
within Felix?

Thanks for feedback and advice,
Christopher

Re: Using SWT and JFace with Apache Felix

Posted by Christopher BROWN <br...@reflexe.fr>.
One last question about OSGi bundles for SWT/JFace... the SWT JARs
that are available from www.eclipse.org/swt are apparently just
classic JARs, with variants per target platform (each JAR has the
common classes and the native integration stuff).  The only place I
can find the core and native fragments is by downloading each huge
variant of Eclipse, per platform, and go fishing for the OSGi bundles
therein.

Are they available elsewhere, along with JFace, or do I need to make
heavy use of the network?

Thanks,
Christopher



On 24 October 2011 08:58, Neil Bartlett <nj...@gmail.com> wrote:
> Actually you can run SWT/JFace in Felix with the following bundles
> (tested with Felix 4.0.0).
>
> org.eclipse.swt (core plus native fragment for your platform)
> org.eclipse.jface
> org.eclipse.core.commands
> org.eclipse.equinox.common
> org.eclipse.equinox.supplement
>
> Note that although two of these bundles contain the name Equinox, they
> are not the Equinox framework itself, just plain bundles. The largest
> one in terms of storage space is the SWT native fragment at around 2Mb
> (for Mac OSX Cocoa x86_64... other native fragments may vary in size).
>
> Don't pay any attention to the documentation that tells you that you
> need the whole of Eclipse RCP, it is just plain wrong.
>
> Regards,
> Neil
>
> PS: the problem with your bundle list was that PDE selected
> "org.eclipse.osgi" (i.e. the main Equinox framework) as a provider of
> org.osgi.framework. So you actually ended up with Equinox running as a
> bundle inside Felix... this is not necessary, fortunately ;-)
>
>
>
>
> On Mon, Oct 24, 2011 at 6:53 AM, Christopher BROWN <br...@reflexe.fr> wrote:
>> Hi Ken,
>>
>> That does indeed help.
>>
>> I'm guessing that "org.eclipse.equinox.common" and "org.eclipse.osgi" bundle
>> dependencies suggest that JFace has implementation-specific dependencies
>> (using utility classes packaged with framework implementation).  I've tried
>> some quick searching and the best I could find is
>> http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Foverview-summary.htmlwhich
>> suggests that if I'm interested in using JFace, I need to add
>> dependencies for SWT (per platform) and the Eclipse RCP.  Hope it doesn't
>> turn out to consume a disproportionate amount of storage space/download
>> time.
>>
>> Incidentally, another reason for me evaluating all this stuff is that -- as
>> Linux GTK is a target -- getting something reasonable on Linux (as Swing GTK
>> isn't great for font rendering, and Linux/JavaFX doesn't seem a priority for
>> Oracle).
>>
>> Will try that out then.
>>
>> Thanks,
>> Christopher
>>
>>
>>
>> On 24 October 2011 01:51, Ken Gilmer <kg...@buglabs.net> wrote:
>>
>>> Hi Christopher,
>>>
>>>  I currently am not using SWT in any OSGi projects but have seen several
>>> SWT/OSGi apps in the past.  I was easily able to get a JFace dialog to
>>> display via my own bundle.  I used Eclipse to first create an equinox-based
>>> bundle that showed the dialog, then used PDE to strip away the
>>> Equinox/Eclipse stuff until I found that a SWT/JFace bundle requires these
>>> packages:
>>>
>>> org.eclipse.jface.dialogs,
>>>  org.eclipse.jface.window,
>>>  org.eclipse.jface.resource,
>>>  org.eclipse.swt.layout,
>>>  org.eclipse.swt.graphics,
>>>  org.eclipse.swt.widgets,
>>>  org.osgi.framework
>>>
>>>  I then let PDE launch resolve those into the bundles distributed with
>>> Eclipse 3.6 for Linux (x86):
>>>
>>> org.eclipse.core.commands_3.6.0.I20100512-1500.jar
>>> org.eclipse.equinox.common_3.6.0.v20100503.jar
>>> org.eclipse.jface_3.6.2.M20110210-1200.jar
>>> org.eclipse.osgi_3.6.2.R36x_v20110210.jar
>>> org.eclipse.swt_3.6.2.v3659c.jar
>>> org.eclipse.swt.gtk.linux.x86_3.6.2.v3659b.jar
>>> pt_1.0.0.201110240834.jar  (my test bundle)
>>>
>>> I then used knapsack (my pet project) to quickly launch Felix with the
>>> above
>>> bundles and was able to see an SWT Shell and JFace dialog.
>>>
>>> This would probably be enough to get started and I imagine it would not be
>>> too difficult to strip out the org.eclipse.equinox.common,
>>> org.eclipse.osgi,
>>> and org.eclipse.core.commands bundles from JFace to lessen the dependencies
>>> further.  Regarding platform support, you'd just need to include the SWT
>>> bundle for whatever platform you were targeting, for me
>>> it's org.eclipse.swt.gtk.linux.x86.
>>>
>>> hth,
>>> ken
>>>
>>>
>>>
>>>
>>> On Mon, Oct 24, 2011 at 5:54 AM, Christopher BROWN <br...@reflexe.fr>
>>> wrote:
>>>
>>> > Hello,
>>> >
>>> > Having developed with Java Swing for a long time, and having seen that
>>> > Oracle seem to have decided to place Swing into "maintenance mode" (with
>>> > emphasis going to JavaFX, which doesn't yet seem very cross-platform and
>>> > doesn't have anything like native UI widgets), I'm currently
>>> investigating
>>> > whether I can find the functionality I need by moving to SWT.
>>> >
>>> > At this point, I don't want the full Eclipse RCP platform (I don't
>>> actually
>>> > like Eclipse as an IDE, I prefer IntelliJ, but that's got nothing to do
>>> > with
>>> > my decision process here).  I figured that SWT on its own, along with
>>> > JFace,
>>> > seems like a good fit.
>>> >
>>> > However, I'm not really sure what the best approach is with regards to
>>> > using
>>> > that in Felix.  I'm running Felix in embedded mode (so no interactive
>>> > shell)
>>> > and would welcome advice as to how I might load SWT as an OSGi bundle (or
>>> > in
>>> > the system classpath) in an application primarily targeting Windows,
>>> Linux,
>>> > and Mac OS.  I've seen (vague, no detail) tips about splitting up SWT
>>> into
>>> > a
>>> > JAR and using fragments for platform-specific stuff, but I'm not sure how
>>> > to
>>> > perform this splitting and how to select which fragment to load
>>> (remember,
>>> > I'm not expecting users to mess around with an interactive shell to set
>>> it
>>> > up, I aim to provide a "It Just Works" type of experience).
>>> >
>>> > Furthermore, it appears that JFace requires the Equinox OSGi runtime from
>>> > the documentation.  If this is the case, does that rule out JFace/SWT
>>> from
>>> > within Felix?
>>> >
>>> > Thanks for feedback and advice,
>>> > Christopher
>>> >
>>>
>>>
>>>
>>> --
>>> thx
>>> ken
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Using SWT and JFace with Apache Felix

Posted by Neil Bartlett <nj...@gmail.com>.
Actually you can run SWT/JFace in Felix with the following bundles
(tested with Felix 4.0.0).

org.eclipse.swt (core plus native fragment for your platform)
org.eclipse.jface
org.eclipse.core.commands
org.eclipse.equinox.common
org.eclipse.equinox.supplement

Note that although two of these bundles contain the name Equinox, they
are not the Equinox framework itself, just plain bundles. The largest
one in terms of storage space is the SWT native fragment at around 2Mb
(for Mac OSX Cocoa x86_64... other native fragments may vary in size).

Don't pay any attention to the documentation that tells you that you
need the whole of Eclipse RCP, it is just plain wrong.

Regards,
Neil

PS: the problem with your bundle list was that PDE selected
"org.eclipse.osgi" (i.e. the main Equinox framework) as a provider of
org.osgi.framework. So you actually ended up with Equinox running as a
bundle inside Felix... this is not necessary, fortunately ;-)




On Mon, Oct 24, 2011 at 6:53 AM, Christopher BROWN <br...@reflexe.fr> wrote:
> Hi Ken,
>
> That does indeed help.
>
> I'm guessing that "org.eclipse.equinox.common" and "org.eclipse.osgi" bundle
> dependencies suggest that JFace has implementation-specific dependencies
> (using utility classes packaged with framework implementation).  I've tried
> some quick searching and the best I could find is
> http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Foverview-summary.htmlwhich
> suggests that if I'm interested in using JFace, I need to add
> dependencies for SWT (per platform) and the Eclipse RCP.  Hope it doesn't
> turn out to consume a disproportionate amount of storage space/download
> time.
>
> Incidentally, another reason for me evaluating all this stuff is that -- as
> Linux GTK is a target -- getting something reasonable on Linux (as Swing GTK
> isn't great for font rendering, and Linux/JavaFX doesn't seem a priority for
> Oracle).
>
> Will try that out then.
>
> Thanks,
> Christopher
>
>
>
> On 24 October 2011 01:51, Ken Gilmer <kg...@buglabs.net> wrote:
>
>> Hi Christopher,
>>
>>  I currently am not using SWT in any OSGi projects but have seen several
>> SWT/OSGi apps in the past.  I was easily able to get a JFace dialog to
>> display via my own bundle.  I used Eclipse to first create an equinox-based
>> bundle that showed the dialog, then used PDE to strip away the
>> Equinox/Eclipse stuff until I found that a SWT/JFace bundle requires these
>> packages:
>>
>> org.eclipse.jface.dialogs,
>>  org.eclipse.jface.window,
>>  org.eclipse.jface.resource,
>>  org.eclipse.swt.layout,
>>  org.eclipse.swt.graphics,
>>  org.eclipse.swt.widgets,
>>  org.osgi.framework
>>
>>  I then let PDE launch resolve those into the bundles distributed with
>> Eclipse 3.6 for Linux (x86):
>>
>> org.eclipse.core.commands_3.6.0.I20100512-1500.jar
>> org.eclipse.equinox.common_3.6.0.v20100503.jar
>> org.eclipse.jface_3.6.2.M20110210-1200.jar
>> org.eclipse.osgi_3.6.2.R36x_v20110210.jar
>> org.eclipse.swt_3.6.2.v3659c.jar
>> org.eclipse.swt.gtk.linux.x86_3.6.2.v3659b.jar
>> pt_1.0.0.201110240834.jar  (my test bundle)
>>
>> I then used knapsack (my pet project) to quickly launch Felix with the
>> above
>> bundles and was able to see an SWT Shell and JFace dialog.
>>
>> This would probably be enough to get started and I imagine it would not be
>> too difficult to strip out the org.eclipse.equinox.common,
>> org.eclipse.osgi,
>> and org.eclipse.core.commands bundles from JFace to lessen the dependencies
>> further.  Regarding platform support, you'd just need to include the SWT
>> bundle for whatever platform you were targeting, for me
>> it's org.eclipse.swt.gtk.linux.x86.
>>
>> hth,
>> ken
>>
>>
>>
>>
>> On Mon, Oct 24, 2011 at 5:54 AM, Christopher BROWN <br...@reflexe.fr>
>> wrote:
>>
>> > Hello,
>> >
>> > Having developed with Java Swing for a long time, and having seen that
>> > Oracle seem to have decided to place Swing into "maintenance mode" (with
>> > emphasis going to JavaFX, which doesn't yet seem very cross-platform and
>> > doesn't have anything like native UI widgets), I'm currently
>> investigating
>> > whether I can find the functionality I need by moving to SWT.
>> >
>> > At this point, I don't want the full Eclipse RCP platform (I don't
>> actually
>> > like Eclipse as an IDE, I prefer IntelliJ, but that's got nothing to do
>> > with
>> > my decision process here).  I figured that SWT on its own, along with
>> > JFace,
>> > seems like a good fit.
>> >
>> > However, I'm not really sure what the best approach is with regards to
>> > using
>> > that in Felix.  I'm running Felix in embedded mode (so no interactive
>> > shell)
>> > and would welcome advice as to how I might load SWT as an OSGi bundle (or
>> > in
>> > the system classpath) in an application primarily targeting Windows,
>> Linux,
>> > and Mac OS.  I've seen (vague, no detail) tips about splitting up SWT
>> into
>> > a
>> > JAR and using fragments for platform-specific stuff, but I'm not sure how
>> > to
>> > perform this splitting and how to select which fragment to load
>> (remember,
>> > I'm not expecting users to mess around with an interactive shell to set
>> it
>> > up, I aim to provide a "It Just Works" type of experience).
>> >
>> > Furthermore, it appears that JFace requires the Equinox OSGi runtime from
>> > the documentation.  If this is the case, does that rule out JFace/SWT
>> from
>> > within Felix?
>> >
>> > Thanks for feedback and advice,
>> > Christopher
>> >
>>
>>
>>
>> --
>> thx
>> ken
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Using SWT and JFace with Apache Felix

Posted by Christopher BROWN <br...@reflexe.fr>.
Hi Ken,

That does indeed help.

I'm guessing that "org.eclipse.equinox.common" and "org.eclipse.osgi" bundle
dependencies suggest that JFace has implementation-specific dependencies
(using utility classes packaged with framework implementation).  I've tried
some quick searching and the best I could find is
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Foverview-summary.htmlwhich
suggests that if I'm interested in using JFace, I need to add
dependencies for SWT (per platform) and the Eclipse RCP.  Hope it doesn't
turn out to consume a disproportionate amount of storage space/download
time.

Incidentally, another reason for me evaluating all this stuff is that -- as
Linux GTK is a target -- getting something reasonable on Linux (as Swing GTK
isn't great for font rendering, and Linux/JavaFX doesn't seem a priority for
Oracle).

Will try that out then.

Thanks,
Christopher



On 24 October 2011 01:51, Ken Gilmer <kg...@buglabs.net> wrote:

> Hi Christopher,
>
>  I currently am not using SWT in any OSGi projects but have seen several
> SWT/OSGi apps in the past.  I was easily able to get a JFace dialog to
> display via my own bundle.  I used Eclipse to first create an equinox-based
> bundle that showed the dialog, then used PDE to strip away the
> Equinox/Eclipse stuff until I found that a SWT/JFace bundle requires these
> packages:
>
> org.eclipse.jface.dialogs,
>  org.eclipse.jface.window,
>  org.eclipse.jface.resource,
>  org.eclipse.swt.layout,
>  org.eclipse.swt.graphics,
>  org.eclipse.swt.widgets,
>  org.osgi.framework
>
>  I then let PDE launch resolve those into the bundles distributed with
> Eclipse 3.6 for Linux (x86):
>
> org.eclipse.core.commands_3.6.0.I20100512-1500.jar
> org.eclipse.equinox.common_3.6.0.v20100503.jar
> org.eclipse.jface_3.6.2.M20110210-1200.jar
> org.eclipse.osgi_3.6.2.R36x_v20110210.jar
> org.eclipse.swt_3.6.2.v3659c.jar
> org.eclipse.swt.gtk.linux.x86_3.6.2.v3659b.jar
> pt_1.0.0.201110240834.jar  (my test bundle)
>
> I then used knapsack (my pet project) to quickly launch Felix with the
> above
> bundles and was able to see an SWT Shell and JFace dialog.
>
> This would probably be enough to get started and I imagine it would not be
> too difficult to strip out the org.eclipse.equinox.common,
> org.eclipse.osgi,
> and org.eclipse.core.commands bundles from JFace to lessen the dependencies
> further.  Regarding platform support, you'd just need to include the SWT
> bundle for whatever platform you were targeting, for me
> it's org.eclipse.swt.gtk.linux.x86.
>
> hth,
> ken
>
>
>
>
> On Mon, Oct 24, 2011 at 5:54 AM, Christopher BROWN <br...@reflexe.fr>
> wrote:
>
> > Hello,
> >
> > Having developed with Java Swing for a long time, and having seen that
> > Oracle seem to have decided to place Swing into "maintenance mode" (with
> > emphasis going to JavaFX, which doesn't yet seem very cross-platform and
> > doesn't have anything like native UI widgets), I'm currently
> investigating
> > whether I can find the functionality I need by moving to SWT.
> >
> > At this point, I don't want the full Eclipse RCP platform (I don't
> actually
> > like Eclipse as an IDE, I prefer IntelliJ, but that's got nothing to do
> > with
> > my decision process here).  I figured that SWT on its own, along with
> > JFace,
> > seems like a good fit.
> >
> > However, I'm not really sure what the best approach is with regards to
> > using
> > that in Felix.  I'm running Felix in embedded mode (so no interactive
> > shell)
> > and would welcome advice as to how I might load SWT as an OSGi bundle (or
> > in
> > the system classpath) in an application primarily targeting Windows,
> Linux,
> > and Mac OS.  I've seen (vague, no detail) tips about splitting up SWT
> into
> > a
> > JAR and using fragments for platform-specific stuff, but I'm not sure how
> > to
> > perform this splitting and how to select which fragment to load
> (remember,
> > I'm not expecting users to mess around with an interactive shell to set
> it
> > up, I aim to provide a "It Just Works" type of experience).
> >
> > Furthermore, it appears that JFace requires the Equinox OSGi runtime from
> > the documentation.  If this is the case, does that rule out JFace/SWT
> from
> > within Felix?
> >
> > Thanks for feedback and advice,
> > Christopher
> >
>
>
>
> --
> thx
> ken
>

Re: Using SWT and JFace with Apache Felix

Posted by Ken Gilmer <kg...@buglabs.net>.
Hi Christopher,

  I currently am not using SWT in any OSGi projects but have seen several
SWT/OSGi apps in the past.  I was easily able to get a JFace dialog to
display via my own bundle.  I used Eclipse to first create an equinox-based
bundle that showed the dialog, then used PDE to strip away the
Equinox/Eclipse stuff until I found that a SWT/JFace bundle requires these
packages:

org.eclipse.jface.dialogs,
 org.eclipse.jface.window,
 org.eclipse.jface.resource,
 org.eclipse.swt.layout,
 org.eclipse.swt.graphics,
 org.eclipse.swt.widgets,
 org.osgi.framework

  I then let PDE launch resolve those into the bundles distributed with
Eclipse 3.6 for Linux (x86):

org.eclipse.core.commands_3.6.0.I20100512-1500.jar
org.eclipse.equinox.common_3.6.0.v20100503.jar
org.eclipse.jface_3.6.2.M20110210-1200.jar
org.eclipse.osgi_3.6.2.R36x_v20110210.jar
org.eclipse.swt_3.6.2.v3659c.jar
org.eclipse.swt.gtk.linux.x86_3.6.2.v3659b.jar
pt_1.0.0.201110240834.jar  (my test bundle)

I then used knapsack (my pet project) to quickly launch Felix with the above
bundles and was able to see an SWT Shell and JFace dialog.

This would probably be enough to get started and I imagine it would not be
too difficult to strip out the org.eclipse.equinox.common, org.eclipse.osgi,
and org.eclipse.core.commands bundles from JFace to lessen the dependencies
further.  Regarding platform support, you'd just need to include the SWT
bundle for whatever platform you were targeting, for me
it's org.eclipse.swt.gtk.linux.x86.

hth,
ken




On Mon, Oct 24, 2011 at 5:54 AM, Christopher BROWN <br...@reflexe.fr> wrote:

> Hello,
>
> Having developed with Java Swing for a long time, and having seen that
> Oracle seem to have decided to place Swing into "maintenance mode" (with
> emphasis going to JavaFX, which doesn't yet seem very cross-platform and
> doesn't have anything like native UI widgets), I'm currently investigating
> whether I can find the functionality I need by moving to SWT.
>
> At this point, I don't want the full Eclipse RCP platform (I don't actually
> like Eclipse as an IDE, I prefer IntelliJ, but that's got nothing to do
> with
> my decision process here).  I figured that SWT on its own, along with
> JFace,
> seems like a good fit.
>
> However, I'm not really sure what the best approach is with regards to
> using
> that in Felix.  I'm running Felix in embedded mode (so no interactive
> shell)
> and would welcome advice as to how I might load SWT as an OSGi bundle (or
> in
> the system classpath) in an application primarily targeting Windows, Linux,
> and Mac OS.  I've seen (vague, no detail) tips about splitting up SWT into
> a
> JAR and using fragments for platform-specific stuff, but I'm not sure how
> to
> perform this splitting and how to select which fragment to load (remember,
> I'm not expecting users to mess around with an interactive shell to set it
> up, I aim to provide a "It Just Works" type of experience).
>
> Furthermore, it appears that JFace requires the Equinox OSGi runtime from
> the documentation.  If this is the case, does that rule out JFace/SWT from
> within Felix?
>
> Thanks for feedback and advice,
> Christopher
>



-- 
thx
ken