using filters in cross referencing [message #975946] |
Thu, 08 November 2012 02:43  |
Eclipse User |
|
|
|
Hi All,
In content assistance class, i got to see filter, which is set to alwaysTrue() by default in my project..there are many other options i can try for filter, however I did not get any documentation about how to give other filter possibilities. I was only able to try one more option for filter ie., alwaysFalse().
Can any one point me, where i can get any documentation or examples about how to give other types of filters in lookupCrossReference method.
Thanks,
Sri.
|
|
|
|
Re: using filters in cross referencing [message #977432 is a reply to message #976014] |
Fri, 09 November 2012 04:29   |
Eclipse User |
|
|
|
Hi,
Thanks a lot for your reply.
If i have to use below grammar, and can not use QN,
Model: cs+=Company* employees+=Emp* block+=Block+
;
Block: emp1=company_crossRef
| emp_id=empId_crossRef
;
company_crossRef: comp1=[Company] ':' emp2=[Emp] ':' empId2=[empId] ;
empId_crossRef: emp1=[Emp] ':' empId1=[empId];
Company: c='Company' name=ID '{' emp+=Emp+ '}';
Emp: r='Emp' name=ID '{' empIdName+= empId* '}'';' ;
empId: 'Employee_id' name=ID
Then,
(1) Do i need to cross reference at some higher rule like Block instead of in company_crossRef, empId_crossRef etc as this discussion suggests? http://www.eclipse.org/forums/index.php/m/898746/
(2) Do I need to give filter with IEObjectDescription in scopeProvider class or do i need to override lookupCrossReference method in proposal provider? I understood as lookupCrossReference, in turn takes scope provider's definition before actually giving the list of cross referable items. So, is it the same if i mention filter either in lookupCrossReference or in scopeProvider?
(3) I got very few examples of filter usage in eclipse discussions, other than that, don't we have good documentation explaining possible options in filters?
|
|
|
|
|
|
|
Re: using filters in cross referencing [message #977504 is a reply to message #977481] |
Fri, 09 November 2012 05:30   |
Eclipse User |
|
|
|
Hi, Thank you for reply. Sorry i am not quite clear at this moment about what exactly are concrete and abstract syntax. But, yes, it is not possible, in my case, to change the syntax. Syntax is fixed for my grammar.
When i cross reference only one of company or employee, I needed to restrict the scope and it worked as i want, it shows employee of that particular company and after that employee Ids of that employee..By node model, do you mean gmf.node etc.,?
|
|
|
|
|
|
Re: using filters in cross referencing [message #981389 is a reply to message #977523] |
Mon, 12 November 2012 06:20   |
Eclipse User |
|
|
|
Hi Christian,
Thank you for the link. I tried out the example in this link (I looked at later blog he created for more recent xtext versions, and tried that too..still could not get even that working).
while trying the first link, http://dslmeinte.wordpress.com/2010/08/16/path-expressions-in-entity-models/
I work on xtext 2.2.1, and the scope providers i have been writing appear similiar to what is there in this blog. So, For the domain model example grammar in xtext, i tried to copy scope provider in the blog to scopeProvider.java in my project, and i got below errors, which i could not fix. Do any of these errors appear obvious or any hint to me about how to fix these errors?
(1) On line 6, The method structuralFeatures(Entity) is undefined for the type MyDslScopeProvider
(2) On line 13,
The method structuralFeatures(Entity) is undefined for the type MyDslScopeProvider
(3) Multiple markers at this line. The method emptyIterable() is undefined for the type Iterables
(4) On line 15, The method emptyIterable() is undefined for the type Iterables. After i have imported, import com.google.common.collect.Iterables;
(5) On line 26, The type IResourceDescription.Event.Listener is not generic; it cannot be parameterized with arguments <StructuralFeature>
The list of packages i imported are:
package org.xtext.example.mydsl2.scoping;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.resource.IResourceDescription.Event.Listener;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.xtext.example.mydsl2.myDsl.Entity;
import org.xtext.example.mydsl2.myDsl.Feature;
import org.xtext.example.mydsl2.myDsl.PathHead;
import org.xtext.example.mydsl2.myDsl.PathTail;
import org.xtext.example.mydsl2.myDsl.Reference;
import org.xtext.example.mydsl2.myDsl.StructuralFeature;
import org.xtext.example.mydsl2.myDsl.Type;
import org.xtext.example.mydsl2.myDsl.impl.StructuralFeatureImpl;
import com.google.common.collect.Iterables;
Please give me a hint if the errors i am getting are because of any obvious reasons.
Thanks.
|
|
|
|
|
|
|
|
Re: using filters in cross referencing [message #985101 is a reply to message #984452] |
Thu, 15 November 2012 01:35  |
Eclipse User |
|
|
|
Hi, Thanks a lot for your help. I did try for some time on how to make xtext not to do lazy linking and create object at the place of action (if that is same as eager linking) with not much success. the grammar and scope you tried are working like charm. that's great..
Only thing i want to know is if it possible to avoid xtext suggesting : after "amazon_emp1 : amazon_1"
ie., after amazon_1, it is suggesting both : and ; though nothing drops down if : is selected
similarly with company rule "sony : sony_emp1 : sony_1"
ie., after sony_1, it is suggesting both : and ; though nothing drops down if : is selected
any suggestions for me, what to concentrate on, if i like to avoid the last : it is suggesting?
Thanks.
|
|
|
Powered by
FUDForum. Page generated in 0.06649 seconds