I have developed a DSL with xText and recently add somme enhanced completion. In a xText-generated editor when calling completion by Ctrl-Space, the completion handler has to perform a folder scanning to look for symbols in another text file of the same DSL. The entry point is :
public class TypesProposalProvider extends AbstractTypesProposalProvider
{
public void completeQualifiedName_Path(
EObject model,
Assignment assignment,
ContentAssistContext context,
ICompletionProposalAcceptor acceptor )
{
super.completeQualifiedName_Path( model, assignment, context, acceptor );
I use:
Model root = (Model) context.getRootModel();
Resource rootRc = root.eResource();
to obtain the emf.ecore container of the model.
And now, how can I look for sibling resources, the other files in the same folder, in term of ecore resource?
With the another resources, I'll call Resource.load() to populate the underlaying emf.ecore model of the siblings.
I hope you understand my approximative English (I'm French)...
Here is the final version, compact as usual ;-) :