Reuse editor (to avoid recreating OpenGL and loading shared resources)

Answered

I have an editor (it is in fact a viewer, but I have implemented it as an editor, because I did not find another way) which creates an OpenGL context and uses it to render view of the files storing 3D models.

The 3D context takes quite long to create, and many assets are shared between the models. I would like to reuse the same editor or the 3D rendering component. However following did not work:

The most heavyweight is an AWT Component doing the OpenGL rendering, based on `AWTGLCanvas`

- I tried to remove and store the the component instead of disposing it when the editor panels are disposing. This did not work, as when calling `panel.remove(openGLComponent)` there is a call to `createScreenSurface` made from `setGraphicsConfiguration`, which crashes, as some `gc` variable is null at that point

- I tried to store the whole editor in `FileEditorProvider.disposeEditor` instead of disposing it. The editor still seems to be partially disposed by the IDE, as `disposeComposite` is always called at it.

Is there some way how to keep an `AWT Component` living while the editor is closed, so that I can use it for another editor once it is open, or to reuse the whole editor when a different file is loaded?

0
1 comment

Unfortunately, it is not possible to reuse Editor instances.

0

Please sign in to leave a comment.