How to export custom hovers as plug in ? [message #1841890] |
Wed, 02 June 2021 08:38  |
Eclipse User |
|
|
|
Hello,
I am new to Xtext & DSL writing. I am trying to implement a debugger as an Eclipse plug in, that needs to be DSL independant. I am working on Gemoc Studio.
I would like to add custom hovers to my debugger. Following tutorials, I saw that for a 'local application', our custom hover class that extends DefaultEObjectHoverProvider needs to be binded in the language's Module like this :
public class MyDslUiModule extends AbstractMyDslUiModule {
public MyDslUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
return MyDslEObjectHoverProvider.class;
}
}
However, I want to avoid touching the DSL's code, and want my Hover plug in to be automatically used. Is there another way to tell the DSL that it should use the plug in's custom hover ? Can I do it from the IEngineAddon ?
I hope I was clear enough,
Thanks in advance
[Updated on: Wed, 02 June 2021 08:54] by Moderator
|
|
|
|
|
|
|
|
|
Re: How to export custom hovers as plug in ? [message #1841964 is a reply to message #1841933] |
Fri, 04 June 2021 10:56   |
Eclipse User |
|
|
|
Hello again,
Yes I tried debugging it, along with other components but I found nothing interesting and am stuck here.
I thought this could be a lead :
http://https://wiki.eclipse.org/FAQ_How_do_I_add_hover_support_to_my_text_editor%3F
but it does not work for me (maybe I'm implementing it wrong)
My structure is like this :
My plugin has a BehaviorManager, that extends IEngineAddon. I also have an Activator class, that extends AbstractUIPlugin. Both classes are declared in my Manifest file.
In my BehaviorManager, I override the stepExecuted()method. This method, after each debugging step, calls a Commenter class that writes a comment next to the value we are interested in.
I wrote 2 hover classes, not knowing which one I am supposed to use :
HoverProvider, that extends DefaultEObjectHoverProvider, and DebugHover, that extends ITextHover.
<plugin>
<extension
point="org.eclipse.gemoc.gemoc_language_workbench.engine_addon">
<addon
addonGroupId="Concurrent.AddonGroup"
class="org.eclipse.gemoc.addon.xtextanimator.ui.XtextAnimatorBehaviorManager"
default="false"
name="Xtext Animator"
shortDescription="Doing stuff to your text"
id="xtext_animator">
</addon>
</extension>
<extension point="org.eclipse.ui.genericeditor.hoverProviders">
<hoverProvider
class="org.eclipse.gemoc.addon.xtextanimator.ui.hover.HoverProvider">
</hoverProvider>
</extension>
</plugin>
|
|
|
|
Re: How to export custom hovers as plug in ? [message #1842005 is a reply to message #1841972] |
Mon, 07 June 2021 02:29   |
Eclipse User |
|
|
|
Hello again,
I know that Xtext implements hovers, but from what I've seen through tutorials, you can create custom hovers by extending DefaultEObjectHover, and then binding that custom hover in the language's UI Module :
https://dietrich-it.de/xtext/2011/07/16/hover-support-in-xtext-2.0-tutorial/
I want to do something like this, I want my plug in to provide custom hovers. I thought of doing it like in the tutorial, by creating a class that extends the DefaultEObjectHover. However, if I do this, I need to edit my DSL's UIModule class, and that is what I want to avoid.
When I use the DefaultEObjectHover, the DefaultCompositeHover does not seem to be called.
Is there a way to provide to a DSL the plugin's custom hovers without writing the binding method in the DSL's UIModule ?
|
|
|
|
|
|
|
|
Re: How to export custom hovers as plug in ? [message #1842028 is a reply to message #1842020] |
Mon, 07 June 2021 14:20   |
Eclipse User |
|
|
|
Hi
It depends what you call the DSL. Obviously it includes a *.xtext file, but also it includes a *.mwe2 file where you can use fragments to reduce src tree customization, but almost certainly you will have other src customization for value converters, highlighting, scope resolution, generators, validation, outlines, serialization, quick fixes, .... so why are you so frightened about customization for hovers?
Regards
Ed Willink
|
|
|
Re: How to export custom hovers as plug in ? [message #1842107 is a reply to message #1842028] |
Wed, 09 June 2021 07:42  |
Eclipse User |
|
|
|
Hello,
Thank you both for your help & advice.
Ed Willis, for my hover customization plug in, I just wanted to know if it was possible to provide hovers to the DSL without having to change the DSL's files (mwe2, module).
For know, I'm putting this gaol aside and am binding my hovers in my language's UI Module !
[Updated on: Wed, 09 June 2021 07:46] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05309 seconds