Thursday 23 October 2008

Geoff on GEF pt. II

So, carrying straight on from last night, I fixed the null pointer and now have an empty view displaying. The trouble is, as soon as I plugged in the listeners and updated the children of the EditPart when the model changed, I still get an empty view.

After some investigation I discovered that the following code can be used in a ViewPart to display a GEF diagram.


@Override
public void createPartControl(Composite parent) {
DefaultEditDomain defaultEditDomain = new DefaultEditDomain(null);

sgv = new ScrollingGraphicalViewer();

defaultEditDomain.addViewer(sgv);
sgv.createControl(parent);
ScalableRootEditPart sffrep = new ScalableRootEditPart();
sgv.setRootEditPart(sffrep);
sgv.setEditPartFactory(new TournamentEditPartFactory());

sgv.getControl().setBackground(ColorConstants.listBackground);

initView();
}

private void initView() {
sgv.setContents(TournamentManager.get());
}


However, my diagram is still not displaying as expected...

No comments: