Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Hover support in custom editor(Newbie : Help required in implementing hover support)
icon5.gif  Hover support in custom editor [message #553653] Wed, 18 August 2010 11:36 Go to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Hi,

I am new to Eclipse as well as DLTK. I am developing an editor for a scripting langauge.

I want to enable function details display when mouse pointer hovers over a particular function. For this, I added an extension for "org.eclipse.dltk.ui.scriptDocumentationProviders" and implemented "IScriptDocumentationProvider" in the class that provides the extension. But I am not able to view any hover info when my mouse pointer hovers on the editor. Did I miss anything? I didnt do anything else for hover support other than providing the extension class.

Extension point entry in plugin.xml looks like this:
<extension point="org.eclipse.dltk.ui.scriptDocumentationProviders">
<provider class="sample.script.text.SampleDocumentationProvider"
id="sample.script.ui.SampleDocumentationProvider"
nature="sample.script.SampleNature">
</provider>
</extension>

While googling, I saw something like "you need to provide selection engine for using scriptDocumentationProviders extension". I then tried to implement a selection engine also by extending "ScriptSelectionEngine" but this too didnt give any result. I am not sure whether I implemented this selection engine in the correct way since I am not able to make out how to provide a link between selection engine and documentation provider.

I am using Eclipse 3.5 and DLTK 2.0.
Also please let me know the significance of "nature" field in the extension point in plugin.xml.

Thanks in advance,
Daisy
Re: Hover support in custom editor [message #554157 is a reply to message #553653] Fri, 20 August 2010 11:06 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Daisy,

Selection engine should identity model elements at the specified location (if any) and return them.

IModelElement[] select(IModuleSource module, int offset, int i);


The returned model elements then are passed to documentation provider, so your can return documentation for the specified model element.

public Reader getInfo(IMember element, boolean lookIntoParents, boolean lookIntoExternal);


"nature" attribute is required so DLTK can distinguish extensions for your language from extensions for other languages.

However, it is impossible to say what happens in your code without debugging.
If you are still experiencing some issues please provide more details.

Regards,
Alex
Re: Hover support in custom editor [message #555954 is a reply to message #554157] Mon, 30 August 2010 11:27 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Hi Alex,

Thank you for the reply.

As mentioned, I did implement "select" and "getInfo" functions in their respective classes. But in my case, I am not even getting the text hover event.

I have extended selection engine and documentation provider extension points.

Is there any place where I need to subscribe for the text hover event as we usually do in C#.Net?

Thanks,
Daisy.
Re: Hover support in custom editor [message #555969 is a reply to message #555954] Mon, 30 August 2010 12:25 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Daisy,

You subscribe via extension points - classes contributed to these extension points are loaded by DLTK and the corresponding methods are called.

Unfortunately, it's not clear what happens in your environment.
Have you tried to debug to understand:
- if your classes are loaded?
- if appropriate methods are called?

Regards,
Alex
Re: Hover support in custom editor [message #556221 is a reply to message #555969] Tue, 31 August 2010 11:52 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
I was wrong in saying that I am not getting hover event. I am getting that when mouse pointer hovers over text and "Ctrl" key is pressed. But I need the hover event without pressing "Ctrl" key. I know that this requires only some small change like preference setting but I can't trace out what it is Sad .

Thanks,
Daisy
Re: Hover support in custom editor [message #556234 is a reply to message #556221] Tue, 31 August 2010 12:25 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Daisy,

Defaults are initialized in (if you call it)
org.eclipse.dltk.ui.PreferenceConstants.initializeDefaultValues(IPreferenceStore, boolean)


Usually org.eclipse.dltk.ui.BestMatchHover is called without any modifiers and it selects first hover which returns some content.

Regards,
Alex

[Updated on: Tue, 31 August 2010 12:25]

Report message to a moderator

Re: Hover support in custom editor [message #556444 is a reply to message #556234] Wed, 01 September 2010 11:21 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Hi Alex,

"select" method call (function inside ISelectionEngine) which I got while pressing "Ctrl" key was not actually coming as part of text hover. When I checked the call stack, I understood that it is coming as part of detecting hyper link.

I am initializing the default preference values. But still I am not getting the hover event. I was able to get hold of the text hover event by implementing ITextHover interface. But I prefer doing it using ISelectionEngine itself since it is providing "F2" support also.

I will explain my requirement in case it is not clear.

I have a custom editor that is being developed for supporting a dynamic language. I am using DLTK for developing it. In the editor, when mouse hovers over a particular function/keyword, I want the help documentation to come which gives a brief description about the text over which mouse is hovering.

The figure under the heading "Selection in action"
in http://wiki.eclipse.org/DLTK_IDE_Guide:Step_3._Towards_an_ID E shows my requirement. I have followed the steps given in the link but in vain. Please let me know where I am going wrong.

Thanks,
Daisy.
Re: Hover support in custom editor [message #557272 is a reply to message #556444] Mon, 06 September 2010 11:54 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Any Updates?? Sad
Re: Hover support in custom editor [message #557347 is a reply to message #557272] Tue, 07 September 2010 02:58 Go to previous messageGo to next message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Hi Daisy,

I would recommend to set breakpoint in
org.eclipse.dltk.internal.ui.text.hover.BestMatchHover.getHoverInfo(ITextViewer, IRegion)
and try debugging it.
This class calls the other hovers and returns the matching one.

1st step is identifying if it's called.
2nd step is understanding if org.eclipse.dltk.internal.ui.text.hover.DocumentationHover is called from BestMatchHover
3rd step is understanding what's happening inside DocumentationHover

Regards,
Alex
Re: Hover support in custom editor [message #557433 is a reply to message #557347] Tue, 07 September 2010 12:02 Go to previous messageGo to next message
daisydale85 is currently offline daisydale85Friend
Messages: 38
Registered: August 2010
Member
Hi Alex,

I did try to debug that. "getHoveInfo" function of BestMatchHover is not getting hit. Do I need to enable any settings anywhere so as to get the hover event? I am already calling "initializeDefaultValues" of preference constants. Is there any other value to set?

Thanks,
Daisy.
Re: Hover support in custom editor [message #557486 is a reply to message #557433] Tue, 07 September 2010 16:23 Go to previous message
Alex Panchenko is currently offline Alex PanchenkoFriend
Messages: 342
Registered: July 2009
Senior Member
Text hover objects are attached in ScriptSourceViewerConfiguration.getTextHover(ISourceViewer, String, int)
Is it called in your setup?
Previous Topic:Where are the DLTK help files?
Next Topic:Installing Ruby & Getting Started
Goto Forum:
  


Current Time: Thu Mar 28 13:22:38 GMT 2024

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

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

Back to the top