Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Can different instances of a view part have different content in toolbars?(We have a view with multiple instances. Each instance has to show a different toolbar.)
Can different instances of a view part have different content in toolbars? [message #664613] Mon, 11 April 2011 11:46 Go to next message
Saurabh Mising name is currently offline Saurabh Mising nameFriend
Messages: 21
Registered: October 2010
Junior Member
Our view part for showing results has multiple instances. Each instance has to show objects of a particular class. The toolbar for the view part has visible when clauses to ensure that the right contributions show up depending upon the class of objects being displayed.

Assume that there are two types: Fruits and Vegetables and we are showing the results in multiple instances of the results view. Fruits will be shown in one instance of the results view and Vegetables will be shown in the other instance.

However, when the toolbar for Fruits is refreshed to show the contributions for Fruits, we find that toolbar for Vegetables also shows the SAME menu contributions.
Is there a way to show different menu contributions in the view toolbar of different instances of the same view?

Re: Can different instances of a view part have different content in toolbars? [message #664621 is a reply to message #664613] Mon, 11 April 2011 12:11 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There is one global application state managed by the IEvaluationService,
and that is provide for all enabledWhen/visibleWhen/activeWhen as well
as to a handler during execution.

But that impacts 2 multi-instance views that are side by side.

One possibility is to have the view use its IActionBars to contribute
CommandContributionItems directly from the view, instead of with
visibleWhen.

I'm not sure what another option would be, unless there was a way of
finding out who the visibleWhen expression was being evaluated for, and
I'm pretty sure that's not available in eclipse 3.x

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Can different instances of a view part have different content in toolbars? [message #667011 is a reply to message #664621] Mon, 25 April 2011 14:08 Go to previous message
Saurabh Mising name is currently offline Saurabh Mising nameFriend
Messages: 21
Registered: October 2010
Junior Member
We are taking the following approach to set visibility of the toolbar item when we have two instances of a view different toolbar items in each view:

1. In the partVisible event, we are updating the toolbar
2. Accessing IToolbarManager using getToolbarmanager() API.
3. Getting Confgiuration element from the menu contribution using extension registry.
4. Reading VisibleWhen attribute of configuration element and evaluating it using evaluation services
5. Accessing Contribution Item of the toolbar and setting the visibility evaluated at step 4.

Is that a correct way to set visibility of toolbar contribution item?
Previous Topic:Launching product overrides content of plugin_customization.ini
Next Topic:How to sync radio-menuitems with the toolbar
Goto Forum:
  


Current Time: Tue Apr 16 10:20:47 GMT 2024

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

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

Back to the top