• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

embedding a Processing Applet in SWT (Eclipse RCP), otherwise I'd need a text editor engine

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having difficulties on more than one level and I hope some Eclipse plugin specialists here can help. Maybe you can also learn something.

First off some motivation: I'm working on a tiny hobby framework for programming Pixelshaders and other scripts with immediate user feedback (pressing enter, see the result). I want to use Processing, which is based on Java Applets, as the media- and rendering-core. For example in a renderer-prototype I use the GLGraphics library for a simple high-level interface to OpenGL, later the Minim library will be used for possible music-visualization. The application which I have on my mind should allow the user to load, save and edit "preset" files, in which some parts will be plain text/code (especially shader language). Ideally the editor would be in a semi-transparent overlay over the renderer output. Unfortunately I have not found any text editor engines for Processing, so I was thinking of embedding the Applet into a component framework: One tab for the renderer, other tabs with the different (code) editors. After successfully embedding a simple sketch into a Swing window (tutorial) I came to the first hurdle: The OpenGL context could not be created like in the context of running it as an applet. Anyway, I spared out this problem and went one step further. If it was possible to run a Processing sketch in Swing, then how about SWT or an Eclipse-based client with a workbench, OSGi architecture, and ready-made code editors.
So I have created a new Plugin project in Eclipse, the basic rich client with a perspective and a view. I have also already found out how to embed Swing in SWT, which is working fine for 'hello world' labels, but:

No matter where I try to instantiate and initialize the Processing sketch class in the Eclipse-based application (may it be directly in the View class, or even in the Activator class) I get a full bunch of internally handled Eclipse exceptions. The applet doesn't even use OpenGL yet and it can be embedded in a Swing window without problems. Moreover the applet is not added to the GUI so far, the troubling line of code is a simple DummySketch sketch = new DummySketch(); sketch.init(); (where the init method starts the Processing-specific threads)

I guess it's only flicking the right switch at the right location but I'm clueless. Simply calling the init method from a new thread didn't work and I didn't find the answer in the first 15 minutes of searching, so I hoped I can find some help here.
In Swing I'd know how to dispatch an asynchronous call just like

Am I completely wrong or what is the equivalent code in SWT?

happy holidays, Felix
 
Felix Woitzel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
stupid me! interpreting stack traces is of advantage... I didn't place the Processing jar on the classpath description in the plugin.xml and the problem was that PApplet was unknown at runtime

That's it:
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic