/** * Sends out a text selection changed event to all registered listeners and * registers the selection changed event to be sent out to all post selection * listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document */ protected void selectionChanged(int offset, int length) { queuePostSelectionChanged(true); fireSelectionChanged(offset, length); }
/** * Sends out a text selection changed event to all registered listeners and * registers the selection changed event to be sent out to all post selection * listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document */ protected void selectionChanged(int offset, int length) { queuePostSelectionChanged(true); fireSelectionChanged(offset, length); }
private void delete() { if (!fTextWidget.getBlockSelection()) { fTextWidget.invokeAction(ST.DELETE_NEXT); } else { wrapCompoundChange(new Runnable(){ @Override public void run() { try { new SelectionProcessor(TextViewer.this).doDelete(getSelection()); } catch (BadLocationException e) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.delete")); //$NON-NLS-1$ } } }); } Point selection= fTextWidget.getSelectionRange(); fireSelectionChanged(selection.x, selection.y); }
fireSelectionChanged(selection.x, selection.y);
fireSelectionChanged(selection.x, selection.y);
/** * Sends out a text selection changed event to all registered listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document * @since 3.0 */ protected void fireSelectionChanged(int offset, int length) { if (redraws()) { if (length < 0) { length= -length; offset= offset + length; } IRegion r= widgetRange2ModelRange(new Region(offset, length)); if ((r != null && !r.equals(fLastSentSelectionChange)) || r == null) { fLastSentSelectionChange= r; ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); fireSelectionChanged(event); } } }
private void delete() { if (!fTextWidget.getBlockSelection()) { fTextWidget.invokeAction(ST.DELETE_NEXT); } else { wrapCompoundChange(() -> { try { new SelectionProcessor(TextViewer.this).doDelete(getSelection()); } catch (BadLocationException e) { if (TRACE_ERRORS) System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.delete")); //$NON-NLS-1$ } }); } Point selection= fTextWidget.getSelectionRange(); fireSelectionChanged(selection.x, selection.y); }
/** * Sends out a text selection changed event to all registered listeners. * * @param offset the offset of the newly selected range in the visible document * @param length the length of the newly selected range in the visible document * @since 3.0 */ protected void fireSelectionChanged(int offset, int length) { if (redraws()) { if (length < 0) { length= -length; offset= offset + length; } IRegion r= widgetRange2ModelRange(new Region(offset, length)); if ((r != null && !r.equals(fLastSentSelectionChange)) || r == null) { fLastSentSelectionChange= r; ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); fireSelectionChanged(event); } } }
/** * Sends out a mark selection changed event to all registered listeners. * * @param offset the offset of the mark selection in the visible document, the offset is <code>-1</code> if the mark was cleared * @param length the length of the mark selection, may be negative if the caret is before the mark. * @since 2.0 */ protected void markChanged(int offset, int length) { if (redraws()) { if (offset != -1) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); offset= r.getOffset(); length= r.getLength(); } ISelection selection= new MarkSelection(getDocument(), offset, length); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); fireSelectionChanged(event); } }
/** * Sends out a mark selection changed event to all registered listeners. * * @param offset the offset of the mark selection in the visible document, the offset is <code>-1</code> if the mark was cleared * @param length the length of the mark selection, may be negative if the caret is before the mark. * @since 2.0 */ protected void markChanged(int offset, int length) { if (redraws()) { if (offset != -1) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); offset= r.getOffset(); length= r.getLength(); } ISelection selection= new MarkSelection(getDocument(), offset, length); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); fireSelectionChanged(event); } }
fireSelectionChanged(selection.x, selection.y); if (fLastSentSelectionChange != null) { ISelection lastSelection= new TextSelection(getDocument(), fLastSentSelectionChange.getOffset(), fLastSentSelectionChange.getLength()); fireSelectionChanged(new SelectionChangedEvent(this, lastSelection));
fireSelectionChanged(selection.x, selection.y); if (fLastSentSelectionChange != null) { ISelection lastSelection= new TextSelection(getDocument(), fLastSentSelectionChange.getOffset(), fLastSentSelectionChange.getLength()); fireSelectionChanged(new SelectionChangedEvent(this, lastSelection));