@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 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); }
@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 ISelection makeReplaceSelection(ISelection selection, String replacement) throws BadLocationException { IBlockTextSelection bts= (IBlockTextSelection)selection; String[] delimiters= fDocument.getLegalLineDelimiters(); int[] index= TextUtilities.indexOf(delimiters, replacement, 0); int length; if (index[0] == -1) length= replacement.length(); else length= index[0]; int startLine= bts.getStartLine(); int column= bts.getStartColumn() + length; int endLine= bts.getEndLine(); int endColumn= computeCharacterColumn(endLine, computeVisualColumn(startLine, column)); return new BlockTextSelection(fDocument, startLine, column, endLine, endColumn, fTabWidth); }
@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 ISelection makeReplaceSelection(ISelection selection, String replacement) throws BadLocationException { IBlockTextSelection bts= (IBlockTextSelection)selection; String[] delimiters= fDocument.getLegalLineDelimiters(); int[] index= TextUtilities.indexOf(delimiters, replacement, 0); int length; if (index[0] == -1) length= replacement.length(); else length= index[0]; int startLine= bts.getStartLine(); int column= bts.getStartColumn() + length; int endLine= bts.getEndLine(); int endColumn= computeCharacterColumn(endLine, computeVisualColumn(startLine, column)); return new BlockTextSelection(fDocument, startLine, column, endLine, endColumn, fTabWidth); }
@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; }
MultiTextEdit root; IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn();
MultiTextEdit root; IBlockTextSelection cts= (IBlockTextSelection)selection; int startLine= cts.getStartLine(); int endLine= cts.getEndLine(); int startColumn= cts.getStartColumn();
int startLine= s.getStartLine(); int endLine= s.getEndLine(); IRegion startLineInfo= fDocument.getLineInformation(startLine);
int startLine= s.getStartLine(); int endLine= s.getEndLine(); IRegion startLineInfo= fDocument.getLineInformation(startLine);