Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Possible to use GEF outside of Eclipse?

I would like to use GEF in my non-eclipse application and am having a really difficult time finding documentation on how to properly initialize things.  I found the standalone logic design example, however it's for an earlier version of GEF and doesn't work.  Currently my setup code looks like this (I'm starting with the shape editor).  The problem seems to be when I try and create a PaletteViewer.

  private static void setupApp(final Canvas c) {

    // model
    final ShapesDiagram model = new ShapesDiagram();
    model.addChild(new EllipticalShape());
    model.addChild(new RectangularShape());
    
    // editparts
    final EditPartFactory editPartFactory = new ShapesEditPartFactory();
    final EditPart topEditPart = editPartFactory.createEditPart(null, model);
    topEditPart.setModel(model);
    
    // edit area		
    final ShapesEditor editor = new ShapesEditor();
    
    //editor.init(site);
    
    final Canvas editorCanvas = new Canvas(c, SWT.NONE);
    final GridData gd2 = new GridData();
    editorCanvas.setLayoutData(gd2);
    gd2.heightHint = c.getClientArea().height;
    gd2.widthHint = c.getClientArea().width-200;


    //final EditorSite site = new EditorSite(editorReference, editor, manager.page, descr);
    //part.init(site);
    
    //editor.createPartControl(editorCanvas);

    
    //gvi.setControl(editorCanvas);
    //gvi.setContents(ldep);

    // edit domain
    final EditDomain editDomain = editor.getEditDomain();
  
    // palette 
    final PaletteRoot paletteRoot = ShapesEditorPaletteFactory.createPalette();
    editDomain.setPaletteRoot(paletteRoot);

    final Canvas palette = new Canvas(c, SWT.NONE);
    final GridData gd3 = new GridData();
    gd3.heightHint = c.getClientArea().height;
    gd3.widthHint = 200;
    palette.setLayoutData(gd3);
    //new GEFPlugin(); // do this to initialize preferences that the PaletteViewer constructor relies upon
//     System.out.println(GEFPlugin.getDefault().getBundle());
    final PaletteViewer pvi = new PaletteViewer();
    pvi.setControl(palette);
    editDomain.setPaletteViewer(pvi);
    
    //final GraphicalViewer gvi = editor.getGraphicalViewer();
    final GraphicalViewer gvi = new GraphicalViewerImpl();
    gvi.setEditPartFactory(editPartFactory);
    gvi.setRootEditPart(new ScalableFreeformRootEditPart());
    gvi.setControl(editorCanvas);
    gvi.setEditDomain(editDomain);
    gvi.setContents(topEditPart);
    
    //editor.configureGraphicalViewer();
    //editor.initializeGraphicalViewer();
    
  }



http://lug.htc.honeywell.com/people/jschewe [Honeywell Intranet Only]
*My views may not represent those of my employers

Attachment: smime.p7s
Description: S/MIME cryptographic signature


Back to the top