Injecting doesn't work - eModelService.find works - why? [message #985694] |
Thu, 15 November 2012 12:31  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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);
>
|
|
|
Powered by
FUDForum. Page generated in 0.27662 seconds