thSoft / eclipse-commons

Eclipse Commons

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

focus gain/loss of Score view is slow

nittka opened this issue · comments

Switching between views is usually quite fast (editor <-> explorer), However, switching to and from the Score view takes about 2 seconds (if a large pdf document is open - even in the background only). We should try to identify the source of the delay.

The problem seems to be caused by the click&point annotations. When opening the same pdf without annotations switching views is fast.

The checkWidget method is called for all (many many) PdfAnnotationHyperlinks when the Score view gains and loses focus. This causes the long delay.
An option is to dispose the links on losing focus and recreating them on gainging focus (the redraw invoked by the HyperlinkHighlightAnimator does that anyway). A disadvantage for the user is that she has to click on the score once before the hyperlinks become "visible" (so a mouseover when the editor has focus does not show the link). The advantage is that the score view reacts very fast (immediate focus and then you can click on a note).

Told from a different starting point: If the editor has focus and I click on a link in the score view, I have to wait for it to gain focus (checkWidget for all annotatiosn) and lose focus immediately (checkWidget for all annotations again) before the link target is opened in the editor.
The delay depends on the number of annotations on the current page. On my machine, with 150 annotations the delay is OK, with 300 it is very noticable with 500 unbearable.

I have tried around a bit more. I was not able to restrict execution time by overriding the problematic methods. Eliminating the many composites seems to be the only way to get rid of the delay completely.