Anyone with a example why these @Named tags are useful in a handler?
Otherwise I remove them.


2013/9/12 Lars Vogel <[email protected]>

> Hello,
>
> The example code from the e4 wizard uses
>  @Named(ServiceConstants.ACTIVE_*) regulary. For example:
>
> @Execute
> public void execute(
> IEclipseContext context,
> @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
>  @Named(IServiceConstants.ACTIVE_PART) final MContribution contribution)
> throws InvocationTargetException, InterruptedException {
> ............
> }
>
> AFAIK these service constants are useless in a handler, as the handler is
> always executed in the active context.
>
> Is anyone aware of a situation in which @Inject MPart would fail (in a
> handler class) and the usage of  @Named(IServiceConstants.ACTIVE_PART)
> would return the correct part?
>
> I'm unable to construct one, so I'm thinking about changing the template
> code.
>
> I understand that the constants are useful somewhere else, e.g. another
> part but IMHO not in a handler.
>
> Best regards, Lars
>
>
>
>
>
_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to