Home » Modeling » TMF (Xtext) » How to export custom hovers as plug in ?
How to export custom hovers as plug in ? [message #1841890] |
Wed, 02 June 2021 12:38  |
Ryana Karaki Messages: 19 Registered: May 2021 |
Junior Member |
|
|
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 12:54] Report message to a moderator
|
|
| |
Re: How to export custom hovers as plug in ? [message #1841916 is a reply to message #1841897] |
Thu, 03 June 2021 09:45   |
Ryana Karaki Messages: 19 Registered: May 2021 |
Junior Member |
|
|
Hello,
Thank you for replying.
When you say "calling it early enough", do you mean at plug-in starting time ? I tried to do add your code in my 'Activator' class, that extends the 'AbstractUIPlugin'. I placed the code in the method :
public void start(BundleContext context){...}
but his approach does not seem to work. I still see the DSL's original hovers.
I wondered if by adding my custom hover like this, it 'collides' with the DSL's custom/default hovers ?
Also, do you mind explaining this part ?
ITextHover textHover = IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("dummy.mydsl")).get(ITextHover.class);
I am not sure I understand what is done here.
[Updated on: Thu, 03 June 2021 10:20] Report message to a moderator
|
|
| | | | |
Re: How to export custom hovers as plug in ? [message #1841964 is a reply to message #1841933] |
Fri, 04 June 2021 14:56   |
Ryana Karaki Messages: 19 Registered: May 2021 |
Junior Member |
|
|
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 06:29   |
Ryana Karaki Messages: 19 Registered: May 2021 |
Junior Member |
|
|
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 18:20   |
Ed Willink Messages: 7594 Registered: July 2009 |
Senior Member |
|
|
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
|
|
| |
Goto Forum:
Current Time: Tue May 30 01:03:48 GMT 2023
Powered by FUDForum. Page generated in 0.03072 seconds
|