| Injection into a custom view [message #805870] |
Fri, 24 February 2012 03:37  |
John J. Camilleri Messages: 33 Registered: November 2011 Location: Göteborg |
Member |
|
|
Forgive the dumb question, but I can't figure this out.
I am writing a custom view for my plugin. I want to use Xtext's image helper but the injection doesn't work as I hoped:
import org.eclipse.ui.part.ViewPart;
import org.eclipse.xtext.ui.IImageHelper;
public class MyView extends ViewPart {
@Inject
private IImageHelper images;
}
No matter what I try, images is always null.
This code works for me in other classes, so my guess is that I need to wire this view up to Guice correctly.
What do I need to do to get the injection to work in this way?
Thanks!
|
|
|
|
| Re: Injection into a custom view [message #805895 is a reply to message #805885] |
Fri, 24 February 2012 04:12   |
John J. Camilleri Messages: 33 Registered: November 2011 Location: Göteborg |
Member |
|
|
Amazing, thanks for the pointer! All I needed to change was this:
<view
category="mydsl.ui.views"
class="mydsl.ui.views.MyView"
id="mydsl.ui.views.MyView"
name="My View"
>
</view>
into this:
<view
category="mydsl.ui.views"
class="mydsl.ui.MyDSLExecutableExtensionFactory:mydsl.ui.views.MyView"
id="mydsl.ui.views.MyView"
name="My View"
>
</view>
This is actually in the docs, although I didn't understand it until now. Thanks again.
[Updated on: Fri, 24 February 2012 04:13] Report message to a moderator
|
|
|
| Re: Injection into a custom view [message #1008401 is a reply to message #805870] |
Tue, 12 February 2013 05:38  |
Lalitha Iyer Messages: 1 Registered: February 2013 |
Junior Member |
|
|
Hi John ,
I am a new user of xtext .
I have written a DSL and have the configured the IDE features .
I have addded a new view and have set the class to mydsl.ui.MyDSLExecutableExtensionFactory:mydsl.ui.views.ViewPartP
However I am not able to see this view in the others menu when I run my plugin .
I could not find any documentation on the site which helps understand adding custom views ..Could you please share the link of the documentation you are refering .
Thanks
Lalitha Iyer
|
|
|
Powered by
FUDForum. Page generated in 0.01677 seconds