Bug 122808 - [Common Navigator] NavigatorActionService doesn't use ActionGroup#updateActionBars()
Summary: [Common Navigator] NavigatorActionService doesn't use ActionGroup#updateActio...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Michael D. Elder CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 126659
  Show dependency tree
 
Reported: 2006-01-05 16:03 EST by Michael Valenta CLA
Modified: 2006-02-27 09:57 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2006-01-05 16:03:58 EST
NavigatorActionService subclasses ActionGroup but does not use the inherited updateActionBars(). For ActionGroups, fillActionBars should only get called once. Subsequent updates to the action bars should be done by calling setContext() followed by updateActionBars(). Ideally, any subclasses should follow this same lifecycle.
Comment 1 Michael D. Elder CLA 2006-02-23 14:06:45 EST
Clients must reconfigure the actionbars every time the CommonActionProvider is invoked. This is required because seach selection could have a different set of retargetable actions associated with it. Therefore, if the NavigatorActionService follows the pattern of fillActionBars() + updateActionBars()*, each client must be aware that they must save a reference to the IActionBars, reconfigure the global actions for each invocation of updateActionBars(), in addition to updating any action selection/enablement state. 

Given this constraint, do you still think this change makes sense? I think that alot of clients will fail to recognize this and as a result will encounter subtle problems. 
Comment 2 Michael Valenta CLA 2006-02-23 14:35:43 EST
I think you are right that it is really a different contract and I agree that it would probably be more difficult for clients to understand if the behavior was changed to match ActionGroup. When I logged the bug, I didn't know anything about the internals of the action provider. The most important thing is to make sure that the behavior is documented in the CommonActionProvider so that clients know what to expect.
Comment 3 Michael D. Elder CLA 2006-02-23 15:09:52 EST
Sounds good. I'll update the documentation accordingly. 
Comment 4 Michael D. Elder CLA 2006-02-23 17:28:22 EST
Updated documentation for CommonActionProvider.
Comment 5 Boris Bokowski CLA 2006-02-24 15:27:41 EST
The fix for this introduced a new protected getter getActionSite() on an API class that clients may subclass.

Note that there are a lot of existing subclasses of CommonActionProvider, and their implementations do not always call super.init().  Shouldn't subclasses required to call super.init() if they override init()?  If yes, this should be specified on init(), not getActionSite().

Who is supposed to call getActionSite? The method is public, suggesting it might be called by anyone, not just subclasses. This suggests that calling super.init() from subclasses is in fact required.

Reopening to track this discussion.
Comment 6 Michael D. Elder CLA 2006-02-24 15:56:14 EST
The method init() is public, the method getActionSite is protected final. 

If clients want the super class to cache the actionSite, they should call init(). I can update the doc accordingly to reflect this. 

For existing clients that do not call super.init() (
in fact, since the method was originally abstract, there are no existing clients that could have called super.init()), they will not be broken; not all clients need to cache the action site, some of them just use inofmration from it to create their actions and then forget the site. 
Comment 7 Boris Bokowski CLA 2006-02-24 19:26:56 EST
Yes, you are right.  I don't know why I thought the getter was public.  Sorry for the false alarm!

So after all, this was a very minor addition to the API for subclasses.
Comment 8 Mike Wilson CLA 2006-02-25 14:52:03 EST
Ok, given that there is no API involved, you don't need input from me, but I am in favor of this change, in any case.
Comment 9 Michael D. Elder CLA 2006-02-27 09:57:50 EST
Fixed and released.