@Override
public Map<Annotation, Position> createAnnotationMap(XtextEditor editor, final ITextSelection selection, SubMonitor monitor) {
Map<Annotation, Position> map = null;
final IXtextDocument document = editor.getDocument();
if(document != null) {
map = document.readOnly(new IUnitOfWork<Map<Annotation, Position>, XtextResource>() {
public Map<Annotation, Position> exec(final XtextResource resource) throws Exception {
Map<Annotation,Position> m = new HashMap<Annotation, Position>();
if(resource != null) {
EObject target = eObjectAtOffsetHelper.resolveElementAt(resource, (selection).getOffset());