Java Code Examples for org.eclipse.swt.SWT#ARROW_RIGHT
The following examples show how to use
org.eclipse.swt.SWT#ARROW_RIGHT .
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: PeerCharacterCloser.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
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 2
Source File: HopGuiPipelineGraph.java From hop with Apache License 2.0 | 5 votes |
@GuiToolbarElement( root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_DISTRIBUTE_HORIZONTALLY, // label = "Horizontally distribute selected transforms", toolTip = "Distribute the selected transforms evenly between the left-most and right-most transform in your selection", image = "ui/images/toolbar/distribute-horizontally.svg", disabledImage = "ui/images/toolbar/distribute-horizontally-disabled.svg" ) @GuiKeyboardShortcut( alt = true, key = SWT.ARROW_RIGHT ) @GuiOsxKeyboardShortcut( alt = true, key = SWT.ARROW_RIGHT ) public void distributeHorizontal() { createSnapAllignDistribute().distributehorizontal(); }
Example 3
Source File: PatternImageEditorDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
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 4
Source File: HopGuiWorkflowGraph.java From hop with Apache License 2.0 | 5 votes |
@GuiToolbarElement( root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ITEM_DISTRIBUTE_HORIZONTALLY, toolTip = "Distribute the selected actions evenly between the left-most and right-most action in your selection", image = "ui/images/toolbar/distribute-horizontally.svg", disabledImage = "ui/images/toolbar/distribute-horizontally-disabled.svg" ) @GuiKeyboardShortcut( alt = true, key = SWT.ARROW_RIGHT ) @GuiOsxKeyboardShortcut( alt = true, key = SWT.ARROW_RIGHT ) public void distributeHorizontal() { createSnapAllignDistribute().distributehorizontal(); }
Example 5
Source File: TimeSlot.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void keyPressed(KeyEvent e) { switch (e.keyCode) { case SWT.ARROW_LEFT: traverse(SWT.TRAVERSE_TAB_PREVIOUS); return; case SWT.ARROW_RIGHT: traverse(SWT.TRAVERSE_TAB_NEXT); return; } }
Example 6
Source File: TableCellKeyDelegate.java From birt with Eclipse Public License 1.0 | 5 votes |
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 7
Source File: DocumentManager.java From ContentAssist with MIT License | 5 votes |
/** * 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 8
Source File: TableCellKeyDelegate.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @return <code>true</code> if the viewer's contents has focus and one of * the arrow keys is pressed */ boolean acceptLeaveContents( KeyEvent event ) { int key = event.keyCode; return getFocusEditPart( ) == getViewer( ).getContents( ) && ( ( key == SWT.ARROW_UP ) || ( key == SWT.ARROW_RIGHT ) || ( key == SWT.ARROW_DOWN ) || ( key == SWT.ARROW_LEFT ) ); }
Example 9
Source File: DatePicker.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * 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 10
Source File: Launcher.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * 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 11
Source File: Histogram.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
/** * Move the currently selected bar cursor. * * @param keyCode * the SWT key code */ protected void moveCursor(final int keyCode) { int index; switch (keyCode) { case SWT.HOME: fScaledData.fSelectionBeginBucket = 0; break; case SWT.END: fScaledData.fSelectionBeginBucket = fScaledData.fWidth - 1; break; case SWT.ARROW_RIGHT: { long prevStartTime = getTimestamp(fScaledData.fSelectionBeginBucket); index = Math.max(0, Math.min(fScaledData.fWidth - 1, fScaledData.fSelectionBeginBucket + 1)); while (index < fScaledData.fWidth && (fScaledData.fData[index].isEmpty() || prevStartTime == getTimestamp(index))) { prevStartTime = getTimestamp(index); index++; } if (index >= fScaledData.fWidth) { index = fScaledData.fWidth - 1; } fScaledData.fSelectionBeginBucket = index; break; } case SWT.ARROW_LEFT: { long prevEndTime = getTimestamp(fScaledData.fSelectionBeginBucket + 1); index = Math.max(0, Math.min(fScaledData.fWidth - 1, fScaledData.fSelectionBeginBucket - 1)); while (index >= 0 && (fScaledData.fData[index].isEmpty() || prevEndTime == getTimestamp(index + 1))) { prevEndTime = getTimestamp(index + 1); index--; } if (index <= 0) { index = 0; } fScaledData.fSelectionBeginBucket = index; break; } default: return; } fScaledData.fSelectionEndBucket = fScaledData.fSelectionBeginBucket; fSelectionBegin = getTimestamp(fScaledData.fSelectionBeginBucket); fSelectionEnd = fSelectionBegin; updateSelectionTime(); }
Example 12
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 ); }
Example 13
Source File: TimeCompressionBar.java From tracecompass with Eclipse Public License 2.0 | 4 votes |
@Override protected void keyPressedEvent(KeyEvent event) { if (fTooltip != null) { fTooltip.hideToolTip(); } if (!isFocusControl() || getViewControl().isFocusControl()) { Control[] child = getParent().getChildren(); for (int i = 0; i < child.length; i++) { if (child[i].isFocusControl()) { break; } } } setFocus(-1); boolean top = false; if (fNextNodeY == 0) { top = true; } if ((fFrame != null) && (fNextNodeY == 0)) { for (int i = 0; i < fNodeList.size() - 1 && i < 1; i++) { SDTimeEvent m1 = fNodeList.get(i); SDTimeEvent m2 = fNodeList.get(i + 1); if (skipIfLifelineIsNull(m1, m2)) { continue; } PairOfYs poy = adjustHeights(m1, m2); fPrevNodeY = Math.round(poy.getY1() * fZoomValue); fNextNodeY = Math.round(poy.getY2() * fZoomValue); } } if (fLifeline != null) { for (int j = 0; j < fListenerList.size(); j++) { ITimeCompressionListener list = fListenerList.get(j); list.deltaSelected(fLifeline, fLifelineStart, fLifelineNumEvents, fLifelineColor); } } if (event.keyCode == SWT.ARROW_DOWN) { if (!top) { selectTimeDelta(fNextNodeY + 1, 1); } else { selectTimeDelta(fPrevNodeY + 1, 1); } setFocus(1); } else if (event.keyCode == SWT.ARROW_UP) { selectTimeDelta(fPrevNodeY - 1, 2); setFocus(1); } else if (event.keyCode == SWT.ARROW_RIGHT) { selectTimeDelta(fPrevNodeY, 1); setFocus(1); } super.keyPressedEvent(event); }
Example 14
Source File: TexCellListener.java From texlipse with Eclipse Public License 1.0 | 4 votes |
/** * KeyListener method from KeyListener Interface * * Determines the actions to be taken, when a key is pressed. That means * either moving the editing controls to neigboring cell, if a) * CTRL+ArrowKey was pressed b) neighboring cell in that direction exists or * calculating a sum of cells in given direction (and copying it to * clipboard) c) CTRL+KEYPAD_8,_2,_4 or _6 (up, down, left, right) is * pressed * * @param e key event that occured */ public void keyPressed(KeyEvent e) { if ((e.stateMask & (SWT.CTRL | SWT.ALT | SWT.SHIFT)) != SWT.CTRL) return; int row = viewer.getTable().getSelectionIndex(); int columns = viewer.getTable().getColumnCount(); int rows = viewer.getTable().getItemCount(); // FIXME redundant test if ((e.stateMask & (SWT.CTRL | SWT.ALT | SWT.SHIFT)) == SWT.CTRL) { //TexRow texRow = (TexRow) texRowList.getRows().get(row); double sum = 0.0; switch (e.keyCode) { case SWT.ARROW_UP: if (row > 0) viewer.editElement(viewer.getElementAt(row - 1), column); break; case SWT.ARROW_DOWN: /* if (row < rows - 1) // TODO else { add one row to the model } viewer.editElement(viewer.getElementAt(row + 1), column); */ if (row >= rows - 1) texRowList.addRow(); viewer.editElement(viewer.getElementAt(row + 1), column); break; case SWT.ARROW_LEFT: if (column > 0) viewer.editElement(viewer.getElementAt(row), column - 1); break; case SWT.ARROW_RIGHT: if (column < columns - 1) viewer.editElement(viewer.getElementAt(row), column + 1); break; case SWT.KEYPAD_8: sum = texRowList.sum(column, row, TexRowList.SUM_UP); if(row>0) { viewer.editElement(viewer.getElementAt(row - 1), column); ((TexRow)texRowList.getRows().get(row)).setCol(column, ((int)sum==sum)?Integer.toString((int)sum):Double.toString(sum)); viewer.editElement(viewer.getElementAt(row), column); } break; case SWT.KEYPAD_2: sum = texRowList.sum(column, row, TexRowList.SUM_DOWN); if(row<texRowList.getRows().size()-1) { viewer.editElement(viewer.getElementAt(row + 1), column); ((TexRow)texRowList.getRows().get(row)).setCol(column, ((int)sum==sum)?Integer.toString((int)sum):Double.toString(sum)); viewer.editElement(viewer.getElementAt(row), column); } break; case SWT.KEYPAD_4: sum = texRowList.sum(column, row, TexRowList.SUM_LEFT); if(column>0) { viewer.editElement(viewer.getElementAt(row), column-1); ((TexRow)texRowList.getRows().get(row)).setCol(column, ((int)sum==sum)?Integer.toString((int)sum):Double.toString(sum)); viewer.editElement(viewer.getElementAt(row), column); } break; case SWT.KEYPAD_6: sum = texRowList.sum(column, row, TexRowList.SUM_RIGHT); if(column<TexRow.COLUMNS-1) { viewer.editElement(viewer.getElementAt(row), column+1); ((TexRow)texRowList.getRows().get(row)).setCol(column, ((int)sum==sum)?Integer.toString((int)sum):Double.toString(sum)); viewer.editElement(viewer.getElementAt(row), column); } break; } } }
Example 15
Source File: JobGraph.java From pentaho-kettle with Apache License 2.0 | 4 votes |
public void keyPressed( KeyEvent e ) { // Delete if ( e.keyCode == SWT.DEL ) { List<JobEntryCopy> copies = jobMeta.getSelectedEntries(); if ( copies != null && copies.size() > 0 ) { delSelected(); } } if ( e.keyCode == SWT.F1 ) { spoon.browseVersionHistory(); } // CTRL-UP : allignTop(); if ( e.keyCode == SWT.ARROW_UP && ( e.stateMask & SWT.MOD1 ) != 0 ) { alligntop(); } // CTRL-DOWN : allignBottom(); if ( e.keyCode == SWT.ARROW_DOWN && ( e.stateMask & SWT.MOD1 ) != 0 ) { allignbottom(); } // CTRL-LEFT : allignleft(); if ( e.keyCode == SWT.ARROW_LEFT && ( e.stateMask & SWT.MOD1 ) != 0 ) { allignleft(); } // CTRL-RIGHT : allignRight(); if ( e.keyCode == SWT.ARROW_RIGHT && ( e.stateMask & SWT.MOD1 ) != 0 ) { allignright(); } // ALT-RIGHT : distributeHorizontal(); if ( e.keyCode == SWT.ARROW_RIGHT && ( e.stateMask & SWT.ALT ) != 0 ) { distributehorizontal(); } // ALT-UP : distributeVertical(); if ( e.keyCode == SWT.ARROW_UP && ( e.stateMask & SWT.ALT ) != 0 ) { distributevertical(); } // ALT-HOME : snap to grid if ( e.keyCode == SWT.HOME && ( e.stateMask & SWT.ALT ) != 0 ) { snaptogrid( ConstUI.GRID_SIZE ); } // CTRL-W or CTRL-F4 : close tab if ( ( e.keyCode == 'w' && ( e.stateMask & SWT.MOD1 ) != 0 ) || ( e.keyCode == SWT.F4 && ( e.stateMask & SWT.MOD1 ) != 0 ) ) { spoon.tabCloseSelected(); } }
Example 16
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 17
Source File: ReportViewerKeyHandler.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 ) { 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 18
Source File: GuiMenuWidgets.java From hop with Apache License 2.0 | 4 votes |
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 19
Source File: ContextDialog.java From hop with Apache License 2.0 | 4 votes |
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 20
Source File: JaretTable.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * 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; } } }