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

The following examples show how to use org.eclipse.swt.SWT#PAGE_DOWN . 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
public void applyEffect(final long currentTime) {
	current = (int) (start + step
			* easingFunction.getValue((int) currentTime));

	if (!scrollBar.isDisposed()) {
		scrollBar.setSelection(current);
		Event event = new Event();
		event.detail = step < 0 ? SWT.PAGE_UP : SWT.PAGE_DOWN;
		event.data = this;
		event.display = scrollBar.getDisplay();
		event.widget = scrollBar;
		event.doit = true;

		scrollBar.notifyListeners(SWT.Selection, event);
	}
}
 
Example 2
Source Project: nebula   File: DatePicker.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * perform the scroll by making a call to {@link #adjustDays(int, int)} with
 * the <code>field</code> set to Calendar.DATE and the <code>amount</code>
 * corresponding to the keycode.
 */
private void scrollCalendar(int keycode) {
    if (scrollable) {
        switch (keycode) {
        case SWT.ARROW_DOWN:
            adjustDays(Calendar.DATE, 7);
            break;
        case SWT.ARROW_UP:
            adjustDays(Calendar.DATE, -7);
            break;
        case SWT.END:
            adjustDays(Calendar.YEAR, 1);
            break;
        case SWT.HOME:
            adjustDays(Calendar.YEAR, -1);
            break;
        case SWT.PAGE_DOWN:
            adjustDays(Calendar.MONTH, 1);
            break;
        case SWT.PAGE_UP:
            adjustDays(Calendar.MONTH, -1);
            break;
        }
    }
}
 
Example 3
Source Project: e4macs   File: SearchMinibuffer.java    License: Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see com.mulgasoft.emacsplus.minibuffer.WithMinibuffer#noCharEvent(org.eclipse.swt.events.VerifyEvent)
 */
protected void noCharEvent(VerifyEvent event) {

	switch (event.keyCode) {
		// remove minimal support for in line editing
		case SWT.HOME:
		case SWT.END:
		case SWT.ARROW_LEFT:
		case SWT.ARROW_RIGHT:
		case SWT.PAGE_DOWN:
		case SWT.PAGE_UP:
			// Since we've disabled the key filter force the action by
			// disabling the key, and calling the command directly
			// since Mac doesn't handle simple resendEvent well
			event.doit = false;
			ITextEditor ed= this.getEditor();
			leave();
			executeBinding(ed, event.stateMask, event);
			break;
		default:
			super.noCharEvent(event);
			break;
	}
}
 
Example 4
/**
 * Handle a keyPressed event on any row control.
 * 
 * @param sender
 *            The row that is sending the event
 * @param e
 *            the actual KeyEvent
 */
public void keyPressed(TableRow sender, KeyEvent e) {
	if (doMakeFocusedRowVisible()) return;
	
	if ((e.stateMask & SWT.CONTROL) != 0) {
		switch (e.keyCode) {
		case SWT.HOME:
               doFocusInitialRow();
			return;
		case SWT.END:
               doFocusLastRow();
			return;
		case SWT.INSERT:
               doInsertRow();
			return;
		case SWT.DEL:
               doDeleteRow();
			return;
		default:
			return;
		}
	}
	switch (e.keyCode) {
	case SWT.ARROW_UP:
           doRowUp();
		return;
	case SWT.ARROW_DOWN:
           doRowDown();
		return;
	case SWT.PAGE_UP:
           doPageUp();
		return;
	case SWT.PAGE_DOWN:
           doPageDown();
		return;
	}
}
 
Example 5
Source Project: ContentAssist   File: DocumentManager.java    License: MIT License 5 votes vote down vote up
/**
 * Tests if a given key event may move the current cursor position.
 * @param event the key event
 * @return <code>true</code> if the key event may move the current cursor position, otherwise <code>false</code>
 */
private boolean cursorMoved(Event event) {
    final int key = (SWT.KEY_MASK & event.keyCode);
    switch (key) {
        case SWT.ARROW_DOWN:
        case SWT.ARROW_LEFT:
        case SWT.ARROW_RIGHT: 
        case SWT.ARROW_UP: 
        case SWT.HOME:
        case SWT.END: 
        case SWT.PAGE_DOWN:
            return true;
    }
    return false;
}
 
Example 6
public void keyPressed(KeyEvent e)
{
	switch (e.keyCode)
	{
		case SWT.ARROW_UP:
		case SWT.ARROW_DOWN:
		case SWT.PAGE_UP:
		case SWT.PAGE_DOWN:
			searchOnModifyText = false;
			break;
		default:
			searchOnModifyText = true;
	}
}
 
Example 7
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 8
Source Project: birt   File: CustomPreviewTable.java    License: Eclipse Public License 1.0 5 votes vote down vote up
public void keyPressed( KeyEvent event )
{
	if ( ( event.stateMask == SWT.CTRL )
			&& ( event.keyCode == SWT.ARROW_LEFT || event.keyCode == SWT.ARROW_RIGHT ) )
	{
		scrollTable( cnvCells.getHorizontalBar( ), event );
	}
	else if ( event.keyCode == SWT.PAGE_UP
			|| event.keyCode == SWT.PAGE_DOWN
			|| ( ( event.stateMask == SWT.CTRL ) && ( event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN ) ) )
	{
		scrollTable( cnvCells.getVerticalBar( ), event );
	}

}
 
Example 9
Source Project: birt   File: CustomPreviewTable.java    License: Eclipse Public License 1.0 5 votes vote down vote up
private void scrollTable( ScrollBar widget, KeyEvent event )
{
	int newSelectionValue = widget.getSelection( );
	if ( event.keyCode == SWT.ARROW_LEFT )
	{
		newSelectionValue -= TableCanvas.SCROLL_HORIZONTAL_STEP;
	}
	else if ( event.keyCode == SWT.ARROW_RIGHT )
	{
		newSelectionValue += TableCanvas.SCROLL_HORIZONTAL_STEP;
	}
	else if ( event.keyCode == SWT.PAGE_UP 
			|| event.keyCode == SWT.ARROW_UP )
	{
		newSelectionValue -= 1;
	}
	else if ( event.keyCode == SWT.PAGE_DOWN
			|| event.keyCode == SWT.ARROW_DOWN )
	{
		newSelectionValue += 1;
	}

	if ( newSelectionValue < widget.getMinimum( ) )
	{
		newSelectionValue = widget.getMinimum( );
	}
	else if ( newSelectionValue > widget.getMaximum( ) )
	{
		newSelectionValue = widget.getMaximum( );
	}

	widget.setSelection( newSelectionValue );
	Event newEvent = new Event( );
	newEvent.widget = widget;
	newEvent.type = SWT.Selection;
	newEvent.data = event.data;
	widget.notifyListeners( SWT.Selection, newEvent );
}
 
Example 10
Source Project: hop   File: ContextDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void onKeyPressed( KeyEvent event ) {

		if ( filteredItems.isEmpty() ) {
			return;
		}

		Rectangle area = wCanvas.getClientArea();
		int pageRows = Math.floorDiv( area.height, cellHeight );
		int nrColumns = calculateNrColumns();
		int nrRows = calculateNrRows();
		int index = filteredItems.indexOf( selectedItem );

		switch ( event.keyCode ) {
			case SWT.ARROW_DOWN:
				if ( index + nrColumns < filteredItems.size() ) {
					index += nrColumns;
				}
				break;
			case SWT.ARROW_UP:
				if ( index - nrColumns >= 0 ) {
					index -= nrColumns;
				}
				break;
			case SWT.PAGE_UP:
				if ( index - ( pageRows * nrColumns ) > 0 ) {
					index -= pageRows * nrColumns;
				} else {
					index = Math.floorMod( index, nrColumns );
				}
				break;
			case SWT.PAGE_DOWN:
				if ( index + ( pageRows * nrColumns ) < filteredItems.size() - 1 ) {
					index += pageRows * nrColumns;
				} else {
					index = ( nrRows - 1 ) * nrColumns + Math.floorMod( index, nrColumns );
					if ( index > filteredItems.size() - 1 ) {
						index = ( nrRows - 2 ) * nrColumns + Math.floorMod( index, nrColumns );
					}
				}
				break;
			case SWT.ARROW_LEFT:
				if ( index > 0 ) {
					index--;
				}
				break;
			case SWT.ARROW_RIGHT:
				if ( index < filteredItems.size() - 1 ) {
					index++;
				}
				break;
			case SWT.HOME:
				// Position on the first row and column of the screen
				index = 0;
				break;
			case SWT.END:
				// Position on the last row and column of the screen
				index = filteredItems.size() - 1;
				break;
		}

		if (index>=0 && index<filteredItems.size()) {
			selectItem( filteredItems.get( index ) );
		}
	}
 
Example 11
Source Project: nebula   File: DateChooser.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Manages event at the calendar level.
 *
 * @param event event
 */
protected void calendarEvent(Event event) {
	switch (event.type) {
		case SWT.Traverse:
			switch (event.detail) {
				case SWT.TRAVERSE_ARROW_NEXT:
				case SWT.TRAVERSE_ARROW_PREVIOUS:
				case SWT.TRAVERSE_PAGE_NEXT:
				case SWT.TRAVERSE_PAGE_PREVIOUS:
					event.doit = false;
					break;
				default:
					event.doit = true;
			}
			break;

		case SWT.FocusIn:
			handleFocus(event.type);
			break;

		case SWT.KeyDown: {
			final boolean ctrl = (event.stateMask & SWT.CTRL) != 0;
			switch (event.keyCode) {
				case SWT.ARROW_LEFT:
					if (event.stateMask != 0) {
						return;
					}
					setFocus(focusIndex - 1);
					break;
				case SWT.ARROW_RIGHT:
					if (event.stateMask != 0) {
						return;
					}
					setFocus(focusIndex + 1);
					break;
				case SWT.ARROW_UP:
					if (event.stateMask != 0) {
						return;
					}
					setFocus(focusIndex - 7);
					break;
				case SWT.ARROW_DOWN:
					if (event.stateMask != 0) {
						return;
					}
					setFocus(focusIndex + 7);
					break;
				case SWT.PAGE_DOWN:
					if (event.stateMask != 0 || !navigationEnabled) {
						return;
					}
					changeCurrentMonth(ctrl ? 12 : 1);
					break;
				case SWT.PAGE_UP:
					if (event.stateMask != 0 || !navigationEnabled) {
						return;
					}
					changeCurrentMonth(ctrl ? -12 : -1);
					break;
				case ' ':
					select(focusIndex, event.stateMask);
					break;
				case SWT.HOME:
					if (event.stateMask != 0) {
						return;
					}
					setFocusOnToday(autoSelectOnFooter);
					break;
				default:
					return;
			}
			if (hasFocus) {
				gridRedraw();
			}
			break;
		}

		case SWT.Dispose: {
			final Display display = getDisplay();
			display.removeFilter(SWT.FocusIn, filter);
			display.removeFilter(SWT.KeyDown, filter);
			hasFocus = false;
			break;
		}
	}
}
 
Example 12
private void onKeyDown(KeyEvent e){
	if (e.character == SWT.ESC) {
		onDateSelected(false);
		return;
	}
	
	if ((e.character == ' ') || (e.character == '\r')) {
		onDateSelected(true);
		return;
	}
	
	int day = cal.get(Calendar.DAY_OF_MONTH);
	int month = cal.get(Calendar.MONTH);
	int oldDay = day;
	int oldMonth = month;
	
	if (e.keyCode == SWT.ARROW_LEFT) {
		day--;
	}
	
	if (e.keyCode == SWT.ARROW_RIGHT) {
		day++;
	}
	
	if (e.keyCode == SWT.ARROW_UP) {
		day = ((day - 7) < 1 ? oldDay : day - 7);
	}
	
	if (e.keyCode == SWT.ARROW_DOWN) {
		day = ((day + 7) > getMaxDay() ? oldDay : day + 7);
	}
	
	if (e.keyCode == SWT.PAGE_UP) {
		month--;
	}
	
	if (e.keyCode == SWT.PAGE_DOWN) {
		month++;
	}
	
	cal.set(Calendar.MONTH, month);
	cal.set(Calendar.DAY_OF_MONTH, day);
	
	if ((day != oldDay) || (month != oldMonth)) {
		redraw();
		
		if (month != oldMonth) {
			updateMonthLabel();
		}
	}
}
 
Example 13
@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 14
Source Project: depan   File: GLScene.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * A key stroke was received by the OpenGL canvas but it wasn't used by the
 * previous layers.  Give someone else a chance to use it.
 * 
 * This is intended to be overridden, and {@code super.uncaughtKey()}
 * should be the final statement of such methods.  Normally, this is the
 * "last gasp" key handler.
 */
public void uncaughtKey(KeyEvent event,
    boolean keyCtrlState, boolean keyAltState, boolean keyShiftState) {

  switch (event.keyCode) {
    case SWT.ARROW_UP:
      if ((event.stateMask & SWT.CTRL) != 0) {
        rotateCamera(-0.5f, 0.0f, 0.0f);
      } else {
        pedestalCamera(-5.0f);
      }
      break;
    case SWT.ARROW_DOWN:
      if ((event.stateMask & SWT.CTRL) != 0) {
        rotateCamera(0.5f, 0.0f, 0.0f);
      } else {
        pedestalCamera(5.0f);
      }
      break;

    case SWT.ARROW_LEFT:
      if ((event.stateMask & SWT.CTRL) != 0) {
        rotateCamera(0.0f, 0.0f, -0.5f);
      } else {
        truckCamera(-5.0f);
      }
      break;
    case SWT.ARROW_RIGHT:
      if ((event.stateMask & SWT.CTRL) != 0) {
        rotateCamera(0.0f, 0.0f, 0.5f);
      } else {
        truckCamera(5.0f);
      }
      break;

    case SWT.PAGE_UP:
      zoomCamera(5.0f);
      break;
    case SWT.PAGE_DOWN:
      zoomCamera(-5.0f);
      break;
    case SWT.HOME:
      homeCamera();
      break;

    default:
      logUncaughtKey(event.keyCode, event.character, keyCtrlState, keyAltState, keyShiftState);
  }

}
 
Example 15
/**
 * Processes a key stroke in the context selector.
 * 
 * @param e
 *            the verify event describing the key stroke
 * @return <code>true</code> if processing can be stopped
 */
private boolean contextSelectorKeyPressed(VerifyEvent e)
{
	char key = e.character;
	if (key == 0)
	{
		int newSelection = fContextSelectorTable.getSelectionIndex();
		int visibleRows = (fContextSelectorTable.getSize().y / fContextSelectorTable.getItemHeight()) - 1;
		int itemCount = fContextSelectorTable.getItemCount();
		switch (e.keyCode)
		{
			case SWT.ARROW_UP:
				newSelection -= 1;
				if (newSelection < 0)
				{
					newSelection = itemCount - 1;
				}
				break;

			case SWT.ARROW_DOWN:
				newSelection += 1;
				if (newSelection > itemCount - 1)
				{
					newSelection = 0;
				}
				break;

			case SWT.PAGE_DOWN:
				newSelection += visibleRows;
				if (newSelection >= itemCount)
				{
					newSelection = itemCount - 1;
				}
				break;

			case SWT.PAGE_UP:
				newSelection -= visibleRows;
				if (newSelection < 0)
				{
					newSelection = 0;
				}
				break;

			case SWT.HOME:
				newSelection = 0;
				break;

			case SWT.END:
				newSelection = itemCount - 1;
				break;

			default:
				if (e.keyCode != SWT.CAPS_LOCK && e.keyCode != SWT.MOD1 && e.keyCode != SWT.MOD2
						&& e.keyCode != SWT.MOD3 && e.keyCode != SWT.MOD4)
				{
					hideContextSelector();
				}
				return true;
		}

		fContextSelectorTable.setSelection(newSelection);
		fContextSelectorTable.showSelection();
		e.doit = false;
		return false;
	}
	else if ('\t' == key)
	{
		// switch focus to selector shell
		e.doit = false;
		fContextSelectorShell.setFocus();
		return false;
	}
	else if (key == SWT.ESC)
	{
		e.doit = false;
		hideContextSelector();
	}

	return true;
}
 
Example 16
public void keyPressed( KeyEvent e )
{
	switch ( e.keyCode )
	{
		case SWT.ARROW_DOWN :
			if ( iSelectedIndex < elPaletteEntries1.size( ) - 1 )
			{
				iSelectedIndex++;
				scrollToView( iSelectedIndex );
				coPaletteEntries.redraw( );
			}
			break;
		case SWT.ARROW_UP :
			if ( iSelectedIndex > 0 )
			{
				iSelectedIndex--;
				scrollToView( iSelectedIndex );
				coPaletteEntries.redraw( );
			}
			break;
		case SWT.CR :
			if ( coPaletteEntries.isFocusControl( ) )
			{
				coEditor.setFocus( );
			}
			break;
		case SWT.PAGE_DOWN :
			iSelectedIndex += 8;
			if ( iSelectedIndex > elPaletteEntries1.size( ) )
			{
				iSelectedIndex = elPaletteEntries1.size( ) - 1;
			}
			scrollToView( iSelectedIndex );
			sb.setSelection( sb.getMaximum( )
					* ( iSelectedIndex + 1 )
					/ elPaletteEntries1.size( ) );
			coPaletteEntries.redraw( );
			break;
		case SWT.PAGE_UP :
			iSelectedIndex -= 8;
			if ( iSelectedIndex < 0 )
			{
				iSelectedIndex = 0;
			}
			scrollToView( iSelectedIndex );
			sb.setSelection( sb.getMaximum( )
					* iSelectedIndex
					/ elPaletteEntries1.size( ) );
			coPaletteEntries.redraw( );
			break;
		case SWT.TAB :
			btnAdd.setFocus( );
			break;
		case SWT.ESC :
			this.getShell( ).close( );
			break;
	}
}
 
Example 17
Source Project: birt   File: CustomPreviewTable.java    License: Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.getSource( ) instanceof ScrollBar )
	{
		ScrollBar sb = (ScrollBar) e.getSource( );
		if ( ( sb.getStyle( ) | SWT.H_SCROLL ) == SWT.H_SCROLL )
		{
			if ( iLastProcessedHorizontalScrollPosition == 0 )
			{
				// Initialize the value
				iLastProcessedHorizontalScrollPosition = cnvCells.getVisibleTableWidth( );
			}
			if ( sb.getSelection( ) == iLastProcessedHorizontalScrollPosition )
			{
				return;
			}

			if ( ( sb.getStyle( ) | SWT.H_SCROLL ) == SWT.H_SCROLL )
			{
				// CALCULATE PIXEL SHIFT IN BUTTON POSITION
				int iShift = 0;
				if ( e.detail == SWT.ARROW_UP
						|| e.detail == SWT.PAGE_UP )
				{
					// SHIFT HEADERS ONE COLUMN TO THE RIGHT
					iShift = -SCROLL_HORIZONTAL_STEP;
				}
				else if ( e.detail == SWT.ARROW_DOWN
						|| e.detail == SWT.PAGE_DOWN )
				{
					// SHIFT HEADERS ONE COLUMN TO THE LEFT
					iShift = SCROLL_HORIZONTAL_STEP;
				}
				else
				{
					iShift = sb.getSelection( )
							- iLastProcessedHorizontalScrollPosition;
				}
				iHiddenWidth += iShift;
				// Correction for negative value or overflow
				if ( iHiddenWidth < 0 )
				{
					iShift -= iHiddenWidth;
					iHiddenWidth = 0;
				}
				else if ( iHiddenWidth + getVisibleTableWidth( ) > getMaxTableWidth( ) )
				{
					int diff = getMaxTableWidth( )
							- getVisibleTableWidth( )
							- iHiddenWidth;
					iShift += diff;
					iHiddenWidth += diff;
				}
				// APPLY PIXEL SHIFT TO RELOCATE BUTTONS
				if ( btnHeaders.size( ) > 0 )
				{
					// MOVE ALL BUTTONS TO THE LEFT...AS MUCH AS THE
					// SCROLLING VALUE
					Button btn = btnHeaders.get( 0 );
					( (FormData) btn.getLayoutData( ) ).left = new FormAttachment( 0,
							btn.getLocation( ).x - iShift );
				}
				cmpHeaders.layout( );
				// UPDATE LAST HORIZONTAL SCROLL POSITION
				iLastProcessedHorizontalScrollPosition = sb.getSelection( );
			}
		}
		else
		{
			if ( getVerticalBar( ).getSelection( ) == iLastProcessedVerticalScrollPosition )
			{
				return;
			}

			if ( e.detail == SWT.ARROW_UP || e.detail == SWT.PAGE_UP )
			{
				if ( iVScroll > 0 )
				{
					iVScroll--;
				}
			}
			else if ( e.detail == SWT.ARROW_DOWN
					|| e.detail == SWT.PAGE_DOWN )
			{
				iVScroll++;
			}
			else
			{
				iVScroll += ( sb.getSelection( ) - iLastProcessedVerticalScrollPosition );
			}
			iLastProcessedVerticalScrollPosition = sb.getSelection( );
		}
		redraw( );
	}
}
 
