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

The following examples show how to use org.eclipse.swt.SWT#ARROW_LEFT . These examples are extracted from open source projects. 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
void scrollViewer( KeyEvent event )
{
	if ( !( getViewer( ).getControl( ) instanceof FigureCanvas ) )
		return;
	FigureCanvas figCanvas = (FigureCanvas) getViewer( ).getControl( );
	Point loc = figCanvas.getViewport( ).getViewLocation( );
	Rectangle area = figCanvas.getViewport( )
			.getClientArea( Rectangle.SINGLETON )
			.scale( .1 );
	switch ( event.keyCode )
	{
		case SWT.ARROW_DOWN :
			figCanvas.scrollToY( loc.y + area.height );
			break;
		case SWT.ARROW_UP :
			figCanvas.scrollToY( loc.y - area.height );
			break;
		case SWT.ARROW_LEFT :
			figCanvas.scrollToX( loc.x - area.width );
			break;
		case SWT.ARROW_RIGHT :
			figCanvas.scrollToX( loc.x + area.width );
	}
}
 
Example 2
Source Project: nebula   File: Day.java    License: Eclipse Public License 2.0 6 votes vote down vote up
public void keyPressed(KeyEvent e) {
	switch (e.keyCode) {
		case SWT.ARROW_LEFT:
			if (monthPosition.x > 0) {
				traverse(SWT.TRAVERSE_TAB_PREVIOUS);
			}
			return;
		case SWT.ARROW_RIGHT:
			if (monthPosition.x < 6) {
				traverse(SWT.TRAVERSE_TAB_NEXT);
			}
			return;
		case SWT.TAB:
			if ((e.stateMask & SWT.SHIFT) != 0) {
				traverse(SWT.TRAVERSE_TAB_PREVIOUS);
				return;
			}
			traverse(SWT.TRAVERSE_TAB_NEXT);
			return;
	}
}
 
Example 3
/**
 * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
 */
@Override
public void keyReleased(KeyEvent e) {
  if (e.widget == mTableViewer.getTable()) {
    if (e.character == SWT.DEL || e.keyCode == SWT.ARROW_LEFT) {
      removeModule(mTableViewer.getSelection());
    }
  } else if (e.widget == mTreeViewer.getTree()) {
    if (e.keyCode == SWT.ARROW_RIGHT || e.character == ' ') {

      IStructuredSelection selection = (IStructuredSelection) mTreeViewer.getSelection();
      Object element = selection.getFirstElement();

      if (element instanceof RuleMetadata) {
        newModule(mTreeViewer.getSelection());
      }
    }
  } else if (e.widget == mTxtTreeFilter && e.keyCode == SWT.ARROW_DOWN) {
    mTreeViewer.getTree().forceFocus();
  }
}
 
Example 4
Source Project: tracecompass   File: ScrollView.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Add support for arrow key, scroll the ... scroll view. But you can
 * redefine this method for your convenience.
 *
 * @param event
 *            Keyboard event
 */
protected void keyPressedEvent(KeyEvent event) {
    switch (event.keyCode) {
    case SWT.ARROW_UP:
        scrollBy(0, -getVisibleHeight());
        break;
    case SWT.ARROW_DOWN:
        scrollBy(0, +getVisibleHeight());
        break;
    case SWT.ARROW_LEFT:
        scrollBy(-getVisibleWidth(), 0);
        break;
    case SWT.ARROW_RIGHT:
        scrollBy(+getVisibleWidth(), 0);
        break;
    default:
        break;
    }
}
 
Example 5
private boolean isModifierKey(int keyCode)
{
	// TODO Add more non alphanumeric keys we should skip!
	switch (keyCode)
	{
		case SWT.SHIFT:
		case SWT.BS:
		case SWT.CR:
		case SWT.DEL:
		case SWT.ESC:
		case SWT.LF:
		case SWT.TAB:
		case SWT.CTRL:
		case SWT.COMMAND:
		case SWT.ALT:
		case SWT.ARROW_DOWN:
		case SWT.ARROW_LEFT:
		case SWT.ARROW_RIGHT:
		case SWT.ARROW_UP:
			return true;
	}
	return false;
}
 
