|
|
|
|
|
|
|
|
|
|
Re: Control Variable Assignments [message #1708901 is a reply to message #1708899] |
Tue, 22 September 2015 11:27 |
tam ay Messages: 44 Registered: May 2015 |
Member |
|
|
I want to interpret the value of a variable. For that I override getHoverInfoAsHtml(EObject o). When I have an assignment I try to get the CURRENT position of that variable...But I get the position where the variable was declared:
VAR
int : a;
BEGIN
a := 4;
Thats why I wanted to know how to get the current position of the cursor.
[Updated on: Tue, 22 September 2015 11:28] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Control Variable Assignments [message #1709057 is a reply to message #1709043] |
Wed, 23 September 2015 15:40 |
|
Hi i do not get that
Model:
greetings+=Greeting*;
Greeting:
'Hello' name=ID ('from' from=[Greeting])? '!';
public class DispatchingEObjectTextHover2 extends DispatchingEObjectTextHover {
@Inject
private MyDslGrammarAccess ga;
@Override
protected Pair<EObject, IRegion> getXtextElementAt(XtextResource resource, int offset) {
if (resource.getParseResult() != null) {
ICompositeNode rootNode = resource.getParseResult().getRootNode();
if (rootNode != null) {
ILeafNode leafNode = NodeModelUtils.findLeafNodeAtOffset(rootNode, offset);
EObject sem = NodeModelUtils.findActualSemanticObjectFor(leafNode);
if (leafNode.getGrammarElement() instanceof CrossReference) {
CrossReference cr = (CrossReference) leafNode.getGrammarElement();
if (ga.getGreetingAccess().getFromGreetingCrossReference_2_1_0() == cr) {
ITextRegion leafRegion = leafNode.getTextRegion();
return Tuples.create(sem, (IRegion) new Region(leafRegion.getOffset(), leafRegion.getLength()));
}
}
}
}
return super.getXtextElementAt(resource, offset);
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Control Variable Assignments [message #1709837 is a reply to message #1709832] |
Thu, 01 October 2015 12:45 |
|
Hi,
still the question. where does the hyplink point to? xtext cannot know in which line in a non xtext file an object is or not.
so do you use cdt? or what is the stuff you use? the stuff you use can tell you how the links for the stuff you use look like?!?
thus you should not create an xtext hyperlink but an IHyperlink for the tool you use.
thus this is a question on e.g. cdt and not xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
Re: Control Variable Assignments [message #1709960 is a reply to message #1709959] |
Fri, 02 October 2015 09:28 |
|
As i said, you should move that to the open() method of the IHyperlink().
val IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
val ITextEditor editor = IDE.openEditor(page, _ifile) as ITextEditor;
editor.selectAndReveal(u.nodeOffset, u.nodeLength);
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06610 seconds