Documenting the Grammar to use it in the DSL-Editor [message #1081526] |
Wed, 07 August 2013 06:31  |
Eclipse User |
|
|
|
Hello,
I want to document the rules of the grammar (comparable with JavaDoc). Then I want to use this documentation in the way that someone using the DSL-Editor can see the documentation, e. g. if he moves the mouse over the corresponding keyword (e. g. Hover-Effect).
Using the IEObjectDocumentationProvider is not what I want because there is no dependency to the grammar.
Greets Björn
|
|
|
|
|
|
|
Re: Documenting the Grammar to use it in the DSL-Editor [message #1143856 is a reply to message #1081526] |
Fri, 18 October 2013 09:21  |
Eclipse User |
|
|
|
Hi,
I fixed the Problem.
As I mentinoned before I followed the posting:
http://blogs.itemis.de/stundzig/archives/868
To get a documentation formatted in html I added the following line in my DispatchingEObjectTextHover based on the example:
@Override
protected Pair<EObject, IRegion> getXtextElementAt(XtextResource resource,
int offset) {
//not a very good solution
Iterator<Object> iter = EcoreUtil.getAllContents(resource, false);
while (iter.hasNext()) {
if (iter .next() != null) {
someEObject= (EObject)iter.next();
break;
}
}
...
@Override
public Object getHoverInfo(EObject first, ITextViewer textViewer,
IRegion hoverRegion) {
if(first instanceof Keyword){
//not a very good solution
super.getHoverInfo(someEObject, oTextViewer, hoverRegion);
return getHoverInfoForKeyword((Keyword)first);
}else{
return super.getHoverInfo(first, textViewer, hoverRegion);
}
}
Greets Björn
[Updated on: Fri, 18 October 2013 09:22] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03623 seconds