viewer.setEditPartFactory(new RecordPartFactory());
ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();
viewer.setRootEditPart(rootEditPart);
ZoomManager manager = rootEditPart.getZoomManager();
getActionRegistry().registerAction(new ZoomInAction(manager));
getActionRegistry().registerAction(new ZoomOutAction(manager));
zoomLevels = new double[] { 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2.0, 2.5, 3,
4, 5, 10 };
manager.setZoomLevels(zoomLevels);
manager.setZoom(1);
ArrayList<String> zoomContributions = new ArrayList<String>();
zoomContributions.add(ZoomManager.FIT_ALL);
zoomContributions.add(ZoomManager.FIT_HEIGHT);
zoomContributions.add(ZoomManager.FIT_WIDTH);
manager.setZoomLevelContributions(zoomContributions);
/*
* A workaround because - when embedded in a ViewPart - the SWT.DEL key
* is not recognized. This problem might be related to the GEF
* EditDomain, that should be hooked separately in the ViewPart.