@Override public int getLineOfOffset(int pos) throws BadLocationException { return super.getLineOfOffset(pos); } /* (non-Javadoc)
public int getLineOfOffset(int pos) throws BadLocationException { return super.getLineOfOffset(pos); } /* (non-Javadoc)
@Override public int getLineOfOffset(int pos) throws BadLocationException { Object lockObject= getLockObject(); if (lockObject == null) { return super.getLineOfOffset(pos); } synchronized (lockObject) { return super.getLineOfOffset(pos); } } }
/** * Returns the new line number of the from the source of the specified member's compilation unit * @param member the member to query * @param offset the offset * @return the new line number * @throws JavaModelException */ private int getNewLineNumber(IMember member, int offset) throws JavaModelException { int lineNumber = getLineNumber(); Document document = new Document(member.getCompilationUnit().getSource()); try { lineNumber = document.getLineOfOffset(offset); } catch (BadLocationException e) { } return lineNumber; }
int line = doc.getLineOfOffset(start); line--; if (line < 0)
private void initCallTextAndLineNumber() { if (fCallText != null) return; IBuffer buffer= getBufferForMember(); if (buffer == null || buffer.getLength() < fEnd) { //binary, without source attachment || buffer contents out of sync (bug 121900) fCallText= ""; //$NON-NLS-1$ fLineNumber= UNKNOWN_LINE_NUMBER; return; } fCallText= buffer.getText(fStart, (fEnd - fStart)); if (fLineNumber == UNKNOWN_LINE_NUMBER) { Document document= new Document(buffer.getContents()); try { fLineNumber= document.getLineOfOffset(fStart) + 1; } catch (BadLocationException e) { JavaPlugin.log(e); } } }
private void initCallTextAndLineNumber() { if (fCallText != null) return; IBuffer buffer= getBufferForMember(); if (buffer == null || buffer.getLength() < fEnd) { //binary, without source attachment || buffer contents out of sync (bug 121900) fCallText= ""; //$NON-NLS-1$ fLineNumber= UNKNOWN_LINE_NUMBER; return; } fCallText= buffer.getText(fStart, (fEnd - fStart)); if (fLineNumber == UNKNOWN_LINE_NUMBER) { Document document= new Document(buffer.getContents()); try { fLineNumber= document.getLineOfOffset(fStart) + 1; } catch (BadLocationException e) { JavaPlugin.log(e); } } }
private void initCallTextAndLineNumber() { if (fCallText != null) return; IBuffer buffer= getBufferForMember(); if (buffer == null || buffer.getLength() < fEnd) { //binary, without source attachment || buffer contents out of sync (bug 121900) fCallText= ""; //$NON-NLS-1$ fLineNumber= UNKNOWN_LINE_NUMBER; return; } fCallText= buffer.getText(fStart, (fEnd - fStart)); if (fLineNumber == UNKNOWN_LINE_NUMBER) { Document document= new Document(buffer.getContents()); try { fLineNumber= document.getLineOfOffset(fStart) + 1; } catch (BadLocationException e) { JavaPlugin.log(e); } } }
installStuff(temp); int offset = c.offset; int line = temp.getLineOfOffset(offset); String lastIndent = getLineIndent(temp, line); int firstLineOffset = temp.getLineOffset(line);