org.eclipse.gef.KeyStroke Java Examples

The following examples show how to use org.eclipse.gef.KeyStroke. 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: TableCellKeyDelegate.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Default Constuctor.
 */
public TableCellKeyDelegate( GraphicalViewer viewer,ActionRegistry actionRegistry  )
{
	super( viewer );
	//this.actionRegistry = actionRegistry;
	put( KeyStroke.getPressed('r', 114, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectRowAction.ID) );
	put( KeyStroke.getPressed('R', 114, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectRowAction.ID) );
	
	put( KeyStroke.getPressed('c', 99, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectColumnAction.ID) );
	put( KeyStroke.getPressed('C', 99, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectColumnAction.ID) );

}
 
Example #2
Source File: ReportViewerKeyHandler.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor of KeyHandler
 * 
 * @param viewer
 * @param actionRegistry
 */
public ReportViewerKeyHandler( GraphicalViewer viewer,
		ActionRegistry actionRegistry )
{
	super( viewer );
	this.actionRegistry = actionRegistry;

	put( KeyStroke.getPressed( SWT.F2, 0 ),
			actionRegistry.getAction( GEFActionConstants.DIRECT_EDIT ) );
	tableDelgate = new TableCellKeyDelegate( viewer, actionRegistry );
}
 
Example #3
Source File: ReportViewerKeyHandler.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Bounds actions with key events
 * 
 * @param character
 * @param keyCode
 * @param stateMask
 * @param actionID
 */
public void put( char character, int keyCode, int stateMask, String actionID )
{
	IAction action = actionRegistry.getAction( actionID );
	if ( action != null )
	{
		put( KeyStroke.getReleased( character, keyCode, stateMask ), action );
	}
}
 
Example #4
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 #5
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 #6
Source File: GraphicalViewerKeyHandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void put( KeyStroke keystroke, IAction action )
{
	super.put( keystroke, action );
}
 
Example #7
Source File: GraphicalViewerKeyHandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void remove( KeyStroke keystroke )
{
	super.remove( keystroke );
}