Java Code Examples for org.eclipse.swt.SWT#TRAVERSE_NONE

The following examples show how to use org.eclipse.swt.SWT#TRAVERSE_NONE . 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: HistoryMinibuffer.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Disable eclipse traversal event, and dispatch into our Alt/Ctrl
 * handlers in place of it
 * 
 * @param e the trapped TraverseEvent
 */
protected void handleTraverseEvent(TraverseEvent e) {
	// setting detail to NONE but doit=true disables further processing
	e.detail = SWT.TRAVERSE_NONE;
	e.doit = true;

	Event ee = new Event();
	ee.character = e.character;
	ee.doit = true;
	ee.stateMask = (e.stateMask & SWT.MODIFIER_MASK);
	ee.keyCode = e.keyCode;

	ee.display = e.display;
	ee.widget = e.widget;	// will throw an exception if not valid
	ee.time = e.time;
	ee.data = e.data;

	switch (ee.stateMask) {
		case SWT.CONTROL:	// Emacs+ key binding forces CTRL 
			dispatchCtrl(new VerifyEvent(ee));
			break;
		case SWT.ALT:	// AFAIK MOD3 is always ALT
			dispatchAlt(new VerifyEvent(ee));
			break;
	}
}
 
Example 2
Source File: UniversalMinibuffer.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
public void handleEvent(Event event) {
	boolean check = checkKey(event.stateMask, event.keyCode, event.character);
	if (check && isUniversalBinding()) {
		// clear key cache
		resetKeys();
		// check for binding of the form M-1 etc.
		if (Character.isDigit(event.character)) {
			addToCount(event.character);
		} else if (isMinus(event)) {
			resetToMinus(event.keyCode, event.stateMask);
		} else {
			// reset count
			processUniversal();
		}
		updatePrefix();
	} else if (processKey(check,event.keyCode)) {
		leave();
	}
	// setting detail to NONE but doit=true disables further processing
	event.type = SWT.None;
	event.detail = SWT.TRAVERSE_NONE;
	event.doit = true;
}
 
Example 3
Source File: ComponentStatusLabel.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * On mnemonic handler 
 *
 * @param event
 */
void onMnemonic(TraverseEvent event) {
    char mnemonic = _findMnemonic(text);
    if (mnemonic == '\0') return;
    if (Character.toLowerCase(event.character) != mnemonic) return;
    Composite control = this.getParent();
    while (control != null) {
        Control[] children = control.getChildren();
        int index = 0;
        while (index < children.length) {
            if (children[index] == this) break;
            index++;
        }
        index++;
        if (index < children.length) {
            if (children[index].setFocus()) {
                event.doit = true;
                event.detail = SWT.TRAVERSE_NONE;
            }
        }
        control = control.getParent();
    }
}
 
Example 4
Source File: InternalCompositeTable.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Handle the keyTraversed event on any child control in the table.
 * 
 * @param sender
 *            The row sending the event.
 * @param e
 *            The SWT TraverseEvent
 */
public void keyTraversed(TableRow sender, TraverseEvent e) {
	if (doMakeFocusedRowVisible()) return;

	if (parent.isTraverseOnTabsEnabled()) {
		if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
			if (currentColumn >= sender.getNumColumns() - 1) {
				e.detail = SWT.TRAVERSE_NONE;
				handleNextRowNavigation();
			}
		} else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
			if (currentColumn == 0) {
				e.detail = SWT.TRAVERSE_NONE;
				handlePreviousRowNavigation(sender);
			}
		} else if (e.detail == SWT.TRAVERSE_RETURN) {
			e.detail = SWT.TRAVERSE_NONE;
			if (currentColumn >= sender.getNumColumns() - 1) {
				handleNextRowNavigation();
			} else {
				deferredSetFocus(getControl(currentColumn + 1, currentRow),
						false);
			}
		}
	} else {
		if (e.detail == SWT.TRAVERSE_TAB_NEXT) {
			if (currentColumn >= sender.getNumColumns() - 1) {
				e.detail = SWT.TRAVERSE_NONE;
			}
		} else if (e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
			if (currentColumn == 0) {
				e.detail = SWT.TRAVERSE_NONE;
			}
		}
	}
}
 
Example 5
Source File: KeybindingsManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void consumeEvent(Event event)
{
	switch (event.type)
	{
		case SWT.KeyDown:
			event.doit = false;
			break;
		case SWT.Traverse:
			event.detail = SWT.TRAVERSE_NONE;
			event.doit = true;
			break;
		default:
	}
	event.type = SWT.NONE;
}
 
Example 6
Source File: FindBarActions.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void consumeEvent(Event event)
{
	switch (event.type)
	{
		case SWT.KeyDown:
			event.doit = false;
			break;
		case SWT.Traverse:
			event.detail = SWT.TRAVERSE_NONE;
			event.doit = true;
			break;
		default:
	}
	event.type = SWT.NONE;
}
 
Example 7
Source File: AccordionLabel.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
void onMnemonic( TraverseEvent event )
{
	char mnemonic = _findMnemonic( text );
	if ( mnemonic == '\0' )
		return;
	if ( Character.toLowerCase( event.character ) != mnemonic )
		return;
	Composite control = this.getParent( );
	while ( control != null )
	{
		Control[] children = control.getChildren( );
		int index = 0;
		while ( index < children.length )
		{
			if ( children[index] == this )
				break;
			index++;
		}
		index++;
		if ( index < children.length )
		{
			if ( children[index].setFocus( ) )
			{
				event.doit = true;
				event.detail = SWT.TRAVERSE_NONE;
			}
		}
		control = control.getParent( );
	}
}
 
Example 8
Source File: KeyHandlerMinibuffer.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
public void handleEvent(Event event) {
	if (processKey(checkKey(event.stateMask, event.keyCode, event.character),event.keyCode)) {
		leave();
	}
	// setting detail to NONE but doit=true disables further processing
	event.type = SWT.None;
	event.detail = SWT.TRAVERSE_NONE;
	event.doit = true;
}