@Override String getText(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; StringBuilder buf= new StringBuilder(cts.getLength()); int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn); for (int line= startLine; line <= endLine; line++) { appendColumnRange(buf, line, visualStartColumn, visualEndColumn); if (line != endLine) buf.append(fDocument.getLineDelimiter(line)); } return buf.toString(); }
@Override String getText(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; StringBuffer buf= new StringBuffer(cts.getLength()); int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn); for (int line= startLine; line <= endLine; line++) { appendColumnRange(buf, line, visualStartColumn, visualEndColumn); if (line != endLine) buf.append(fDocument.getLineDelimiter(line)); } return buf.toString(); }
@Override boolean isEmpty(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn); return visualEndColumn == visualStartColumn; }
@Override boolean isEmpty(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn); return visualEndColumn == visualStartColumn; }
@Override TextEdit delete(ISelection selection) throws BadLocationException { if (isEmpty(selection)) { IBlockTextSelection cts= (IBlockTextSelection)selection; selection= new BlockTextSelection(fDocument, cts.getStartLine(), cts.getStartColumn(), cts.getEndLine(), cts.getEndColumn() + 1, fTabWidth); } return replace(selection, "", true); //$NON-NLS-1$ }
@Override TextEdit delete(ISelection selection) throws BadLocationException { if (isEmpty(selection)) { IBlockTextSelection cts= (IBlockTextSelection)selection; selection= new BlockTextSelection(fDocument, cts.getStartLine(), cts.getStartColumn(), cts.getEndLine(), cts.getEndColumn() + 1, fTabWidth); } return replace(selection, "", true); //$NON-NLS-1$ }
@Override TextEdit backspace(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; if (isEmpty(selection) && cts.getStartColumn() > 0) { selection= new BlockTextSelection(fDocument, cts.getStartLine(), cts.getStartColumn() - 1, cts.getEndLine(), cts.getEndColumn(), fTabWidth); } return replace(selection, ""); //$NON-NLS-1$ }
@Override TextEdit backspace(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; if (isEmpty(selection) && cts.getStartColumn() > 0) { selection= new BlockTextSelection(fDocument, cts.getStartLine(), cts.getStartColumn() - 1, cts.getEndLine(), cts.getEndColumn(), fTabWidth); } return replace(selection, ""); //$NON-NLS-1$ }
@Override IRegion[] getRanges(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; final int startLine= cts.getStartLine(); final int endLine= cts.getEndLine(); int visualStartColumn= computeVisualColumn(startLine, cts.getStartColumn()); int visualEndColumn= computeVisualColumn(endLine, cts.getEndColumn()); IRegion[] ranges= new IRegion[endLine - startLine + 1]; for (int line= startLine; line <= endLine; line++) { int startColumn= computeCharacterColumn(line, visualStartColumn); int endColumn= computeCharacterColumn(line, visualEndColumn); IRegion lineInfo= fDocument.getLineInformation(line); int lineEnd= lineInfo.getLength(); startColumn= Math.min(startColumn, lineEnd); endColumn= Math.min(endColumn, lineEnd); ranges[line - startLine]= new Region(lineInfo.getOffset() + startColumn, endColumn - startColumn); } return ranges; }
@Override IRegion[] getRanges(ISelection selection) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; final int startLine= cts.getStartLine(); final int endLine= cts.getEndLine(); int visualStartColumn= computeVisualColumn(startLine, cts.getStartColumn()); int visualEndColumn= computeVisualColumn(endLine, cts.getEndColumn()); IRegion[] ranges= new IRegion[endLine - startLine + 1]; for (int line= startLine; line <= endLine; line++) { int startColumn= computeCharacterColumn(line, visualStartColumn); int endColumn= computeCharacterColumn(line, visualEndColumn); IRegion lineInfo= fDocument.getLineInformation(line); int lineEnd= lineInfo.getLength(); startColumn= Math.min(startColumn, lineEnd); endColumn= Math.min(endColumn, lineEnd); ranges[line - startLine]= new Region(lineInfo.getOffset() + startColumn, endColumn - startColumn); } return ranges; }
int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn);
int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn(); int endColumn= cts.getEndColumn(); int visualStartColumn= computeVisualColumn(startLine, startColumn); int visualEndColumn= computeVisualColumn(endLine, endColumn);
final Position position; if (selection instanceof IBlockTextSelection) position= new ColumnPosition(selection.getOffset(), selection.getLength(), ((IBlockTextSelection) selection).getStartColumn(), ((IBlockTextSelection) selection).getEndColumn()); else position= new Position(selection.getOffset(), selection.getLength());
final Position position; if (selection instanceof IBlockTextSelection) position= new ColumnPosition(selection.getOffset(), selection.getLength(), ((IBlockTextSelection) selection).getStartColumn(), ((IBlockTextSelection) selection).getEndColumn()); else position= new Position(selection.getOffset(), selection.getLength());
@Override ISelection makeEmpty(ISelection selection, boolean beginning) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine, startColumn, endLine, endColumn; if (beginning) { startLine= cts.getStartLine(); startColumn= cts.getStartColumn(); endLine= cts.getEndLine(); endColumn= computeCharacterColumn(endLine, computeVisualColumn(startLine, startColumn)); } else { endLine= cts.getEndLine(); endColumn= cts.getEndColumn(); startLine= cts.getStartLine(); startColumn= computeCharacterColumn(startLine, computeVisualColumn(endLine, endColumn)); } return new BlockTextSelection(fDocument, startLine, startColumn, endLine, endColumn, fTabWidth); }
@Override ISelection makeEmpty(ISelection selection, boolean beginning) throws BadLocationException { IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine, startColumn, endLine, endColumn; if (beginning) { startLine= cts.getStartLine(); startColumn= cts.getStartColumn(); endLine= cts.getEndLine(); endColumn= computeCharacterColumn(endLine, computeVisualColumn(startLine, startColumn)); } else { endLine= cts.getEndLine(); endColumn= cts.getEndColumn(); startLine= cts.getStartLine(); startColumn= computeCharacterColumn(startLine, computeVisualColumn(endLine, endColumn)); } return new BlockTextSelection(fDocument, startLine, startColumn, endLine, endColumn, fTabWidth); }
int endVirtuals= Math.max(0, s.getEndColumn() - endLineLength); IRegion endRegion= new Region(endLineInfo.getOffset() + s.getEndColumn() - endVirtuals, 0); int endOffset= modelRange2ClosestWidgetRange(endRegion).getOffset(); Point clientAreaOrigin= new Point(fTextWidget.getHorizontalPixel(), fTextWidget.getTopPixel());
int endVirtuals= Math.max(0, s.getEndColumn() - endLineLength); IRegion endRegion= new Region(endLineInfo.getOffset() + s.getEndColumn() - endVirtuals, 0); int endOffset= modelRange2ClosestWidgetRange(endRegion).getOffset(); Point clientAreaOrigin= new Point(fTextWidget.getHorizontalPixel(), fTextWidget.getTopPixel());
IBlockTextSelection bts= (IBlockTextSelection) selection; int startVirtual= Math.max(0, bts.getStartColumn() - document.getLineInformationOfOffset(bts.getOffset()).getLength()); int endVirtual= Math.max(0, bts.getEndColumn() - document.getLineInformationOfOffset(bts.getOffset() + bts.getLength()).getLength()); fSelection= new ColumnPosition(bts.getOffset(), bts.getLength(), startVirtual, endVirtual); } else {
IBlockTextSelection bts= (IBlockTextSelection) selection; int startVirtual= Math.max(0, bts.getStartColumn() - document.getLineInformationOfOffset(bts.getOffset()).getLength()); int endVirtual= Math.max(0, bts.getEndColumn() - document.getLineInformationOfOffset(bts.getOffset() + bts.getLength()).getLength()); fSelection= new ColumnPosition(bts.getOffset(), bts.getLength(), startVirtual, endVirtual); } else {