protected void setLastRulerMouseLocation(ISourceViewer viewer, int line) {
   // set last mouse activity in order to get the correct context menu
   if (fCompositeRuler != null) {
     StyledText st = viewer.getTextWidget();
     if (st != null && !st.isDisposed()) {
       if (viewer instanceof ITextViewerExtension5) {
         int widgetLine = ((ITextViewerExtension5) viewer).modelLine2WidgetLine(line);
         Point loc = st.getLocationAtOffset(st.getOffsetAtLine(widgetLine));
         fCompositeRuler.setLocationOfLastMouseButtonActivity(0, loc.y);
       } else if (viewer instanceof TextViewer) {
         // TODO remove once TextViewer implements the extension
         int widgetLine = ((TextViewer) viewer).modelLine2WidgetLine(line);
         Point loc = st.getLocationAtOffset(st.getOffsetAtLine(widgetLine));
         fCompositeRuler.setLocationOfLastMouseButtonActivity(0, loc.y);
       }
     }
   }
 }