final ISourceReference reference = (ISourceReference) element;
final ISourceRange range = reference.getSourceRange();
if (range != null) {
viewer.setSelectedRange(range.getOffset(), range.getLength());
viewer.doOperation(ISourceViewer.FORMAT);
}
}
}
} catch (ModelException exception) {
// Should not happen