Example 6
@Test
public void should_findSelectedCell_call_super() throws Exception {
    final Event event = new Event();
    event.keyCode = SWT.ARROW_LEFT;
    cellNavigationStrategy.findSelectedCell(viewer, null, event);
    verify((CellNavigationStrategy) cellNavigationStrategy).findSelectedCell(viewer, null, event);

    cellNavigationStrategy.findSelectedCell(viewer, currentSelectedCell, event);
    verify((CellNavigationStrategy) cellNavigationStrategy).findSelectedCell(viewer, currentSelectedCell, event);
}
 
Example 7
Source Project: hop   File: HopGuiWorkflowGraph.java    License: Apache License 2.0 5 votes vote down vote up
@GuiToolbarElement(
  root = GUI_PLUGIN_TOOLBAR_PARENT_ID,
  id = TOOLBAR_ITEM_ALIGN_LEFT,
  toolTip = "Align the actions with the left-most action in your selection",
  image = "ui/images/toolbar/align-left.svg",
  disabledImage = "ui/images/toolbar/align-left-disabled.svg"
)
@GuiKeyboardShortcut( control = true, key = SWT.ARROW_LEFT )
@GuiOsxKeyboardShortcut( command = true, key = SWT.ARROW_LEFT )
public void alignLeft() {
  createSnapAllignDistribute().allignleft();
}
 
Example 8
boolean acceptScroll( KeyEvent event )
{
	return ( ( event.stateMask & SWT.CTRL ) != 0
			&& ( event.stateMask & SWT.SHIFT ) != 0 && ( event.keyCode == SWT.ARROW_DOWN
			|| event.keyCode == SWT.ARROW_LEFT
			|| event.keyCode == SWT.ARROW_RIGHT || event.keyCode == SWT.ARROW_UP ) );
}
 
Example 9
public void keyPressed(KeyEvent e) {
	switch (e.keyCode) {
		case SWT.ARROW_UP:
		case SWT.ARROW_DOWN:
		case SWT.ARROW_LEFT:
		case SWT.ARROW_RIGHT:
		case SWT.END:
		case SWT.HOME:
		case SWT.PAGE_DOWN:
		case SWT.PAGE_UP:
			handleSelectionChanged();
			break;
	}
}
 
Example 10
Source Project: nebula   File: DatePicker.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Traverse the selection programmatically just as a user would with the
 * keyboard.
 * <dt><b>Valid Keys:</b></dt>
 * <dd>SWT.ARROW_UP, SWT.ARROW_DOWN, SWT.ARROW_LEFT, SWT.ARROW_RIGHT</dd>
 *
 * @param keyCode
 *            a SWT traversal keycode
 * @see #scrollCalendar(int)
 */
void traverseSelection(int keyCode) {
    int focusDayButton = getFocusDayButton();
    switch (keyCode) {
    case SWT.ARROW_UP:
        if (focusDayButton > DAYS_IN_WEEK) {
            setButtonFocus(focusDayButton - DAYS_IN_WEEK);
        } else {
            scrollCalendar(SWT.ARROW_UP);
            setButtonFocus(focusDayButton);
        }
        break;
    case SWT.ARROW_DOWN:
        if (focusDayButton < DAYS_IN_WEEK * (NUM_ROWS - 1)) {
            setButtonFocus(focusDayButton + DAYS_IN_WEEK);
        } else {
            scrollCalendar(SWT.ARROW_DOWN);
        }
        break;
    case SWT.ARROW_LEFT:
        if (focusDayButton > 0) {
            setButtonFocus(focusDayButton - 1);
        } else {
            scrollCalendar(SWT.ARROW_UP);
            setButtonFocus(focusDayButton + DAYS_IN_WEEK - 1);
        }
        break;
    case SWT.ARROW_RIGHT:
        if (focusDayButton < DAYS_IN_WEEK * NUM_ROWS - 1) {
            setButtonFocus(focusDayButton + 1);
        } else {
            scrollCalendar(SWT.ARROW_DOWN);
            setButtonFocus(focusDayButton - (DAYS_IN_WEEK - 1));
        }
    }
}
 
