private int getCurrentLineStart(String str, int pos) { for (int i= pos - 1; i>= 0; i--) { char ch= str.charAt(i); if (IndentManipulation.isLineDelimiterChar(ch)) { return i+1; } } return 0; }
private int getCurrentLineStart(String str, int pos) { for (int i= pos - 1; i>= 0; i--) { char ch= str.charAt(i); if (IndentManipulation.isLineDelimiterChar(ch)) { return i+1; } } return 0; }
private int getCurrentLineStart(String str, int pos) { for (int i= pos - 1; i>= 0; i--) { char ch= str.charAt(i); if (IndentManipulation.isLineDelimiterChar(ch)) { return i+1; } } return 0; }
private int getCurrentLineStart(String str, int pos) { for (int i= pos - 1; i>= 0; i--) { char ch= str.charAt(i); if (IndentManipulation.isLineDelimiterChar(ch)) { return i+1; } } return 0; }
private String getCurrentLine(String str, int pos) { for (int i= pos - 1; i>= 0; i--) { char ch= str.charAt(i); if (IndentManipulation.isLineDelimiterChar(ch)) { return str.substring(i + 1, pos); } } return str.substring(0, pos); }
/** * Returns <code>true</code> if the given character is an indentation character. Indentation character are all whitespace characters * except the line delimiter characters. * * @param ch the given character * @return Returns <code>true</code> if this the character is a indent character, <code>false</code> otherwise */ public static boolean isIndentChar(char ch) { return ScannerHelper.isWhitespace(ch) && !isLineDelimiterChar(ch); }
public boolean isEndOfLineComment(int offset, char[] content) { if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) { return false; } return Arrays.binarySearch(getOffsets(), offset) >= 0; }
public boolean isEndOfLineComment(int offset, char[] content) { if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) { return false; } return Arrays.binarySearch(getOffsets(), offset) >= 0; }
public boolean isEndOfLineComment(int offset, char[] content) { if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) { return false; } return Arrays.binarySearch(getOffsets(), offset) >= 0; }
public boolean isEndOfLineComment(int offset, char[] content) { if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) { return false; } return Arrays.binarySearch(getOffsets(), offset) >= 0; }
/** * Returns <code>true</code> if the given character is an indentation character. Indentation character are all whitespace characters * except the line delimiter characters. * * @param ch the given character * @return Returns <code>true</code> if this the character is a indent character, <code>false</code> otherwise */ public static boolean isIndentChar(char ch) { return ScannerHelper.isWhitespace(ch) && !isLineDelimiterChar(ch); }
private SearchPatternData trySimpleTextSelection(ITextSelection selection) { String selectedText= selection.getText(); if (selectedText != null && selectedText.length() > 0) { int i= 0; while (i < selectedText.length() && !IndentManipulation.isLineDelimiterChar(selectedText.charAt(i))) { i++; } if (i > 0) { return new SearchPatternData(TYPE, REFERENCES, 0, fIsCaseSensitive, selectedText.substring(0, i), null, JavaSearchScopeFactory.ALL); } } return null; }
private boolean needsNewLineForLineComment(ASTNode node, String formatted, int offset) { if (!this.lineCommentEndOffsets.isEndOfLineComment(getExtendedEnd(node), this.content)) { return false; } // copied code ends with a line comment, but doesn't contain the new line return offset < formatted.length() && !IndentManipulation.isLineDelimiterChar(formatted.charAt(offset)); }
private boolean needsNewLineForLineComment(ASTNode node, String formatted, int offset) { if (!this.lineCommentEndOffsets.isEndOfLineComment(getExtendedEnd(node), this.content)) { return false; } // copied code ends with a line comment, but doesn't contain the new line return offset < formatted.length() && !IndentManipulation.isLineDelimiterChar(formatted.charAt(offset)); }
private boolean needsNewLineForLineComment(ASTNode node, String formatted, int offset) { if (!this.lineCommentEndOffsets.isEndOfLineComment(getExtendedEnd(node), this.content)) { return false; } // copied code ends with a line comment, but doesn't contain the new line return offset < formatted.length() && !IndentManipulation.isLineDelimiterChar(formatted.charAt(offset)); }
private static int findLineEnd(ICompilationUnit cu, int position) throws JavaModelException { IBuffer buffer= cu.getBuffer(); int length= buffer.getLength(); for (int i= position; i < length; i++) { if (IndentManipulation.isLineDelimiterChar(buffer.getChar(i))) { return i; } } return length; } }
private static int findLineEnd(ICompilationUnit cu, int position) throws JavaModelException { IBuffer buffer= cu.getBuffer(); int length= buffer.getLength(); for (int i= position; i < length; i++) { if (IndentManipulation.isLineDelimiterChar(buffer.getChar(i))) { return i; } } return length; }
private static int findLineEnd(ICompilationUnit cu, int position) throws JavaModelException { IBuffer buffer= cu.getBuffer(); int length= buffer.getLength(); for (int i= position; i < length; i++) { if (IndentManipulation.isLineDelimiterChar(buffer.getChar(i))) { return i; } } return length; }
public static int getIndentUsed(IBuffer buffer, int offset, IJavaProject project) { int i= offset; // find beginning of line while (i > 0 && !IndentManipulation.isLineDelimiterChar(buffer.getChar(i - 1))) { i--; } return Strings.computeIndentUnits(buffer.getText(i, offset - i), project); }
private static int getIndentUsed(IBuffer buffer, int offset, IJavaProject project) { int i= offset; // find beginning of line while (i > 0 && !IndentManipulation.isLineDelimiterChar(buffer.getChar(i - 1))) { i--; } return Strings.computeIndentUnits(buffer.getText(i, offset - i), project); }