public void setSelection( int arg0 ) { styledText.setSelection( arg0 ); }
public void setSelection( int arg0, int arg1 ) { styledText.setSelection( arg0, arg1 ); }
private void replaceText() { int start = text.getSelectionRange().x; text.replaceTextRange( start, text.getSelectionCount(), replaceText.getText() ); text.setSelection( start, start + replaceText.getText().length() ); } }
private boolean findText() { String searchString = searchText.getText(); String textString = text.getText(); int offset = text.getCaretOffset(); int start = -1; if ( !btnIgnoreCase.getSelection() ) { searchString = searchString.toLowerCase(); textString = textString.toLowerCase(); } // if (1==1) { start = textString.indexOf( searchString, offset ); /* * }else if (text.getSelectionRange().y > searchString.length()) { start = textString.lastIndexOf(searchString, * offset - 1); }else { start = textString.lastIndexOf(searchString, offset - text.getSelectionRange().y - 1); } */ if ( start > -1 ) { text.setSelection( start, start + searchString.length() ); return true; } return false; }
text.setSelection( start, start + searchString.length() ); return true;
public void widgetSelected( SelectionEvent se ) { expressionEditor.insert( proposal.getCompletionString() ); expressionEditor.setSelection( offset + proposal.getOffset() ); } } );
public void widgetSelected( SelectionEvent se ) { expressionEditor.insert( proposal.getCompletionString() ); expressionEditor.setSelection( offset + proposal.getOffset() ); } } );
private void redo() { if ( redoStack.size() > 0 ) { UndoRedoStack urs = redoStack.remove( 0 ); if ( undoStack.size() == MAX_STACK_SIZE ) { undoStack.remove( undoStack.size() - 1 ); } UndoRedoStack rro = new UndoRedoStack( urs.getCursorPosition(), urs.getReplacedText(), styledText.getText(), urs .getEventLength(), urs.getType() ); bFullSelection = false; styledText.setText( urs.getReplacedText() ); if ( urs.getType() == UndoRedoStack.INSERT ) { styledText.setCaretOffset( urs.getCursorPosition() ); } else if ( urs.getType() == UndoRedoStack.DELETE ) { styledText.setCaretOffset( urs.getCursorPosition() + urs.getEventLength() ); styledText.setSelection( urs.getCursorPosition(), urs.getCursorPosition() + urs.getEventLength() ); if ( styledText.getSelectionCount() == styledText.getCharCount() ) { bFullSelection = true; } } undoStack.add( 0, rro ); } }
private void undo() { if ( undoStack.size() > 0 ) { UndoRedoStack urs = undoStack.remove( 0 ); if ( redoStack.size() == MAX_STACK_SIZE ) { redoStack.remove( redoStack.size() - 1 ); } UndoRedoStack rro = new UndoRedoStack( urs.getCursorPosition(), urs.getReplacedText(), styledText.getText(), urs .getEventLength(), urs.getType() ); bFullSelection = false; styledText.setText( urs.getReplacedText() ); if ( urs.getType() == UndoRedoStack.INSERT ) { styledText.setCaretOffset( urs.getCursorPosition() ); } else if ( urs.getType() == UndoRedoStack.DELETE ) { styledText.setCaretOffset( urs.getCursorPosition() + urs.getEventLength() ); styledText.setSelection( urs.getCursorPosition(), urs.getCursorPosition() + urs.getEventLength() ); if ( styledText.getSelectionCount() == styledText.getCharCount() ) { bFullSelection = true; } } redoStack.add( 0, rro ); } }
public void setSelection(int start, int end) { fStyledText.setSelection(start, end); } }
@Override public void pasteText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start); st.paste(); e.result = ACC.OK; } @Override
@Override public void widgetSelected(SelectionEvent e) { // hack to avoid drawing selection of styled text while mouse move // of highlight viewport fMinimapTextWidget.setSelection(fMinimapTextWidget.getCaretOffset()); }
public void cutText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start, e.end); st.cut(); e.result = ACC.OK; } public void copyText(AccessibleEditableTextEvent e) {
public void copyText(AccessibleEditableTextEvent e) { StyledText st = StyledText.this; st.setSelection(e.start, e.end); st.copy(); e.result = ACC.OK; } });
@Override public void setSelection(AccessibleTextEvent e) { if (e.index != 0) return; StyledText st = StyledText.this; Point point = st.getSelection(); if (point.x == point.y) return; int end = e.end; if (end == -1) end = st.getCharCount(); st.setSelection(e.start, end); e.result = ACC.OK; } @Override
@Override public void addSelection(AccessibleTextEvent e) { StyledText st = StyledText.this; Point point = st.getSelection(); if (point.x == point.y) { int end = e.end; if (end == -1) end = st.getCharCount(); st.setSelection(e.start, end); e.result = ACC.OK; } } @Override
public void addSelection(AccessibleTextEvent e) { StyledText st = StyledText.this; Point point = st.getSelection(); if (point.x == point.y) { int end = e.end; if (end == -1) end = st.getCharCount(); st.setSelection(e.start, end); e.result = ACC.OK; } } public void getSelection(AccessibleTextEvent e) {
public void setSelection(AccessibleTextEvent e) { if (e.index != 0) return; StyledText st = StyledText.this; Point point = st.getSelection(); if (point.x == point.y) return; int end = e.end; if (end == -1) end = st.getCharCount(); st.setSelection(e.start, end); e.result = ACC.OK; } public void getCharacterCount(AccessibleTextEvent e) {
@Override public void keyReleased(KeyEvent e) { if ((e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND) && (e.keyCode == 'a' || e.keyCode == 'A')) consoleText.setSelection(new Point(0, consoleText.getText().length())); if ((e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND) && (e.keyCode == 'c' || e.keyCode == 'C')) copyToClipboard(); if ((e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND) && (e.keyCode == 'w' || e.keyCode == 'W')) consoleText.getShell().close(); } });
@Override public void focusGained(FocusEvent e) { currentText = (StyledText) e.widget; // Remove highlighted selection if text widget has changed if ((currentText != lastNavigatedText) && (lastNavigatedText != null)) { lastNavigatedText.setSelection(lastNavigatedText .getSelection().x); } // enable/disable copy action copyAction.setEnabled(currentText.isTextSelected()); } });