Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Finding references from builder
Finding references from builder [message #708369] Tue, 02 August 2011 18:44 Go to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Hello all,

I'm wondering how I could get the objects that reference a given object in my builder participant. That would be similar to the IDE feature "Find References" on a object name.

I guess I should get the index. I have tried several things like:

        @Inject
	private Provider<IResourceDescriptions> resourceDescriptionsProvider;
	@Inject
	private IResourceDescriptions index;
	@Inject
	org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider indexProvider;


, but those variables are always null.

How can I do?

Thank you very much.
Re: Finding references from builder [message #708400 is a reply to message #708369] Tue, 02 August 2011 19:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi,

cannot reproduce this

	@Inject
	private ResourceDescriptionsProvider provider;


works for me. are you sure your bindings are set up correct? where you use/inject/register whatever the builder participant?
are you sure you use the YourdslExecutableExtensionfactory in your plugin.xml?

~Christian


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

[Updated on: Tue, 02 August 2011 19:21]

Report message to a moderator

Re: Finding references from builder [message #708428 is a reply to message #708400] Tue, 02 August 2011 19:59 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
I didn't configure any bindings, I thought I had to use them only if I provide a custom implementation. In the case I had to register a binding to ResourceDescriptionsProvider, I wouldn't now which binding method I have to override (I guess in the MydslRuntimeModule class).

I'm trying this in the .ui project of my dsl, so I think my plugin.xml uses MydslExecutableExtensionfactory.

My example could get as simple as:

public class Builder implements IXtextBuilderParticipant {

	@Inject
	private ResourceDescriptionsProvider provider;
	@Override
	public void build(IBuildContext context, IProgressMonitor monitor)
			throws CoreException {
		
		System.out.println(provider);
		

	}

}


, and the provider variable is null.

Is this the way to find which objects reference a given object?

Thank you,

Re: Finding references from builder [message #708431 is a reply to message #708428] Tue, 02 August 2011 20:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
So once more: how does the builder registration in the plugin xml look like?

<extension
         point="org.eclipse.xtext.builder.participant">
      <participant
            class="org.xtext.example.mydsl.ui.MyDslExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
      </participant>
   </extension>



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

[Updated on: Tue, 02 August 2011 20:16]

Report message to a moderator

Re: Finding references from builder [message #708456 is a reply to message #708431] Tue, 02 August 2011 20:28 Go to previous messageGo to next message
Rafael Angarita is currently offline Rafael AngaritaFriend
Messages: 94
Registered: November 2010
Member
Well, I think this is it:

<extension
         point="org.eclipse.xtext.builder.participant">
      <participant
            class="org.xtext.mydsl.ui.builder.Builder">
      </participant>
   </extension>


Also, the plugin.xml has:

<extension
         point="org.eclipse.xtext.builder.participant">
      <participant
            class="org.xtext.altagracia.ui.MydslExecutableExtensionFactory:org.eclipse.xtext.builder.IXtextBuilderParticipant">
      </participant>
   </extension>


I'm sorry if it is not the answer Smile

Re: Finding references from builder [message #708460 is a reply to message #708456] Tue, 02 August 2011 20:34 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
with

<participant
class="org.xtext.mydsl.ui.builder.Builder">

you dont use guice => no wonder that nothing gets injected

=> use

<participant
class="org.xtext.altagracia.ui.MydslExecutableExtensionFactory:org.xtext.mydsl.ui.builder.Builder">

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext dsl file extensions
Next Topic:How to find the closest reference?
Goto Forum:
  


Current Time: Sun Apr 18 07:28:02 GMT 2021

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

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

Back to the top