org.eclipse.gef.KeyHandler Java Examples

The following examples show how to use org.eclipse.gef.KeyHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphConfig.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
void configureKeyHandler() {
	KeyHandler keyHandler = new KeyHandler();
	IAction delete = actionRegistry.getAction(org.eclipse.ui.actions.ActionFactory.DELETE.getId());
	IAction zoomIn = actionRegistry.getAction(GEFActionConstants.ZOOM_IN);
	IAction zoomOut = actionRegistry.getAction(GEFActionConstants.ZOOM_OUT);
	keyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), delete);
	keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0), zoomIn);
	keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0), zoomOut);
	viewer.setKeyHandler(keyHandler);
}
 
Example #2
Source File: SankeyDiagram.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();

	MenuManager menu = SankeyMenu.create(this);
	getGraphicalViewer().setContextMenu(menu);

	GraphicalViewer viewer = getGraphicalViewer();
	viewer.setEditPartFactory(new SankeyEditPartFactory());
	ScalableRootEditPart root = new ScalableRootEditPart();
	viewer.setRootEditPart(root);

	// append zoom actions to action registry
	ZoomManager zoom = root.getZoomManager();
	getActionRegistry().registerAction(new ZoomInAction(zoom));
	getActionRegistry().registerAction(new ZoomOutAction(zoom));
	zoom.setZoomLevelContributions(Arrays.asList(
			ZoomManager.FIT_ALL,
			ZoomManager.FIT_HEIGHT,
			ZoomManager.FIT_WIDTH));

	// create key handler
	KeyHandler keyHandler = new KeyHandler();
	keyHandler.put(KeyStroke.getPressed('+', SWT.KEYPAD_ADD, 0),
			getActionRegistry().getAction(GEFActionConstants.ZOOM_IN));
	keyHandler.put(KeyStroke.getPressed('-', SWT.KEYPAD_SUBTRACT, 0),
			getActionRegistry().getAction(GEFActionConstants.ZOOM_OUT));
	viewer.setKeyHandler(keyHandler);

	viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.NONE),
			MouseWheelZoomHandler.SINGLETON);
}
 
Example #3
Source File: GraphicalViewerKeyHandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public KeyHandler setParent( KeyHandler parent )
{
	return super.setParent( parent );
}
 
Example #4
Source File: ProcessDiagramEditor.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected KeyHandler getKeyHandler() {
	return new KeyHandler();
}
 
Example #5
Source File: BonitaTreeOutlinePage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @return
 */
private KeyHandler getKeyHandler() {
    return new KeyHandler();
}