Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Behavior Differences Between @Active and @Named(Behavior differences between @Active and @Named)
Behavior Differences Between @Active and @Named [message #1298822] Wed, 16 April 2014 14:29 Go to next message
Rob Hatcherson is currently offline Rob Hatcherson
Messages: 27
Registered: July 2009
Location: Fort Worth, TX, USA
Junior Member
eclipse.buildId=4.3.2.M20140221-1700
CentOS 2.6.32-358.23.2.el6.x86_64

We have a RCP app that we've been nursing along as e4 evolves. In this RCP app we have some parts with toolbars, and on those toolbars there is a pushbutton that eventually makes its way to a handler whose execute method used to look like this:

@Execute
public void execute(
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Named(IServiceConstants.ACTIVE_PART) MPart part
)

I expected that when we clicked the aforementioned toolbar button that the "part" argument would be the part on which the toolbar was located, but sometimes it is some other part. I haven't yet been able to pin down a pattern regarding which part shows up in this argument.

However...

If we change the execute method so it looks like this:

@Execute
public void execute(
@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
@Active MPart part
)

...then so far everything has worked just like I expect, i.e. the "part" argument is always the part associated with the toolbar whose button was clicked.

Is this a feature?

Rob
Re: Behavior Differences Between @Active and @Named [message #1299951 is a reply to message #1298822] Thu, 17 April 2014 08:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5419
Registered: July 2009
Senior Member
Hi,

On 16.04.14 16:29, Rob Hatcherson wrote:
> eclipse.buildId=4.3.2.M20140221-1700
> CentOS 2.6.32-358.23.2.el6.x86_64
>
> We have a RCP app that we've been nursing along as e4 evolves. In this
> RCP app we have some parts with toolbars, and on those toolbars there is
> a pushbutton that eventually makes its way to a handler whose execute
> method used to look like this:
>
> @Execute
> public void execute(
> @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
> @Named(IServiceConstants.ACTIVE_PART) MPart part
> )
>
> I expected that when we clicked the aforementioned toolbar button that
> the "part" argument would be the part on which the toolbar was located,
> but sometimes it is some other part. I haven't yet been able to pin
> down a pattern regarding which part shows up in this argument.

This would be that the part with the toolbar is not activated
appropriately before the toolbars action is exectued with sounds like a bug!

>
> However...
>
> If we change the execute method so it looks like this:
>
> @Execute
> public void execute(
> @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
> @Active MPart part
> )
>

To understand the difference between @Activte and ACTIVE_* you should
maybe read my blog http://tomsondev.bestsolution.at/2013/01/30/active-in-e4/

I generally think in your case the you don't need any of the above but

public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
MPart part)

should be fine.

Tom
Re: Behavior Differences Between @Active and @Named [message #1302161 is a reply to message #1299951] Fri, 18 April 2014 15:02 Go to previous message
Rob Hatcherson is currently offline Rob Hatcherson
Messages: 27
Registered: July 2009
Location: Fort Worth, TX, USA
Junior Member
>> To understand the difference between @Activte and ACTIVE_* you should
>> maybe read my blog http://tomsondev.bestsolution.at/2013/01/30/active-in-e4/

Sounds like Alex and I were asking similar questions. One thing is clear: the fact that I made this mistake means I need to take a step back and study the context hierarchy some more.


>> I generally think in your case the you don't need any of the above but
>> public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
>> MPart part)
>> should be fine.

Yep - that worked too.

Thanks for the help!

Rob
Previous Topic:tooltip of handled tool item
Next Topic:How do i define and use my own renderer?
Goto Forum:
  


Current Time: Thu Oct 23 15:24:50 GMT 2014

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

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