use of org.eclipse.gef.editparts.ZoomManager in project yamcs-studio by yamcs.
the class PartZoomAction method setPart.
/**
* @param part a part which must have a ZoomManager Adapter.
*/
public void setPart(IWorkbenchPart part) {
if (this.part == part)
return;
this.part = part;
if (zoomManager != null)
zoomManager.removeZoomListener(this);
ZoomManager newZoomManager = part.getAdapter(ZoomManager.class);
if (newZoomManager != null) {
newZoomManager.addZoomListener(this);
zoomManager = newZoomManager;
}
}
use of org.eclipse.gef.editparts.ZoomManager in project yamcs-studio by yamcs.
the class PartZoomComboContributionItem method setPart.
/**
* @param part a part which must have a ZoomManager Adapter.
*/
public void setPart(IWorkbenchPart part) {
if (this.part == part)
return;
this.part = part;
ZoomManager newZoomManager = part.getAdapter(ZoomManager.class);
if (newZoomManager != null) {
setZoomManager(newZoomManager);
}
}
use of org.eclipse.gef.editparts.ZoomManager in project webtools.sourceediting by eclipse.
the class CommonMultiPageEditor method configureGraphicalViewer.
protected void configureGraphicalViewer() {
graphicalViewer.getControl().setBackground(ColorConstants.listBackground);
// Set the root edit part
// ScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();
RootEditPart root = new RootEditPart();
ZoomManager zoomManager = root.getZoomManager();
List zoomLevelContributions = new ArrayList(3);
zoomLevelContributions.add(ZoomManager.FIT_ALL);
zoomLevelContributions.add(ZoomManager.FIT_WIDTH);
zoomLevelContributions.add(ZoomManager.FIT_HEIGHT);
zoomManager.setZoomLevelContributions(zoomLevelContributions);
double[] zoomLevels = { .10, .25, .5, .75, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5 };
zoomManager.setZoomLevels(zoomLevels);
IAction zoomIn = new ZoomInAction(zoomManager);
IAction zoomOut = new ZoomOutAction(zoomManager);
getActionRegistry().registerAction(zoomIn);
getActionRegistry().registerAction(zoomOut);
getSite().getKeyBindingService().registerAction(zoomIn);
getSite().getKeyBindingService().registerAction(zoomOut);
// ConnectionLayer connectionLayer = (ConnectionLayer) root.getLayer(LayerConstants.CONNECTION_LAYER);
// connectionLayer.setConnectionRouter(new BendpointConnectionRouter());
// connectionLayer.setConnectionRouter(new ShortestPathConnectionRouter(connectionLayer));
// connectionLayer.setVisible(false);
// Zoom
zoomManager.setZoom(1.0);
// Scroll-wheel Zoom
graphicalViewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);
graphicalViewer.setRootEditPart(root);
graphicalViewer.setEditPartFactory(getEditPartFactory());
}
use of org.eclipse.gef.editparts.ZoomManager in project whole by wholeplatform.
the class E4GraphicalViewer method createRootEditPart.
protected RootEditPart createRootEditPart() {
RootEditPart rootEditPart = new RootEditPart();
List<String> levels = new ArrayList<String>(3);
levels.add(ZoomManager.FIT_ALL);
levels.add(ZoomManager.FIT_WIDTH);
levels.add(ZoomManager.FIT_HEIGHT);
ZoomManager zoomManager = rootEditPart.getZoomManager();
zoomManager.setZoomLevelContributions(levels);
zoomManager.setZoomAnimationStyle(ZoomManager.ANIMATE_ZOOM_IN_OUT);
return rootEditPart;
}
use of org.eclipse.gef.editparts.ZoomManager in project dbeaver by dbeaver.
the class ERDEditorPart method configureGraphicalViewer.
@Override
protected void configureGraphicalViewer() {
super.configureGraphicalViewer();
this.getGraphicalViewer().getControl().setBackground(UIUtils.getColorRegistry().get(ERDUIConstants.COLOR_ERD_DIAGRAM_BACKGROUND));
GraphicalViewer graphicalViewer = getGraphicalViewer();
/*
MenuManager manager = new MenuManager(getClass().getName(), getClass().getName());
manager.setRemoveAllWhenShown(true);
getEditorSite().registerContextMenu(getClass().getName() + ".EditorContext", manager, graphicalViewer, true); //$NON-NLS-1$
*/
DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED, store.getBoolean(ERDUIConstants.PREF_GRID_ENABLED));
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE, store.getBoolean(ERDUIConstants.PREF_GRID_ENABLED));
graphicalViewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension(store.getInt(ERDUIConstants.PREF_GRID_WIDTH), store.getInt(ERDUIConstants.PREF_GRID_HEIGHT)));
// initialize actions
createActions();
// Setup zoom manager
ZoomManager zoomManager = rootPart.getZoomManager();
List<String> zoomLevels = new ArrayList<>(3);
zoomLevels.add(ZoomManager.FIT_ALL);
zoomLevels.add(ZoomManager.FIT_WIDTH);
zoomLevels.add(ZoomManager.FIT_HEIGHT);
zoomManager.setZoomLevelContributions(zoomLevels);
zoomManager.setZoomLevels(new double[] { .1, .1, .2, .3, .5, .6, .7, .8, .9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.5, 3, 4 });
IAction zoomIn = new ZoomInAction(zoomManager);
IAction zoomOut = new ZoomOutAction(zoomManager);
addAction(zoomIn);
addAction(zoomOut);
graphicalViewer.addSelectionChangedListener(event -> {
String status;
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.isEmpty()) {
status = "";
} else if (selection.size() == 1) {
status = CommonUtils.toString(selection.getFirstElement());
} else {
status = selection.size() + " objects";
}
if (progressControl != null) {
progressControl.setInfo(status);
}
updateActions(editPartActionIDs);
});
}
Aggregations