Example 11
private void processKeyDown( int keyCode )
{
	switch ( keyCode )
	{
		case SWT.ESC :
			onDropDonwFocusOut( );
			break;
		case SWT.CR :
		case SWT.KEYPAD_CR :
			toggleCell( iRowAct, iColAct );
			break;
		case SWT.HOME :
			moveTo( 0, 0 );
			dropDown.redraw( );
			break;
		case SWT.END :
			moveTo( 7, 7 );
			dropDown.redraw( );
			break;
		case SWT.ARROW_LEFT :
			moveTo( iRowAct, iColAct - 1 );
			dropDown.redraw( );
			break;
		case SWT.ARROW_RIGHT :
			moveTo( iRowAct, iColAct + 1 );
			dropDown.redraw( );
			break;
		case SWT.ARROW_UP :
			moveTo( iRowAct - 1, iColAct );
			dropDown.redraw( );
			break;
		case SWT.ARROW_DOWN :
			moveTo( iRowAct + 1, iColAct );
			dropDown.redraw( );
			break;
	}

}
 
Example 12
private boolean scrollIncrement( GraphicalEditPart part, KeyEvent event )
{
	if ( ( event.stateMask & SWT.CONTROL ) == 0 )
	{
		return false;
	}
	if ( !( part.getViewer( ) instanceof DeferredGraphicalViewer ) )
	{
		return false;
	}
	DeferredGraphicalViewer viewer = (DeferredGraphicalViewer) part.getViewer( );
	FigureCanvas canvas = viewer.getFigureCanvas( );
	int code = event.keyCode;
	int increment = 0;
	if ( code == SWT.ARROW_RIGHT )
	{
		increment = canvas.getHorizontalBar( ).getSelection( )
				+ canvas.getHorizontalBar( ).getIncrement( );
	}
	else if ( code == SWT.ARROW_LEFT )
	{
		increment = canvas.getHorizontalBar( ).getSelection( )
				- canvas.getHorizontalBar( ).getIncrement( );
	}
	else if ( code == SWT.ARROW_DOWN )
	{
		increment = canvas.getVerticalBar( ).getSelection( )
				+ canvas.getVerticalBar( ).getIncrement( );
	}
	else if ( code == SWT.ARROW_UP )
	{
		increment = canvas.getVerticalBar( ).getSelection( )
				- canvas.getVerticalBar( ).getIncrement( );
	}

	if ( code == SWT.ARROW_RIGHT || code == SWT.ARROW_LEFT )
	{
		canvas.scrollToX( increment );
	}
	if ( code == SWT.ARROW_UP || code == SWT.ARROW_DOWN )
	{
		canvas.scrollToY( increment );
	}
	return true;

}
 
