/** * default implementation for {@link DefaultTextEditActions#PASTE} */ protected void defaultPaste() { if (getControl().getEditable()) { getControl().paste(); } }
/** * default implementation for {@link DefaultTextEditActions#CUT} */ protected void defaultCut() { if (getControl().getEditable()) { getControl().cut(); } }
private void onKeyTyped(KeyEvent event) { if (getControl().getEditable()) { String character = event.getCharacter(); if (character.length() == 0) { return; } // check the modifiers // - OS-X: ALT+L ==> @ // - win32/linux: ALTGR+Q ==> @ if (event.isControlDown() || event.isAltDown() || (Util.isMacOS() && event.isMetaDown())) { if (!((event.isControlDown() || Util.isMacOS()) && event.isAltDown())) return; } if (character.charAt(0) > 31 // No ascii control chars && character.charAt(0) != 127 // no delete key && !event.isMetaDown()) { getControl().insert(character); // check for typed char action if( this.keyTriggerMapping.exists(character.charAt(0)) ) { getControl().fireEvent(UndoHintEvent.createBeginCompoundChangeEvent()); try { this.keyTriggerMapping.triggerAction(character.charAt(0), new Context(getControl())); } finally { getControl().fireEvent(UndoHintEvent.createEndCompoundChangeEvent()); } } } } }
private void _keyTyped(KeyEvent event) { if (getControl().getEditable()) { String character = event.getCharacter(); if (character.length() == 0) { return; } // check the modifiers // - OS-X: ALT+L ==> @ // - win32/linux: ALTGR+Q ==> @ if (event.isControlDown() || event.isAltDown() || (Util.isMacOS() && event.isMetaDown())) { if (!((event.isControlDown() || Util.isMacOS()) && event.isAltDown())) return; } if (character.charAt(0) > 31 // No ascii control chars && character.charAt(0) != 127 // no delete key && !event.isMetaDown()) { final int offset = getControl().getCaretOffset(); getControl().getContent().replaceTextRange(getControl().getCaretOffset(), 0, character); getControl().setCaretOffset(offset + 1); } } }
if (getControl().getEditable()) { int line = getControl().getContent().getLineAtOffset(getControl().getCaretOffset()); String lineContent = getControl().getContent().getLine(line); if (getControl().getEditable()) { if (event.isMetaDown()) { invokeAction(ActionType.DELETE_WORD_NEXT); if (getControl().getEditable()) { if (event.isMetaDown()) { invokeAction(ActionType.DELETE_WORD_PREVIOUS); if (getControl().getEditable()) { event.consume(); if (event.isShiftDown()) { if (getControl().getEditable()) { if (event.isShortcutDown()) { getControl().paste(); if (getControl().getEditable()) { if (event.isShortcutDown()) { getControl().cut();