Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Injecting doesn't work - eModelService.find works - why?
Injecting doesn't work - eModelService.find works - why? [message #985694] Thu, 15 November 2012 17:31 Go to next message
Alex Kipling is currently offline Alex Kipling
Messages: 251
Registered: July 2012
Senior Member
I have the folllowing code, where I am looking for a PartStack with a given ID.

Named Injection doesnt work here, but the finding works. Why?

    private static final String STACKID = "rcp.plugin.partstack.main";

    @Inject
    EModelService eModelService;

    @Inject
    MApplication mApplication;

//    @Inject
//    @Named(STACKID) //doesn't work - why?
    
    @Execute
    public void execute() {
//        MPartStack mainStack = eModelService.findElements(mApplication, STACKID, MPartStack.class, null).get(0);
        MPartStack mainStack = (MPartStack) eModelService.find(STACKID, mApplication);
Re: Injecting doesn't work - eModelService.find works - why? [message #985713 is a reply to message #985694] Thu, 15 November 2012 18:37 Go to previous message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5321
Registered: July 2009
Senior Member
You can only get informations from contexts above you, which is case of
an command is the hiearchy above the currently active part.

Tom

Am 15.11.12 18:31, schrieb Alex Kipling:
> I have the folllowing code, where I am looking for a PartStack with a
> given ID.
>
> Named Injection doesnt work here, but the finding works. Why?
>
>
> private static final String STACKID = "rcp.plugin.partstack.main";
>
> @Inject
> EModelService eModelService;
>
> @Inject
> MApplication mApplication;
>
> // @Inject
> // @Named(STACKID) //doesn't work - why?
> @Execute
> public void execute() {
> // MPartStack mainStack =
> eModelService.findElements(mApplication, STACKID, MPartStack.class,
> null).get(0);
> MPartStack mainStack = (MPartStack) eModelService.find(STACKID,
> mApplication);
>
Previous Topic:Custom StatusReporter (or how to override WorkbenchStatusReporter)
Next Topic:What is the difference between Area and PartSash Containers in e4?
Goto Forum:
  


Current Time: Wed Sep 17 09:51:55 GMT 2014

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

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