Skip to main content



      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 12:31 Go to next message
Eclipse UserFriend
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 13:37 Go to previous message
Eclipse UserFriend
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 Jul 23 07:50:04 EDT 2025

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

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

Back to the top