* @return <code>true</code> if the element was successfully revealed in the
* editor; <code>false</code> otherwise
*/
public static boolean revealInTextEditor(final ITextEditor textEditor,
final ISourceElement element) {
ISourceElementInfo info;
try {
info = element.getSourceElementInfo();
} catch (final CoreException e) {
if (!element.exists()) {
// this is considered normal
} else {
ErlLogger.error(e);
}
return false;
}
final TextRange identifyingRange = info.getIdentifyingRange();
if (identifyingRange.isNull()) {
return false;
}
textEditor.selectAndReveal(identifyingRange.getOffset(),
identifyingRange.getLength());