Example 13
Source Project: hop   File: GuiMenuWidgets.java    License: Apache License 2.0 4 votes vote down vote up
public static String getShortcutString( KeyboardShortcut shortcut ) {
  String s = shortcut.toString();
  if ( StringUtils.isEmpty( s ) || s.endsWith( "-" ) ) {
    // Unknown characters from the SWT library
    // We'll handle the special cases here.
    //
    int keyCode = shortcut.getKeyCode();
    if ( keyCode == SWT.BS ) {
      return s + "Backspace";
    }
    if ( keyCode == SWT.ESC ) {
      return s + "Esc";
    }
    if ( keyCode == SWT.ARROW_LEFT ) {
      return s + "LEFT";
    }
    if ( keyCode == SWT.ARROW_RIGHT ) {
      return s + "RIGHT";
    }
    if ( keyCode == SWT.ARROW_UP ) {
      return s + "UP";
    }
    if ( keyCode == SWT.ARROW_DOWN ) {
      return s + "DOWN";
    }
    if ( keyCode == SWT.HOME ) {
      return s + "HOME";
    }
    if ( keyCode == SWT.F1 ) {
      return s + "F1";
    }
    if ( keyCode == SWT.F2 ) {
      return s + "F2";
    }
    if ( keyCode == SWT.F3 ) {
      return s + "F3";
    }
    if ( keyCode == SWT.F4 ) {
      return s + "F4";
    }
    if ( keyCode == SWT.F5 ) {
      return s + "F5";
    }
    if ( keyCode == SWT.F6 ) {
      return s + "F6";
    }
    if ( keyCode == SWT.F7 ) {
      return s + "F7";
    }
    if ( keyCode == SWT.F8 ) {
      return s + "F8";
    }
    if ( keyCode == SWT.F9 ) {
      return s + "F9";
    }
    if ( keyCode == SWT.F10 ) {
      return s + "F10";
    }
    if ( keyCode == SWT.F11 ) {
      return s + "F11";
    }
    if ( keyCode == SWT.F12 ) {
      return s + "F12";
    }
  }
  return s;
}
 
Example 14
@Override
public void verifyKey(VerifyEvent event) {

    if (!event.doit)
        return;

    if (event.character == 0) {

        switch (event.keyCode) {

            case SWT.ARROW_DOWN:
                //special case: 
                //if there's a key dialog with a table shown, set its focus when down is pressed
                synchronized (lock) {
                    KeyAssistDialog tempKeyAssistDialog = this.keyAssistDialog;
                    if (tempKeyAssistDialog != null) {
                        Table completionsTable = this.keyAssistDialog.getCompletionsTable();
                        if (completionsTable != null && !completionsTable.isDisposed()) {
                            completionsTable.setFocus();
                            completionsTable.setSelection(0);
                            event.doit = false;
                            break;
                        }
                    }
                }
                // ALT, CTRL, ARROW_LEFT, ARROW_RIGHT == leave
            case SWT.ARROW_LEFT:
            case SWT.ARROW_RIGHT:
            case SWT.HOME:
            case SWT.END:
            case SWT.PAGE_DOWN:
            case SWT.PAGE_UP:
            case SWT.ARROW_UP:
                leave();
                break;

        }

        // event.character != 0
    } else {

        switch (event.character) {

        // ESC = quit
            case 0x1B:
                leave();
                event.doit = false;
                break;

            //CR = exec and quit
            case 0x0D:
                boolean executed = doExec();
                event.doit = false;
                if (!executed) {
                    return; //we don't want to update the status
                }
                break;

            // backspace    and delete
            case 0x08:
            case 0x7F:
                removeLastCharSearch();
                event.doit = false;
                break;

            default:
                if (event.stateMask == 0 || event.stateMask == SWT.SHIFT || event.stateMask == (SWT.ALT | SWT.CTRL)) { // SWT.ALT | SWT.CTRL covers AltGr (see bug 43049)
                    event.doit = false;
                    if (addCharSearch(event.character)) {
                        //ok, triggered some automatic action (does not need enter)
                        executed = doExec();
                        if (!executed) {
                            return; //we don't want to update the status
                        }

                    }
                }
                break;
        }
    }
    updateStatus();
}
 
