@Override public void run() { if (id == fNumberOfPostSelectionChangedEvents[0]) { // Check again because this is executed after the delay if (getDisplay() != null) { Point selection= fTextWidget.getSelectionRange(); if (selection != null) { IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y)); if (fFireEqualPostSelectionChange || (r != null && !r.equals(fLastSentPostSelectionChange)) || r == null) { fLastSentPostSelectionChange= r; fFireEqualPostSelectionChange= false; firePostSelectionChanged(selection.x, selection.y); } } } } } });
@Override public void run() { if (id == fNumberOfPostSelectionChangedEvents[0]) { // Check again because this is executed after the delay if (getDisplay() != null) { Point selection= fTextWidget.getSelectionRange(); if (selection != null) { IRegion r= widgetRange2ModelRange(new Region(selection.x, selection.y)); if (fFireEqualPostSelectionChange || (r != null && !r.equals(fLastSentPostSelectionChange)) || r == null) { fLastSentPostSelectionChange= r; fFireEqualPostSelectionChange= false; firePostSelectionChanged(selection.x, selection.y); } } } } } });
/** * Sends out a text selection changed event to all registered post selection changed 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 firePostSelectionChanged(int offset, int length) { if (redraws()) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); firePostSelectionChanged(event); } }
/** * Sends out a text selection changed event to all registered post selection changed 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 firePostSelectionChanged(int offset, int length) { if (redraws()) { IRegion r= widgetRange2ModelRange(new Region(offset, length)); ISelection selection= r != null ? new TextSelection(getDocument(), r.getOffset(), r.getLength()) : TextSelection.emptySelection(); SelectionChangedEvent event= new SelectionChangedEvent(this, selection); firePostSelectionChanged(event); } }