Example 18
/**
 * @see org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler#keyPressed(org.eclipse.swt.events.KeyEvent)
 */
public boolean keyPressed( KeyEvent event )
{
	GraphicalEditPart part = getFocusEditPart( );

	switch ( event.keyCode )
	{
		case SWT.ARROW_LEFT :

		case SWT.ARROW_RIGHT :

		case SWT.ARROW_UP :

		case SWT.ARROW_DOWN :
			if ( scrollIncrement( part, event ) )
			{
				return true;
			}
			break;

		case SWT.PAGE_DOWN :

		case SWT.PAGE_UP :
			if ( scrollPageIncrement( part, event.keyCode ) )
			{
				return true;
			}
			break;
		default :
			break;
	}
	/**
	 * Hacks Table Cell key behaviors.
	 */
	if ( part instanceof AbstractCellEditPart )
	{
		return tableCellKeyPressed( event );
	}

	return super.keyPressed( event );
}
 
Example 19
/**
 * @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 );
}
 
Example 20
Source Project: e4macs   File: WithMinibuffer.java    License: Eclipse Public License 1.0 4 votes vote down vote up
protected void noCharEvent(VerifyEvent event) {

		switch (event.keyCode) {
		case SWT.CTRL:	
			if (handlesCtrl()) {
				break;
			}
			closeDialog();	// else close dialog and leave 
			leave();
			break;
		case SWT.ALT:
			if (handlesAlt()) {
				break;
			}
			closeDialog();	// else close dialog and leave 
			leave();
			break;
		case SWT.PAGE_DOWN:	// leave
		case SWT.PAGE_UP:
		case SWT.ARROW_DOWN:
		case SWT.ARROW_UP:
			leave();
			break;

			// minimal support for in line editing
		case SWT.HOME:
			getMB().toBegin();
			event.doit = false;
			break;

		case SWT.END:
			getMB().toEnd();
			event.doit = false;
			break;

		case SWT.ARROW_LEFT:
			getMB().toLeft();
			event.doit = false;
			break;

		case SWT.ARROW_RIGHT:
			getMB().toRight();			
			event.doit = false;
			break;
		}
	}