Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Resolve different parser rules dependency. (To establish the relation between rules.)
Resolve different parser rules dependency. [message #1780821] Sun, 28 January 2018 21:52 Go to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
I am new to xtext and need some help. I have a problem statement and don't know how to implement the same. Below is a small example:

//Xtext Grammar---------

Feature_decl: 'feature' name=ID;

Delta_decl: 'delta' name=ID;

Product_line_decl: 'productline' name=ID delta=[Delta_decl|ID] 'when' feature+=[Feature_decl|ID]* (',' feature+=[Feature_decl|ID]*) ';' ;


//Runtime Result----------

feature F1 //on hover or click show D1 and D2
feature F2 //on hover or click show D1 and D2
feature F3 //on hover or click show D2

delta D1 //on hover or click show F1 and F2
delta D2 //on hover or click show F1, F2 and F3

productline example1 D1 when F1,F2; // Establish the relationship between feature and delta

productline example2 D2 when F1,F2,F3;

Now,I want to acheive the relation between features and delta declaration. When I click/hover on any feature say 'F1' anywhere in the program it should show depenedent deltas 'D1' and 'D2'. Similarly, when I hover over a delta say 'D1', it should show list of features i.e. 'F1' and 'F2'.
Re: Resolve different parser rules dependency. [message #1780832 is a reply to message #1780821] Mon, 29 January 2018 05:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Have a look at the following hooks

IReferenceFinder
HyperlinkHelper
DefaultEOnjectHover


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1780913 is a reply to message #1780832] Mon, 29 January 2018 22:31 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

Thank you for the quick response. However, I am new to Xtext and working on my master thesis where this is a major requirement. Can you provide some more detail so that I can search in the correct direction. I am not able to find any good example or documentation of the above mentioned topics.

Thanks in advance.
Re: Resolve different parser rules dependency. [message #1780921 is a reply to message #1780913] Tue, 30 January 2018 05:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
No I can't there is nothing. You might search the web for usages or customizations of this places but I don't have the time to do the actual work for you

You might use a debugger as well and search the Xtext code base


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 30 January 2018 05:58]

Report message to a moderator

Re: Resolve different parser rules dependency. [message #1780922 is a reply to message #1780921] Tue, 30 January 2018 06:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Ps if the references are locally only you might navigate the ast up and down manually e.g. by using helpers in EcoreUtil2

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1780923 is a reply to message #1780922] Tue, 30 January 2018 06:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
And you might have a look at the mark occurrences feature

https://github.com/eclipse/xtext-eclipse/blob/242b5fcc83f4697f6381f9264f710773e8435ce8/org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/occurrences/DefaultOccurrenceComputer.java


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1781310 is a reply to message #1780923] Mon, 05 February 2018 21:37 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I read the documentation as mentioned by you about the EcoreUtil2, however, I have some doubts. I am new to xtext so you may find these question a little silly.
1. Regarding EcoreUtil2
a. I created a 'java' file in the package 'org.xtext.xx.ui' and try to call the method 'getAllReferencedObjects'. Since it is a static method it should be accessible by class name. However, when I try to call EcoreUtil2. getAllReferencedObjects. It does not populate.
b. This method requires parameter namely org.eclipse.emf.ecore.EObject referrer and org.eclipse.emf.ecore.EReference reference. How can I get EObject reference. I have just written a xtext grammar. I am not sure how I can access the EObject.

2. To get the relationship between the Deltas and Features(as explained by my example above).
a. Since I was not able to run my Java file and create an Ecore object. I made some changes in the 'compile' method present in the 'org.xtext.xx.ui.labeling'. There I am able to get the relationship between features and deltas and also able to print them using 'println' command.

3. For the Hover, I referred to the documentation and made a custom message. Now, I am getting the custom message by changing the xxLabelProvider.xtend.

Now since I have values present in my compile method, is there any method through which I can set the value of the hover message to the value computed in the compile method.

I was also thinking of creating a hidden element in the grammar.The compile method will set the attribute value to the values I need and then hover method in the 'org.xtext.xx.ui.labeling' can access and display that attribute's value.

Thanks in advance.



Re: Resolve different parser rules dependency. [message #1781330 is a reply to message #1781310] Tue, 06 February 2018 07:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Hi,

i still can follow you since your questions are all theoretically.

(1a) for references: are these local references or not. if not have a look at IReferenceFinder.findReferences*
(1b) if yes: use IReferenceFinder or search for YourModelRoot with EcoreUtil2.getContainerOfType. Traverse the ast and search the features and deltas. filter for the ones you want.
(1c) getAllReferencedObjects is looking forn outgoing references, not to find inverses
(1d) You get a MyDslPackage.Literals constants interface that has a YOURCLASS_YOURREFERENCE

(2) i dont understand

(3) i dont understand. if you can print "hello world" you can print "your calculated stuff"


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1781344 is a reply to message #1781330] Tue, 06 February 2018 09:25 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

(1a) for references: are these local references or not. if not have a look at IReferenceFinder.findReferences*

What do you mean by local references? Does it mean all the code is present in a single file?

Also, I am able to understand the method and its usage but I am not sure how to use it. I am creating a new class say A in the package 'org.xtext.xx.ui' which extends EcoreUtil2. Now I want to use 'getAllReferencedObjects' which take 2 parameters. I want to know how I can get these parameters value?

Also, do I need to override the default implementation of ''getAllReferencedObjects' if present and write my code there? Or creating a new class in package 'org.xtext.xx.ui' is correct?


(2) i dont understand

Below is my xtext grammar. The product_line_decl forms the relationship between the deltas and features described above.

//Xtext Grammar---------

Feature_decl: 'feature' name=ID;

Delta_decl: 'delta' name=ID;

Product_line_decl: 'productline' name=ID delta=[Delta_decl|ID] 'when' feature+=[Feature_decl|ID]* (',' feature+=[Feature_decl|ID]*) ';' ;

//Runtime Result----------
//-------------------Features
feature F1

feature F2
feature F3

//-----------------Deltas
delta D1
delta D2

productline example1 D1 when F1,,F2; // Establish the relationship between feature and delta

productline example2 D2 when F1,F2,F3;

When I override the 'compile' function present in 'org.xx.generator' (sorry I mentioned the wrong package), I was able to print

D1->F1,F2

D2->F1,F2,F3

(3) I dont understand. if you can print "hello world" you can print "your calculated stuff"

I am able to print custom messages in 'org.xtext.xx.ui.labeling' package and the compile function is present in the another package called the 'generator'. I am not able to use the text function present in the org.xtext.xx.ui.labeling in my generator class. Hope this helps. Sorry, I am new to xtext so I am not sure what I am doing is correct.


Many thanks for the help anyways.

Re: Resolve different parser rules dependency. [message #1781351 is a reply to message #1781344] Tue, 06 February 2018 10:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Quote:
What do you mean by local references? Does it mean all the code is present in a single file?

yes

i dont think getallReferencedObjects is what you are looking for. have a look at IReferenceFinder

(2) i dont understand what you want to achieve

(3) then you need to put your logic to a common place and use it from generator and label provider


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1781354 is a reply to message #1781351] Tue, 06 February 2018 11:06 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
(1)i dont think getallReferencedObjects is what you are looking for. have a look at IReferenceFinder

I can have the code in a single file or multiple files. I tried using these methods but was not successful. May you please let me know where do I need to create the class (in which package) so that I can use the methods.

(2) i dont understand what you want to achieve

I want to acheive a relationship between deltas and features. When a user hover on a delta say D1 , he should be able to see the associated Features. Similarly, when a user hover over a feature say F1 he should be able to see the associated deltas. Please find the attached file.


​(3) then you need to put your logic to a common place and use it from generator and label provider

I was not able to import the label package inside the generator. To use both I think I need to create a class which imports both the classes and then use this class to get information from the generator and displays the information on hover using the label method. Am I understanding it right?
Re: Resolve different parser rules dependency. [message #1781356 is a reply to message #1781354] Tue, 06 February 2018 11:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
you can simply do a @Inject IReferenceFinder referenceFinder;

you can simply create a YourUtil class and inject to to both the generator and label provider


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Resolve different parser rules dependency. [message #1781357 is a reply to message #1781356] Tue, 06 February 2018 11:37 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hey Christian,

Thank you so much for answering my questions so promptly... :-) . I will do it and let you know.
Navigation on Hover. [message #1781694 is a reply to message #1781356] Mon, 12 February 2018 10:04 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

Now. I am able to customize the hover and establish the relation between feature and deltas as per my requirements. When I hover over let say D1 it popups the dependent Features F1, F2, F3 and similarly when I hover on D2 it popup F4,F2.

Is it possible to define the navigation functionality like when I click on F1in the label text it will direct to its definition where F1 is declared i.e. how can I give cross-references in xtext label?

[Updated on: Mon, 12 February 2018 10:10]

Report message to a moderator

Re: Navigation on Hover. [message #1781698 is a reply to message #1781694] Mon, 12 February 2018 10:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
i dont know. this is what HyperlinkHelper ususally does. for oing this in the hover you have to find a solution yourself

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1781702 is a reply to message #1781698] Mon, 12 February 2018 10:35 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
so there is no way to pass text function an object( cross-reference) instead of string?
Re: Navigation on Hover. [message #1781705 is a reply to message #1781702] Mon, 12 February 2018 11:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
i dont understand

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1781708 is a reply to message #1781705] Mon, 12 February 2018 13:04 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I am using LabelProviders text method to display my customized values on hover. These values are basically the name of the element present in Xtext grammar. I want to know whether there exists a way using which I can navigate to the element declaration when I click on hover item i.e. I want to make the label of the text which displays on hover to be clickable.

Refer to the attach image.
Re: Navigation on Hover. [message #1781709 is a reply to message #1781708] Mon, 12 February 2018 13:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
the question: what should a klick do.
navidate in the hover or the editor


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 12 February 2018 13:08]

Report message to a moderator

Re: Navigation on Hover. [message #1781710 is a reply to message #1781709] Mon, 12 February 2018 13:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
maybe somebody in the platform https://www.eclipse.org/forums/index.php/f/11/ or rcp https://www.eclipse.org/forums/index.php/f/106/ forum has an ide (problem should not be xtext specific)

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1781717 is a reply to message #1781710] Mon, 12 February 2018 14:08 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

The hover labels of the elements are created by overriding the text(Element o) method of Xtext LabelProvider. This Xtext method takes String as the parameter. However, I want to display these values as a hyperlink so that user can click them and they can navigate to its declaration. Since Xtext label provider only offers a method to set the label as String. I want to know how can I pass a reference to the label instead of String.

Hope it is clear.
Re: Navigation on Hover. [message #1781723 is a reply to message #1781717] Mon, 12 February 2018 14:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
<a href="xxxxx"></a> ??????

or a escaped version. have a look at javadoc/xbase hovers in xtend


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 12 February 2018 14:54]

Report message to a moderator

Re: Navigation on Hover. [message #1781726 is a reply to message #1781723] Mon, 12 February 2018 15:10 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
I was also thinking of forming the text in the anchor tag . However, I was not sure what to put in 'href' field so that label text can navigate to its declaration .

Also, I am not sure what an escaped version is?
Re: Navigation on Hover. [message #1781732 is a reply to message #1781726] Mon, 12 February 2018 16:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
well this is what i try to tell you: i have never seen somebody doing this. thus i cannot answer

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1782098 is a reply to message #1781732] Sat, 17 February 2018 14:48 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello,

As you suggested in this link

https://www.eclipse.org/forums/index.php?t=msg&th=337562/

to do the following
@Override
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
return MyDslHyperlinkHelper.class;
}


I am also facing the same problem. However, I am not sure where to put this dependency "public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() { return MyCustomHyperlinkHelper.class; }". These dependencies are present in "src-gen" folder and get override when I run mwe engine. I have found a xtend file where I think I can put these dependencies but I am not sure how to include them or how to write them in xtend . Please help.

[Updated on: Sat, 17 February 2018 14:52]

Report message to a moderator

Re: Navigation on Hover. [message #1782104 is a reply to message #1782098] Sat, 17 February 2018 18:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
add it to MyDslUiModule.xtend

override Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
return MyDslHyperlinkHelper;
}


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 17 February 2018 18:15]

Report message to a moderator

Re: Navigation on Hover. [message #1782111 is a reply to message #1782104] Sun, 18 February 2018 12:01 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hi Christian,

Thanks for the response, I have found it.
I am able to show the desired values on hover of the references, but since it takes only string value so I can't pass the anchor tag for hyperlinking.

For Hyperlinking I am using IHyperlinkHelper but I am not sure where to put these references (which are Hyperlinked).

Is it possible to create/Customize a call-hierarchy/Quick-outline with the object references, so that the user can click it and go to the declaration of the hover content?
Re: Navigation on Hover. [message #1782112 is a reply to message #1782111] Sun, 18 February 2018 12:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
I Dont understand.

simply create as many hyperlinks as you wish

the helper calls org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper.createHyperlinksTo(XtextResource, Region, EObject, IHyperlinkAcceptor)

simply create different hyperlinks to different targets ?!?


regarding your second question
yes and no
everythings is customizable
but you need to do it.
i cannot tell you how since i dont know
you need to read the code
read existing cxustomizations
etc


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 18 February 2018 12:30]

Report message to a moderator

Re: Navigation on Hover. [message #1783287 is a reply to message #1782112] Sat, 10 March 2018 22:57 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I was able to find refrences and traverse the tree in a single file . However, I now need to find all the references of an element( an eobject) across multiple files. I am not able to find any suitable method. I also looked at "IReferenceFinder" but don't know how to use it. I have only the eobject and thus do not know how to find references using a eobject.
Thanks in advance.

Re: Navigation on Hover. [message #1783288 is a reply to message #1782112] Sat, 10 March 2018 22:57 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I was able to find refrences and traverse the tree in a single file . However, I now need to find all the references of an element( an eobject) across multiple files. I am not able to find any suitable method. I also looked at "IReferenceFinder" but don't know how to use it. I have only the eobject and thus do not know how to find references using a eobject.
Thanks in advance.

Re: Navigation on Hover. [message #1783289 is a reply to message #1783288] Sat, 10 March 2018 23:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Please explain what issue you have with ireferencefinder

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783301 is a reply to message #1783289] Sun, 11 March 2018 12:01 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hi Christian,

I have the following grammar

//Goal Main Model OR Starting Rule
DomainModel: Compilation_Unit;

//Compilation Unit
Compilation_Unit:{Compilation_Unit} (deltaDecl+=Delta_decl)* (productline_decl=Productline_decl)? ('root' feature_decl+=Feature_decl |'extension' fextension+=Fextension)*

Feature_decl: 'feature' name=ID;

Delta_decl: 'delta' name=ID;

Product_line_decl: 'productline' name=ID delta=[Delta_decl|ID] 'when' feature+=[Feature_decl|ID] (',' feature+=[Feature_decl|ID]) ';' ;

The productline has the reference of features and Deltas. The features ,deltas and productline are defined in different files. I have implemented IHyperlinkHelper to customize the hyperlinking of the elements. I need to show the list of all Features related to a particular delta whenever the user (Ctrl+F5) on delta name. We can get this delta-feature information from the productline which is present in different file. I only have the eObject of delta as the user will (Ctrl+F5) on it . I need to get the reference of this delta from productline.

//Runtime Result----------

//-------------------Features (Features.abs)
feature F1
feature F2
feature F3

//-----------------Deltas (Delta.abs)
delta D1
delta D2

//Productline (Productline.abs)
productline example1
D1 when F1,,F2; // Establish the relationship between feature and delta
D2 when F1,F2,F3;

When user Ctrl+F5, I need

D1->F1,F2

D2->F1,F2,F3

Currently, eObject.eContainer gives me Compilation_UnitImpl but I am not able to traverse the tree. I need to get the productline object from the delta eobject to show this linking. I am able to achieve it for a single file but for multiple file this is not working.

Thanks in adavnce.
Re: Navigation on Hover. [message #1783303 is a reply to message #1783301] Sun, 11 March 2018 12:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
This does not answer my question
What exact problem do you have with reference finder


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783304 is a reply to message #1783303] Sun, 11 March 2018 12:41 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
I am not sure whether refrenceFinder will help me solve my problem. I have Injected IReferenceFinder referenceFinder and using referenceFinder.findAllReferences(delta,acceptor,monitor); but I am not sure from where I can get acceptor and monitor values and will this method will be able to fetch the references and help me in traversing the tree.
Re: Navigation on Hover. [message #1783305 is a reply to message #1783304] Sun, 11 March 2018 12:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
You have to create the acceptor e.g. as anonymous class and use it to collect the redults
You should be able to pass a New nullprogressmonitor


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783306 is a reply to message #1783305] Sun, 11 March 2018 12:49 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Will referenceFinder.findAllReferences will give me the references across the file. I want to use the references to get the parent where these references were used.
Re: Navigation on Hover. [message #1783307 is a reply to message #1783306] Sun, 11 March 2018 12:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Try it.

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783313 is a reply to message #1783307] Sun, 11 March 2018 19:48 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hi,

I am now able to get the reference of the delta in other files. However, I want to get the references of the features present against the delta's reference .For example ,
My delta declaration are contained in Delta.abs and references are present in Productline.abs and I need to get the "F1,F2,F3" eobjects as they are referenced against D2 reference.
//-----------------Deltas (Delta.abs) declaration
delta D1
delta D2
//Productline (Refrence of delta)
productline example2 D2 when F1,F2,F3;

How can I use my delta reference to do the traversal and get the other eobjects . Thanks in advance
Re: Navigation on Hover. [message #1783325 is a reply to message #1783313] Mon, 12 March 2018 05:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
Argggg it's very hard to support somebody who is not willling to understand wha t he is doing.

If you. Get source Uris. Loot at them . Load the objects. Have a look at the references


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783352 is a reply to message #1783325] Mon, 12 March 2018 10:41 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I am new to Xtext and need to develop something very complex for my thesis. I have no previous experience with Xtext and there is no documentation which can explain the complex mechanism and what functions do. I am trying my best and whenever I am stuck I ask when I am not able to find any solution.

I have the source Uri but I am not able to convert it into a XtextDocument so that I can parse it and get Inode from it and then use the desired functions. I am not able to find function using which consumes this URI and give me the parent EObjects. I have also used the various function of ECoreUtil and EcoreUtil2 but nothing helps. I am asking for a direction and not for the solution from you. Hope you understand.
Re: Navigation on Hover. [message #1783353 is a reply to message #1783352] Mon, 12 March 2018 10:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
You can use resourceset.getEObject
You can obtain the resourceset by asking your context eobject for it's resource and the resource for it's object.

The main problem is that what you do is totally unusual
And I have no idea what the actual idea behind it is


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783354 is a reply to message #1783353] Mon, 12 March 2018 11:12 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
I have also used resourceset.getEObject but I was not able to get values. I will look and check again.The requirements are a little complex and I cannot explain you the complete requirement. I am sorry to bother you again and again and Thank you so much for your reply and patience.
Re: Navigation on Hover. [message #1783355 is a reply to message #1783354] Mon, 12 March 2018 11:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
what happended when you used resourceset.getEObject ?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783358 is a reply to message #1783355] Mon, 12 March 2018 11:35 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
​​I have
sourceUri: platform:MyFileName//@productline
I tried to use resourceset but I was not having the context. So, I dropped this approach.
Re: Navigation on Hover. [message #1783359 is a reply to message #1783358] Mon, 12 March 2018 11:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
please explain where are you executing this code from?

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783367 is a reply to message #1783359] Mon, 12 March 2018 12:35 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member

IhyperlinkHelper--> gets the eObject on which the ctrl+f5 is performed--> Pass this value to a function inside (Generator.Xtend folder) --> generator calls a function and get related refrences using IReferenceFinder --> I get the sourceUri for the list of references --> Get context of the Uri?? --> if I will get the context then I can play around with the eobjects of that source Uri file.
Re: Navigation on Hover. [message #1783369 is a reply to message #1783367] Mon, 12 March 2018 12:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12187
Registered: July 2009
Senior Member
then eObject == context

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Navigation on Hover. [message #1783383 is a reply to message #1783369] Mon, 12 March 2018 14:15 Go to previous message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
okay, I will check and let you know. Thanks for the help.
Previous Topic:Xtext using Xbase
Next Topic:What do you think about link cast operator to a "toX" function?
Goto Forum:
  


Current Time: Sun Aug 19 19:06:13 GMT 2018

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

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

Back to the top