Java Code Examples for org.eclipse.swt.SWT#PAGE_UP
The following examples show how to use
org.eclipse.swt.SWT#PAGE_UP .
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: MoveScrollBarEffect.java From nebula with Eclipse Public License 2.0 | 6 votes |
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 File: SearchMinibuffer.java From e4macs with Eclipse Public License 1.0 | 6 votes |
/** * @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 3
Source File: ReportViewerKeyHandler.java From birt with Eclipse Public License 1.0 | 6 votes |
private boolean scrollPageIncrement( GraphicalEditPart part, int code ) { if ( !( part.getViewer( ) instanceof DeferredGraphicalViewer ) ) { return false; } DeferredGraphicalViewer viewer = (DeferredGraphicalViewer) part.getViewer( ); FigureCanvas canvas = viewer.getFigureCanvas( ); int increment = 0; if ( code == SWT.PAGE_DOWN ) { increment = canvas.getVerticalBar( ).getSelection( ) + canvas.getVerticalBar( ).getPageIncrement( ); } else if ( code == SWT.PAGE_UP ) { increment = canvas.getVerticalBar( ).getSelection( ) - canvas.getVerticalBar( ).getPageIncrement( ); } canvas.scrollToY( increment ); return true; }
Example 4
Source File: DatePicker.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * 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 5
Source File: CustomPreviewTable.java From birt with Eclipse Public License 1.0 | 5 votes |
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 6
Source File: CustomPreviewTable.java From birt with Eclipse Public License 1.0 | 5 votes |
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 7
Source File: TypingRunDetector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
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 File: FindBarDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
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 9
Source File: InternalCompositeTable.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * 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 10
Source File: GLScene.java From depan with Apache License 2.0 | 4 votes |
/** * 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 11
Source File: ContextInformationPopup.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
/** * 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 12
Source File: HorizontalScrollbarHandler.java From nebula with Eclipse Public License 2.0 | 4 votes |
private int scrollDirectionForEventDetail(int eventDetail) { return (eventDetail == SWT.PAGE_UP || eventDetail == SWT.ARROW_UP) ? SWT.LEFT : SWT.RIGHT; }
Example 13
Source File: OfflineActionTarget.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@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 File: HorizontalScrollBarHandler.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
@Override MoveDirectionEnum scrollDirectionForEventDetail(int eventDetail){ return (eventDetail == SWT.PAGE_UP || eventDetail == SWT.ARROW_UP ) ? LEFT : RIGHT; }
Example 15
Source File: DatePicker.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
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 16
Source File: HorizontalScrollBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override MoveDirectionEnum scrollDirectionForEventDetail(int eventDetail){ return (eventDetail == SWT.PAGE_UP || eventDetail == SWT.ARROW_UP ) ? LEFT : RIGHT; }
Example 17
Source File: VerticalScrollBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override MoveDirectionEnum scrollDirectionForEventDetail(int eventDetail) { return (eventDetail == SWT.PAGE_UP || eventDetail == SWT.ARROW_UP) ? UP : DOWN; }
Example 18
Source File: PaletteEditorComposite.java From birt with Eclipse Public License 1.0 | 4 votes |
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 19
Source File: WithMinibuffer.java From e4macs with Eclipse Public License 1.0 | 4 votes |
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; } }
Example 20
Source File: TableCellKeyDelegate.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * @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 ); }