[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Paint events in Composite

I am writing a program that has a rather elaborate "editor" akin to the PDE.
I have most of it working and am working on the last part of the UI.  I have
a FormPage which hosts a TabFolder which has one or more TabItems in it.
That all works fine.  Now I want to have various kinds of widgets hosted in
the Tabs.  One of them is my JOGL OpenGL view.  Normally I simply host it in
a ViewPart and then instantiate it thusly:

// we can't use the default Composite because using the AWT bridge

// requires that it have the property of SWT.EMBEDDED

Composite composite = new Composite(parent, SWT.EMBEDDED);

// set the layout so our canvas fills the whole control

composite.setLayout(new FillLayout());


// create the special frame bridge to AWT

java.awt.Frame glFrame = SWT_AWT.new_Frame(composite);


// we need the listener so we get the GL events

this.canvas.addGLEventListener(this);


// finally, add our canvas as a child of the frame
glFrame.add(this.canvas);

This all works fine.  I created a new class that subclasses Composite to
create a GLComposite.  I then create an instance of that:

CTabItem viewItem = new CTabItem(tabFolder.SWT.NULL);
Composite composite = new Composite(tabFolder, SWT.NONE);
GLComposite glView = new GLComposite(composite);
ViewItem.setControl(composite);

This all "works" fine - there are no exceptions thrown and I can debug
through my GL routines, but nothing gets painted on the tab.  And my GL
render only gets called if I explicitly call redraw on the glView object.

So... Any suggestions?  What is the proper approach to this?  I'll keep
poking at it, but any suggestions are welcome.

TIA, Ric