Example 15
/**
     * Handle any key presses.
     * 
     * @param event key event
     */
    private void handleKeyPressed(KeyEvent event) {
        if ((event.stateMask & SWT.SHIFT) != 0 && Character.isISOControl(event.character)) {
            switch (event.keyCode) {
            case SWT.ARROW_RIGHT:
                selectRight();
                break;
            case SWT.ARROW_LEFT:
                selectLeft();
                break;
            case SWT.ARROW_DOWN:
                selectDown();
                break;
            case SWT.ARROW_UP:
                selectUp();
                break;

            default:
                // do nothing
                break;
            }
        } else if ((event.stateMask & SWT.CONTROL) != 0 && Character.isISOControl(event.character)) {
            // TODO keybindings hard coded is ok for now
            // System.out.println("keycode "+event.keyCode);
            switch (event.keyCode) {
            case 'c':
                copy();
                break;
            case 'x':
                cut();
                break;
            case 'v':
                paste();
                break;
            case 'a':
                selectAll();
                break;

            default:
                // do nothing
                break;
            }

        } else {
            _lastKeySelect = null;
            _firstKeySelect = null;

            switch (event.keyCode) {
            case SWT.ARROW_RIGHT:
                focusRight();
                break;
            case SWT.ARROW_LEFT:
                focusLeft();
                break;
            case SWT.ARROW_DOWN:
                focusDown();
                break;
            case SWT.ARROW_UP:
                focusUp();
                break;
            case SWT.TAB:
                focusRight();
                break;
            case SWT.F2:
//                startEditing(_focussedRow, _focussedColumn, (char) 0);
                break;

            default:
                if (event.character == ' ' && isHierarchyColumn(_focussedRow, _focussedColumn)) {
                    toggleExpanded(_focussedRow);
                } else if (!Character.isISOControl(event.character)) {
//                    startEditing(event.character);
                }
                // do nothing
                break;
            }
        }

    }
 
Example 16
Source Project: nebula   File: Launcher.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Code executed when a key is pressed
 *
 * @param event Event
 */
private void handleKeyPressedEvent(final Event event) {
	switch (event.keyCode) {
		case SWT.ARROW_LEFT:
			if (selection == -1) {
				selection = 0;
				changeColor(selection, true);
				return;
			}

			if (selection % 2 != 0) {
				changeColor(selection, false);
				selection--;
				changeColor(selection, true);
			}
			break;
		case SWT.ARROW_UP:
			if (selection == -1) {
				selection = 0;
				changeColor(selection, true);
				return;
			}
			if (selection >= 2) {
				changeColor(selection, false);
				selection -= 2;
				changeColor(selection, true);
			}
			break;
		case SWT.ARROW_RIGHT:
			if (selection == -1) {
				selection = 0;
				changeColor(selection, true);
				return;
			}
			if (selection % 2 == 0) {
				changeColor(selection, false);
				selection++;
				changeColor(selection, true);
			}
			break;
		case SWT.ARROW_DOWN:
			if (selection == -1) {
				selection = 0;
				changeColor(selection, true);
				return;
			}
			if (selection <= items.size() - 2) {
				changeColor(selection, false);
				selection += 2;
				changeColor(selection, true);
			}
			break;
		case SWT.HOME:
			changeColor(selection, false);
			selection = 0;
			changeColor(selection, true);
			break;
		case SWT.END:
			changeColor(selection, false);
			selection = items.size() - 1;
			changeColor(selection, true);
			break;
	}

}
 
