IDocument document= viewer.getDocument();
try {
JavaCodeReader reader= new JavaCodeReader();
reader.configureBackwardReader(document, offset, true, true);
int nestingLevel= 0;
int curr= reader.read();
while (curr != JavaCodeReader.EOF) {
if (')' == (char) curr)
++ nestingLevel;
else if ('(' == (char) curr) {
-- nestingLevel;
if (nestingLevel < 0) {
int start= reader.getOffset();
if (looksLikeMethod(reader))
return start + 1;
}
}
curr= reader.read();
}
} catch (IOException e) {
}
return contextPosition;