Embedding GWT into Eclipse/OSGi and accessing other Plugins/Bundles

30 views
Skip to first unread message

jastram

unread,
Oct 5, 2009, 4:03:43 PM10/5/09
to Google Web Toolkit
Howdy,

I am trying to build an Eclipse-Application with a GWT GUI, running in
an Editor or View (The idea is to build an application that can be
accessed as an Eclipse App with more features and as a Web App with
fewer features).

To achieve this, I created an Eclipse-Project with GWT-Nature and
Plugin-Nature. This works reasonable well, and I managed to display a
"Hello World" GWT-App in an Eclipse View. So far so good.

Next, I was trying to implement real functionality, and here I got
stuck: The business objects that I need to access reside in a
different Plugin than the GWT-Plugin. During development, I have no
problems (as Eclipse understands the Plugin-Architecture), but of
course, GWT doesn't. Thus, when I try to run the application (as a
Web App), or if I try to compile the GWT-Project, Eclipse complains
about not finding the classes from the other Plugins (which are
referenced through META-INF/MANIFEST.MF).

So here is my question: Is there an easy way to do what I am trying to
do? The emphasis is easy :-), If possible, I'd prefer avoiding to
write custom Runner/Compiler scripts.

Thanks in advance,

- Michael

Jason Parekh

unread,
Oct 5, 2009, 4:51:27 PM10/5/09
to google-we...@googlegroups.com
Hey Michael,

Sounds like a neat idea, kudos to getting the Hello World to work!  I'm curious how it's set up--I assume the Eclipse view showing the GWT app a browser-backed view?

Are the plugins you depend on separate projects in your workspace?  If so, you can add them as linked source folders to your main GWT+Plugin project.  If not, it'll be a bit more tricky.  You'll need the source of those plugins, and then you may be able to add that as source directories. 

jason

jastram

unread,
Oct 7, 2009, 2:34:17 PM10/7/09
to Google Web Toolkit
Hello Jason,

> Sounds like a neat idea, kudos to getting the Hello World to work!  I'm
> curious how it's set up--I assume the Eclipse view showing the GWT app a
> browser-backed view?

Yes, that was actually fairly easy. Here is the central code from the
ViewPart:

public void createPartControl(Composite parent) {
browser = new Browser(parent, SWT.FLAT);
int port = JettyRunner.getServerPort();
String url = "http://localhost:" + port + "/document";
browser.setUrl(url);
}

JettyRunner resides in another plugin for launching Jetty. The call
to getServerPort() triggers the loading of that plugin. So if the
view isn't shown, Jetty isn't started. JettyRunner then looks for a
free port, that's why I have to query for it.

> Are the plugins you depend on separate projects in your workspace?  If so,
> you can add them as linked source folders to your main GWT+Plugin project.
>  If not, it'll be a bit more tricky.  You'll need the source of those
> plugins, and then you may be able to add that as source directories.

I don't think it is that easy, unfortunately. I wrote some plugins
that reside in the workspace, but these in turn rely on others that do
not. For instance, I am using EMF to create and manage the value-
objects. These in turn rely on EMF-classes (e.g. EList, etc.) that
reside in the EMF-plugins.

I could do what you suggested - but that would be messy. Ideally, I
would like to take advantage of Eclipse to resolve all dependencies,
but I fear that this will be quite difficult. In fact, I did some
work with PDE-building, and it was not pretty. But I am afraid that
this is exactly what's required: A PDE environment for compiling
GWT. :-( And even if I manage that, I would loose the ability to
debug - unless I build a PDE environment for running in hosted mode in
addition to that!

Anyway, thank you for your response. Any other ideas...?

Best,

- Michael

Jason Parekh

unread,
Oct 7, 2009, 3:01:44 PM10/7/09
to google-we...@googlegroups.com
Gotcha, thanks for the explanation.  I worry that even if we can resolve all the dependencies, you'll probably run into one of your dependencies relying on some classes that GWT does not provide (for example, some of java.io).  I can't think of an easy way to avoid this except make your GWT code not rely on Eclipse-provided plugins (only the server-side stuff depending on Eclipse-provided plugins.)

jason
 
Best,

- Michael


jastram

unread,
Oct 7, 2009, 3:28:06 PM10/7/09
to Google Web Toolkit

> Gotcha, thanks for the explanation.  I worry that even if we can resolve all
> the dependencies, you'll probably run into one of your dependencies relying
> on some classes that GWT does not provide (for example, some of java.io).  I
> can't think of an easy way to avoid this except make your GWT code not rely
> on Eclipse-provided plugins (only the server-side stuff depending on
> Eclipse-provided plugins.)

... and that in turn means that I can forget using EMF, which is a
deal-breaker. What a pity, I really liked the idea of the OSGi/
Eclipse plugin-architecture on the back end, while having a powerful
web-gui-toolkit. Well, back to the drawing board. :-/

Cheers,

- Michael
Reply all
Reply to author
Forward
0 new messages