Example 17
public void handleEvent( Event event )
{
	switch ( event.type )
	{
		case SWT.FocusOut :
			focusLost( new FocusEvent( event ) );
			break;

		case SWT.FocusIn:
			focusedComposite = event.widget;
			break;
			
		case SWT.MouseDown :
			mouseDown( new MouseEvent( event ) );
			break;

		case SWT.Selection :
			widgetSelected( new SelectionEvent( event ) );
			break;

		case SWT.KeyDown :
			if ( event.keyCode == SWT.ESC )
			{
				getShell( ).close( );
			}
			else if ( event.widget == cmpType )
			{
				int newIndex;
				if ( event.keyCode == SWT.ARROW_LEFT )
				{
					if ( markerTypeIndex - 1 >= 0 )
					{
						newIndex = markerTypeIndex - 1;
						switchMarkerType( newIndex );
						redrawMarkers( newIndex );
					}
				}
				else if ( event.keyCode == SWT.ARROW_RIGHT )
				{
					if ( markerTypeIndex + 1 < typeNameSet.length )
					{
						newIndex = markerTypeIndex + 1;
						switchMarkerType( newIndex );
						redrawMarkers( newIndex );
					}
				}
				else if ( event.keyCode == SWT.ARROW_UP )
				{
					if ( markerTypeIndex - MARKER_ROW_MAX_NUMBER >= 0 )
					{
						newIndex = markerTypeIndex
								- MARKER_ROW_MAX_NUMBER;
						switchMarkerType( newIndex );
						redrawMarkers( newIndex );
					}
				}
				else if ( event.keyCode == SWT.ARROW_DOWN )
				{
					if ( markerTypeIndex + MARKER_ROW_MAX_NUMBER < typeNameSet.length )
					{
						newIndex = markerTypeIndex
								+ MARKER_ROW_MAX_NUMBER;
						switchMarkerType( newIndex );
						redrawMarkers( newIndex );
					}
				}
			}
			break;

		case SWT.Traverse :
			// Indicates getting focus control rather than
			// cursor control
			if ( event.detail == SWT.TRAVERSE_TAB_NEXT
					|| event.detail == SWT.TRAVERSE_TAB_PREVIOUS )
			{
				event.doit = true;
				isPressingKey = true;
			}
			else if ( event.keyCode == getMnemonicByText( grpSize.getText( ) ) )
			{
				updateIsPressingKey( iscMarkerSize );
			}
			else if ( event.keyCode == getMnemonicByText( btnOutline.getButton( )
					.getText( ) ) )
			{
				updateIsPressingKey( btnOutline );
			}
			else if ( event.keyCode == getMnemonicByText( btnMarkerVisible.getButton( )
					.getText( ) ) )
			{
				updateIsPressingKey( btnMarkerVisible );
			}
	}
}
 
Example 18
/**
 * {@inheritDoc}
 */
@Override
protected boolean handleKeyDown(KeyEvent event) {
	int dx = 0;
	int dy = 0;

	if (event.keyCode == SWT.SHIFT) {
		shift = true;
	}

	if (event.keyCode == SWT.ARROW_DOWN) {
		dy = 1;

	} else if (event.keyCode == SWT.ARROW_LEFT) {
		dx = -1;

	} else if (event.keyCode == SWT.ARROW_RIGHT) {
		dx = 1;

	} else if (event.keyCode == SWT.ARROW_UP) {
		dy = -1;
	}

	NodeElementEditPart targetEditPart = null;

	Object model = this.getCurrentViewer().getContents().getModel();

	ERDiagram diagram = null;
	if (model instanceof ERModel) {
		diagram = ((ERModel) model).getDiagram();
	}
	if (model instanceof ERDiagram) {
		diagram = (ERDiagram) model;
	}

	if (diagram != null) {

		List selectedObject = this.getCurrentViewer().getSelectedEditParts();
		if (!selectedObject.isEmpty()) {

			CompoundCommand command = new CompoundCommand();

			for (Object object : selectedObject) {

				if (object instanceof ERTableEditPart
						|| object instanceof NoteEditPart) {
					NodeElementEditPart editPart = (NodeElementEditPart) object;
					targetEditPart = editPart;

					NodeElement nodeElement = (NodeElement) editPart.getModel();

					MoveElementCommand moveElementCommand = new MoveElementCommand(
							diagram, editPart.getFigure().getBounds(),
							nodeElement.getX() + dx, nodeElement.getY() + dy,
							nodeElement.getWidth(), nodeElement.getHeight(),
							nodeElement);

					command.add(moveElementCommand);
				}
			}

			this.getCurrentViewer().getEditDomain().getCommandStack().execute(
					command.unwrap());
		}
	}


	if (event.keyCode == SWT.CR && targetEditPart != null) {
		Request request = new Request();
		request.setType(RequestConstants.REQ_OPEN);
		targetEditPart.performRequest(request);
	}

	return super.handleKeyDown(event);
}
 
