Bug 264036 - [Contributions] support menu contributions for page book view toolbars
Summary: [Contributions] support menu contributions for page book view toolbars
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Prakash Rangaraj CLA
QA Contact:
URL: http://www.eclipse.org/newsportal/art...
Whiteboard:
Keywords:
: 75737 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-07 08:53 EST by Charles Godwin CLA
Modified: 2019-09-24 13:58 EDT (History)
4 users (show)

See Also:


Attachments
Patch v01 (4.27 KB, patch)
2010-11-26 03:13 EST, Prakash Rangaraj CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Charles Godwin CLA 2009-02-07 08:53:50 EST
There is one element of the new command framework that I cannot find covered anywhere. I have experimented with code and have not solved the problem. This makes me conclude that the answer is so obvious I can't see it or that this is a bug / shortcoming of the Command Framework.

Using the command framework I have not been able to add, using only plugin.xml entries, the ability to add /control toolbar menu items to a specific page of a pagebook view.

For example, consider org.eclipse.ui.views.contentoutline.ContentOutline. The Eclipse PDE implements, in code, various contributing content outline pages for the outline view. When no editor is open the outline view has no toolbar items. Depending on the file opened for edit, the icons in the Content Outline view toolbar change to suit the file. Can that be done for a newly contributing page using only command framework entries? I also want to implement the same behaviour in my own pagebook views.

Paul Webster's comment is:
It doesn't look possible.

If the page site and page action bars returned a ContributionManager you could use IMenuService to populateContributionManager(*) (this would allow your toolbar to pick up plugin.xml contributions)  ... but I think a page site returns a SubToolBarManager, which is not an instance of ContributionManager.
Comment 1 David Carver CLA 2009-10-11 14:21:51 EDT
I just ran into this while working on some customization for the XSL Tools editor's outline view.   Any possibility of getting this addressed during 3.6?
Comment 2 Charles Godwin CLA 2010-05-31 13:17:32 EDT
Is this being worked on? 3.6?
Comment 3 Prakash Rangaraj CLA 2010-05-31 22:16:00 EDT
Unfortunately, not for 3.6
Comment 4 Prakash Rangaraj CLA 2010-11-18 04:45:51 EST
Paul,

    One possible solution I can think of is adding a source variable (like active_pagebook_page). The contributions can be made to the toolbar/menu uri of the view and can have a visibleWhen element using the source variable. Is this ok or should we go with any alternative approaches?
Comment 5 Paul Webster CLA 2010-11-18 08:39:10 EST
(In reply to comment #4)
> Paul,
> 
>     One possible solution I can think of is adding a source variable (like
> active_pagebook_page). The contributions can be made to the toolbar/menu uri of
> the view and can have a visibleWhen element using the source variable. Is this
> ok or should we go with any alternative approaches?

What we have today:  A pagebook view gets its IActionBars, and a ToolBarManager/MenuManager from the framework.  When the pagebook view creates a page, it uses SubActionBars.  So a specific page gets its IToolBarManager and adds to it ... but they're really SubContributionItems going into a SubContributionManager.

The question is, how do we correctly add items into the middle of the SCIs

PW
Comment 6 Prakash Rangaraj CLA 2010-11-26 03:13:07 EST
Created attachment 183904 [details]
Patch v01

(In reply to comment #5)
> The question is, how do we correctly add items into the middle of the SCIs

    By creating a dummy toolbar/menu managers and updating the actual managers with the contributed items. We would need an id for the page to populate the contributions. Is this good?
Comment 7 Paul Webster CLA 2010-11-29 08:38:46 EST
(In reply to comment #6)
> Created an attachment (id=183904) [details]
> Patch v01

I had a quick look at the patch.

1) the items would potentially be out of order in the page toolbar as they were added in a block.  Also, some contributions that depend on programmatic IContributionItems (after=some.id) would not be added.

2) We record the ContributionManagers that are passed in to the IMenuService  for both updates and because the contributions need to be released when the ContributionManager is no longer in use.  That breaks this API contract.

PW
Comment 8 Prakash Rangaraj CLA 2010-11-29 23:49:09 EST
*** Bug 75737 has been marked as a duplicate of this bug. ***
Comment 9 Lars Vogel CLA 2019-09-24 13:58:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.