[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| 
Re: [gef3d-dev] Reusing 3D components
 | 
Hi,
at the moment, there are no GEF3D viewpart implementations. I have 
written one for a sample application 
(http://jevopisdeveloperblog.blogspot.de/2011/06/its-full-of-classes.html ), 
though. If we are lucky, I will find a couple of minutes and copy these 
files to the GEF3D repository. Stay tuned ;-)
However, it is straight forward. Just follow the patterns used in the 
editorpart implementations, except using viewparts. Snippet from my 
viewpart:
public abstract class GraphicalViewPart3D extends ViewPart implements 
IViewPart {
    private GraphicalViewer3D graphicalViewer;
    private SelectionSynchronizer synchronizer;
    private ScenePreferenceDistributor scenePreferenceDistributor;
    @Override
    public void createPartControl(Composite i_parent) {
        GraphicalViewer3D viewer = new GraphicalViewer3DImpl();
        // 1:1 from GraphicalEditor.createGraphicalViewer(Composite),
        // instead of createControl, createControl3D is called!
        Control control = viewer.createControl3D(i_parent);
        setGraphicalViewer(viewer);
        configureGraphicalViewer();
        hookGraphicalViewer();
        initializeGraphicalViewer();
        control.addDisposeListener(viewer.getLightweightSystem3D());
        doRegisterToScene(viewer.getLightweightSystem3D());
    }
    protected abstract void initializeGraphicalViewer();
    protected void hookGraphicalViewer() {
        getSelectionSynchronizer().addViewer(getGraphicalViewer());
        getSite().setSelectionProvider(getGraphicalViewer());
    }
    protected SelectionSynchronizer getSelectionSynchronizer() {
        if (synchronizer == null)
            synchronizer = new SelectionSynchronizer();
        return synchronizer;
    }
    protected void configureGraphicalViewer() {
        graphicalViewer.getControl().setBackground(
            ColorConstants.listBackground);
    }
...
}
If you have more questions, better use the news forum
http://www.eclipse.org/forums/index.php/f/52/
as the mailing list is for internal GEF3D developer discussions only.
Regards,
Jens