Example 19
void keyDown( Event event )
{
	if ( event.keyCode == SWT.ESC )
	{
		cmpDropDown.getShell( ).close( );
		return;
	}
	if ( selectedIndex == -1 )
	{
		if ( event.keyCode == SWT.ARROW_LEFT
				|| event.keyCode == SWT.ARROW_RIGHT
				|| event.keyCode == SWT.ARROW_UP
				|| event.keyCode == SWT.ARROW_DOWN )
		{
			selectedIndex = 0;
		}
	}
	else
	{
		switch ( event.keyCode )
		{
			case SWT.ARROW_LEFT :
				if ( selectedIndex - 1 >= 0 )
				{
					selectedIndex -= 1;
				}
				break;
			case SWT.ARROW_RIGHT :
				if ( selectedIndex + 1 < ROW_SIZE * COLUMN_SIZE )
				{
					selectedIndex += 1;
				}
				break;
			case SWT.ARROW_UP :
				if ( selectedIndex - ROW_SIZE >= 0 )
				{
					selectedIndex -= ROW_SIZE;
				}
				break;
			case SWT.ARROW_DOWN :
				if ( selectedIndex + ROW_SIZE < ROW_SIZE * COLUMN_SIZE )
				{
					selectedIndex += ROW_SIZE;
				}
				break;
			case SWT.CR :
			case SWT.KEYPAD_CR :
				setColorToModel( colorMap[selectedIndex] );
				cmpDropDown.getShell( ).close( );
				break;
		}
	}
	if ( !cmpDropDown.isDisposed( ) )
	{
		colorSelection = null;
		redraw( );
	}
}
 
Example 20
/**
 * @see org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler#keyPressed(org.eclipse.swt.events.KeyEvent)
 */
public boolean keyPressed( KeyEvent event )
{
	if ( event.character == ' ' )
	{
		processSelect( event );
		return true;
	}
	else if ( acceptIntoContainer( event ) )
	{
		navigateIntoContainer( event );
		return true;
	}
	else if ( acceptOutOf( event ) )
	{
		navigateOut( event );
		return true;
	}
	else if ( acceptConnection( event ) )
	{
		navigateConnections( event );
		return true;
	}
	else if ( acceptScroll( event ) )
	{
		scrollViewer( event );
		return true;
	}
	else if ( acceptLeaveConnection( event ) )
	{
		navigateOutOfConnection( event );
		return true;
	}
	else if ( acceptLeaveContents( event ) )
	{
		navigateIntoContainer( event );
		return true;
	}

	switch ( event.keyCode )
	{
		case SWT.ARROW_LEFT :
			if ( navigateNextSibling( event, PositionConstants.WEST ) )
				return true;
			break;
		case SWT.ARROW_RIGHT :
			if ( navigateNextSibling( event, PositionConstants.EAST ) )
				return true;
			break;
		case SWT.ARROW_UP :
			if ( navigateNextSibling( event, PositionConstants.NORTH ) )
				return true;
			break;
		case SWT.ARROW_DOWN :
			if ( navigateNextSibling( event, PositionConstants.SOUTH ) )
				return true;
			break;

		case SWT.HOME :
			if ( navigateJumpSibling( event, PositionConstants.WEST ) )
				return true;
			break;
		case SWT.END :
			if ( navigateJumpSibling( event, PositionConstants.EAST ) )
				return true;
			break;
		case SWT.PAGE_DOWN :
			if ( navigateJumpSibling( event, PositionConstants.SOUTH ) )
				return true;
			break;
		case SWT.PAGE_UP :
			if ( navigateJumpSibling( event, PositionConstants.NORTH ) )
				return true;
	}
	return super.keyPressed( event );
}