Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Can't get Code Folding Hover text to work
Can't get Code Folding Hover text to work [message #306277] Wed, 26 July 2006 09:59 Go to next message
Eclipse UserFriend
I have attempted to follow the example at:
http://www.eclipse.org/www/articles/Article-Folding-in-Eclip se-Text-Editors/folding.html
and have not had any luck getting the hover tip to show up. The same
question has been posted several times before with no solution yet:
http://dev.eclipse.org/newslists/news.eclipse.platform/msg44 918.html
http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg09 895.html

In one of the responses, it was suggested that the following method
should be debugged:
ProjectionAnnotationHover.getHoverInfo(ISourceViewer, ILineRange, int)

Unfortunately, that method is not being called. The problem appears to
be earlier, in the mouse handling.

The doEnableProjection() method does seem to be called successfully.

I've looked at the Java Editor (where this works just fine), and have
not seen any obvious relevant difference (although the Java editor does
a lot of setup). In the Java Editor, the mouse event appears to come
from AnnotationRuleColumn$5, but I haven't been able to tell why my
instance of that class wouldn't send the same event.

Are there any other suggestions?

Thanks,
Ernest
Re: Can't get Code Folding Hover text to work [message #306305 is a reply to message #306277] Wed, 26 July 2006 12:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom_eicher.ch.ibm.com

Ernest,

not sure what's going wrong. One thing I noticed when I quickly glanced
through the code and that may be the culprit:

For hovers to work, the ruler must have an AnnotationBarHoverManager
installed. This occurs in
SourceViewer#ensureAnnotationHoverManagerInstalled, which only installs
a manager if the following conditions are met:

- a vertical ruler is in place (I assume you have that)
- the SourceViewerConfiguration has provided an IAnnotationHover
@see SourceViewerConfiguration.getAnnotationHover()
- the SourceViewerConfiguration has provided a hover control creator
@see SourceViewerConfiguration.getInformationControlCreator()

Note that the latter is not needed directly for the projection hover,
since you provide a creator yourself. But it may be that the hovering
controller never gets setup.

Just something to check - please report back if this helps.
-tom

Ernest Pasour wrote:
> I have attempted to follow the example at:
> http://www.eclipse.org/www/articles/Article-Folding-in-Eclip se-Text-Editors/folding.html
> and have not had any luck getting the hover tip to show up. The same
> question has been posted several times before with no solution yet:
> http://dev.eclipse.org/newslists/news.eclipse.platform/msg44 918.html
> http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg09 895.html
>
> In one of the responses, it was suggested that the following method
> should be debugged:
> ProjectionAnnotationHover.getHoverInfo(ISourceViewer, ILineRange, int)
>
> Unfortunately, that method is not being called. The problem appears to
> be earlier, in the mouse handling.
>
> The doEnableProjection() method does seem to be called successfully.
>
> I've looked at the Java Editor (where this works just fine), and have
> not seen any obvious relevant difference (although the Java editor does
> a lot of setup). In the Java Editor, the mouse event appears to come
> from AnnotationRuleColumn$5, but I haven't been able to tell why my
> instance of that class wouldn't send the same event.
>
> Are there any other suggestions?
>
> Thanks,
> Ernest
Re: Can't get Code Folding Hover text to work [message #306311 is a reply to message #306305] Wed, 26 July 2006 13:24 Go to previous messageGo to next message
Eclipse UserFriend
That was it. Thank you! I added the following override to my source
viewer configuration and the hover works as expected. Should I be
subclassing from TextSourceViewerConfiguration instead of
SourceViewerConfiguration?


public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
{
return new DefaultAnnotationHover();
}


Tom Eicher wrote:
> Ernest,
>
> not sure what's going wrong. One thing I noticed when I quickly glanced
> through the code and that may be the culprit:
>
> For hovers to work, the ruler must have an AnnotationBarHoverManager
> installed. This occurs in
> SourceViewer#ensureAnnotationHoverManagerInstalled, which only installs
> a manager if the following conditions are met:
>
> - a vertical ruler is in place (I assume you have that)
> - the SourceViewerConfiguration has provided an IAnnotationHover
> @see SourceViewerConfiguration.getAnnotationHover()
> - the SourceViewerConfiguration has provided a hover control creator
> @see SourceViewerConfiguration.getInformationControlCreator()
>
> Note that the latter is not needed directly for the projection hover,
> since you provide a creator yourself. But it may be that the hovering
> controller never gets setup.
>
> Just something to check - please report back if this helps.
> -tom
>
> Ernest Pasour wrote:
>> I have attempted to follow the example at:
>> http://www.eclipse.org/www/articles/Article-Folding-in-Eclip se-Text-Editors/folding.html
>> and have not had any luck getting the hover tip to show up. The same
>> question has been posted several times before with no solution yet:
>> http://dev.eclipse.org/newslists/news.eclipse.platform/msg44 918.html
>> http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg09 895.html
>>
>> In one of the responses, it was suggested that the following method
>> should be debugged:
>> ProjectionAnnotationHover.getHoverInfo(ISourceViewer, ILineRange, int)
>>
>> Unfortunately, that method is not being called. The problem appears
>> to be earlier, in the mouse handling.
>>
>> The doEnableProjection() method does seem to be called successfully.
>>
>> I've looked at the Java Editor (where this works just fine), and have
>> not seen any obvious relevant difference (although the Java editor
>> does a lot of setup). In the Java Editor, the mouse event appears to
>> come from AnnotationRuleColumn$5, but I haven't been able to tell why
>> my instance of that class wouldn't send the same event.
>>
>> Are there any other suggestions?
>>
>> Thanks,
>> Ernest
Re: Can't get Code Folding Hover text to work [message #306333 is a reply to message #306311] Thu, 27 July 2006 03:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom_eicher.ch.ibm.com

Ernest Pasour wrote:
> That was it. Thank you! I added the following override to my source
> viewer configuration and the hover works as expected.

Glad to help. I filed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=151955 to track this
issue. This dependency is just wrong and not documented and not needed.

> Should I be
> subclassing from TextSourceViewerConfiguration instead of
> SourceViewerConfiguration?

For an IDE plug-in I would recommend using TextSourceViewerConfig with
the EditorsUI.getPreferenceStore(), since you get the default editor
preferences this way (e.g. for hyperlink colors, undo history size...).

For a non-IDE rich client, you have to stick with SourceViewerConfig, of
course.

-tom
Re: Can't get Code Folding Hover text to work [message #308857 is a reply to message #306277] Thu, 05 October 2006 13:01 Go to previous message
Eclipse UserFriend
Originally posted by: gerold.broser.easyklick.com

Ernest Pasour wrote:
> I have attempted to follow the example at:
> http://www.eclipse.org/www/articles/Article-Folding-in-Eclip se-Text-Editors/folding.html

For those who are interested in code folding, too: The link Ernest
mentioned is dead (meanwhile?).

Use this:
http://www.eclipse.org/articles/Article-Folding-in-Eclipse-T ext-Editors/folding.html
Previous Topic:Class which does not compile with eclipse
Next Topic:Problems occurred when invoking code from plug-in: "org.eclipse.jface".
Goto Forum:
  


Current Time: Wed Apr 30 07:31:19 EDT 2025

Powered by FUDForum. Page generated in 0.04479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top