/** * Set the selection * * @param offset * the offset * @param length * the length */ public void setSelectionRange(int offset, int length) { setSelection(new TextSelection(offset, length)); }
if( getControl().getSelection().contains(targetOffset) ) { this.dragMoveTextMode = false; event.consume(); getControl().setSelection(new TextSelection(targetOffset, text.length()));
@Override public TextSelection getSelection(IDocument document) { org.eclipse.fx.code.editor.services.CompletionProposal.TextSelection selection = proposal.getSelection(document); return new TextSelection(selection.offset, selection.length); }
/** * Set the selection * * @param offset * the offset * @param length * the length */ public void setSelectionRange(int offset, int length) { setSelection(new TextSelection(offset, length)); }
@Override public TextSelection getSelection(IDocument document) { org.eclipse.fx.code.editor.services.CompletionProposal.TextSelection selection = proposal.getSelection(document); return selection == null ? TextSelection.EMPTY : new TextSelection(selection.offset, selection.length); }
@Override public TextSelection getSelection(IDocument document) { org.eclipse.fx.code.editor.services.CompletionProposal.TextSelection selection = proposal.getSelection(document); return new TextSelection(selection.offset, selection.length); } }
@Override public TextSelection getSelection(IDocument document) { org.eclipse.fx.code.editor.services.CompletionProposal.TextSelection selection = proposal.getSelection(document); return selection == null ? TextSelection.EMPTY : new TextSelection(selection.offset, selection.length); } }
private TextSelection convert(IRegion selection) { return new TextSelection(selection.getOffset(), selection.getLength()); } private IRegion convert(TextSelection selection) {
public void selectWithCaretAtStart() { moveCaretAbsolute(this.start); getControl().setSelection(new TextSelection(this.start, this.length)); }
/** * @return the current selection */ public @NonNull TextSelection getSelection() { TextSelection textSelection = this.currentSelection.get(); if (textSelection == null) { textSelection = new TextSelection(getCaretOffset(), 0); } return textSelection; }
/** * @return the current selection */ public @NonNull TextSelection getSelection() { TextSelection textSelection = this.currentSelection.get(); if (textSelection == null) { textSelection = new TextSelection(getCaretOffset(), 0); } return textSelection; }
public void selectWithCaretAtEnd() { moveCaretAbsolute(this.end); getControl().setSelection(new TextSelection(this.start, this.length)); }
void updateSelection(int startOffset, int replacedLength, int newLength) { if (getSelection().offset + getSelection().length > startOffset && getSelection().offset < startOffset + replacedLength) { // selection intersects replaced text. set caret behind text change setSelection(new TextSelection(startOffset + newLength, 0)/*, true, false*/); } else { // move selection to keep same text selected setSelection(new TextSelection(getSelection().offset + newLength - replacedLength, getSelection().length)/*, true, false*/); if( getSelection().length > 0 ) { int delta = this.lastTextChangeNewCharCount - this.lastTextChangeReplaceCharCount; this.caretOffsetProperty.set(Math.max(0,Math.min(getCharCount()-1,getCaretOffset() + delta))); } } }
@Override public void changed(ObservableValue<? extends TextSelection> observable, TextSelection oldValue, TextSelection newValue) { if (newValue == null || newValue.length == 0) { for (LineCell c : getCurrentVisibleCells()) { if (c.getGraphic() != null) { StyledTextLayoutContainer block = (StyledTextLayoutContainer) c.getGraphic(); block.setSelection(new TextSelection(0, 0)); } } } else { TextSelection selection = newValue; for (LineCell c : getCurrentVisibleCells()) { if (c.getGraphic() != null) { Line arg0 = c.domainElement; StyledTextLayoutContainer block = (StyledTextLayoutContainer) c.getGraphic(); if (selection.length > 0 && block.intersectOffset(selection.offset, selection.offset + selection.length)) { int start = Math.max(0, selection.offset - arg0.getLineOffset()); if (arg0.getLineOffset() + arg0.getLineLength() > selection.offset + selection.length) { block.setSelection(new TextSelection(start, selection.offset + selection.length - arg0.getLineOffset() - start)); } else { block.setSelection(new TextSelection(start, arg0.getLineLength() - start)); } } else { block.setSelection(new TextSelection(0, 0)); } } } } } });
void updateSelection(int startOffset, int replacedLength, int newLength) { if (getSelection().offset + getSelection().length > startOffset && getSelection().offset < startOffset + replacedLength) { // selection intersects replaced text. set caret behind text change setSelection(new TextSelection(startOffset + newLength, 0)/* , true, false */); } else { // move selection to keep same text selected int computedOffset = getSelection().offset + newLength - replacedLength; if (computedOffset >= 0 && computedOffset < getCharCount()) { // we only set this if the offset is valid!! setSelection(new TextSelection(computedOffset, getSelection().length)/* , true, false */); } if (getSelection().length > 0) { int delta = this.lastTextChangeNewCharCount - this.lastTextChangeReplaceCharCount; this.caretOffsetProperty.set(Math.max(0, Math.min(getCharCount() - 1, getCaretOffset() + delta))); } } }
private void doLink(QuickLink link) { if (link instanceof SimpleQuickLink) { SimpleQuickLink simple = (SimpleQuickLink) link; getControl().setCaretOffset(simple.getRegion().upperEndpoint()); getControl().setSelection(new TextSelection(simple.getRegion().lowerEndpoint(), simple.getRegion().upperEndpoint() - simple.getRegion().lowerEndpoint())); } else if (link instanceof CustomQuickLink) { CustomQuickLink custom = (CustomQuickLink) link; custom.getAction().run(); } }
private void onSourceSelect(SourceSelection data) { if (((URIProvider)input).getURI().equals(data.uri)) { getSourceViewer().getTextWidget().setCaretOffset(data.selection.getOffset() + data.selection.getLength()); getSourceViewer().getTextWidget().setSelection(new TextSelection(data.selection.getOffset(), data.selection.getLength())); getSourceViewer().getTextWidget().revealCaret(); } }
block.setSelection(new TextSelection(start, selection.offset + selection.length - arg0.getLineOffset() - start)); } else { block.setSelection(new TextSelection(start, arg0.getLineLength() - start)); block.setSelection(new TextSelection(0, 0));
c.setDelegate(new EditingContext() { private TextSelection convert(IRegion selection) { return new TextSelection(selection.getOffset(), selection.getLength());
getSkinnable().getContent().replaceTextRange(lineIndex.get(), 0, insert); getSkinnable().setCaretOffset(lineIndex.get() + insert.length()); getSkinnable().setSelection(new TextSelection(lineIndex.get(), insert.length())); updateInsertionMarkerIndex(-1); e.setDropCompleted(true);