Beispiel #1
0
 private IHyperlink getHyperlink(MouseEvent e) {
   // bug 257868 support image hyperlinks
   if (annotations.isEmpty()) {
     return null;
   }
   Point point = new Point(e.x, e.y);
   for (ImageAnnotation annotation : annotations) {
     if (annotation.getHyperlnkAnnotation() == null) {
       continue;
     }
     Rectangle region = getRegion(annotation);
     if (region != null) {
       if (region.contains(point)) {
         AnnotationHyperlinkDetector detector =
             (AnnotationHyperlinkDetector)
                 viewer.getTextWidget().getData(AnnotationHyperlinkDetector.class.getName());
         if (detector != null) {
           IHyperlink hyperlink =
               detector.createHyperlink(
                   viewer, viewer.getAnnotationModel(), annotation.getHyperlnkAnnotation());
           return hyperlink;
         }
       }
     }
   }
   return null;
 }