Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension
Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension [message #519814] Wed, 10 March 2010 03:34 Go to next message
czetsuya is currently offline czetsuyaFriend
Messages: 9
Registered: March 2010
Location: Philippines
Junior Member
Hi,

Is it possible to add the views short list ContributionItemFactory.VIEWS_SHORTLIST (id: viewsShortlist) in the org.eclipse.ui.menus extension of the plugin.xml?

The way I do it now is thru ApplicationActionBarAdvisor:
showViewItem = ContributionItemFactory.VIEWS_SHORTLIST.create(window);

Thanks,
czetsuya


Re: Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension [message #519938 is a reply to message #519814] Wed, 10 March 2010 09:54 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

No, there's no CompoundContributionItem that could be used in a dynamic
element in o.e.ui.menus.

For now you have to do it in your action builder, or try creating your
own CompoundContributionItem that also implements
org.eclipse.ui.menus.IWorkbenchContribution (you can get your
IWorkbenchWindow from the serviceLocator, I believe) and instantiating
it in there.

PW

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


Re: Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension [message #520083 is a reply to message #519814] Thu, 11 March 2010 06:18 Go to previous messageGo to next message
czetsuya is currently offline czetsuyaFriend
Messages: 9
Registered: March 2010
Location: Philippines
Junior Member
Hi,

What I did was in the Extension's tab, I added dynamic under o.e.u.menus with a class that extends CompoundContributionItem and override the getContributionItems method, unfortunately it only display the "other" menu.

protected IContributionItem[] getContributionItems() {
List<IContributionItem> menuContributionList = new ArrayList<IContributionItem>();
IContributionItem item = ContributionItemFactory.VIEWS_SHORTLIST.create(ApplicationUt il.getWorkbenchWindow());
menuContributionList.add(item);
return menuContributionList.toArray(new IContributionItem[menuContributionList.size()]);
}

When I add, an item individually it works. Very Happy. Other approach?

Thanks,
czetsuya


Re: Add VIEWS_SHORTLIST(id: viewsShortlist) in the org.eclipse.ui.menus extension [message #520546 is a reply to message #520083] Fri, 12 March 2010 19:06 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

czetsuya wrote:
>
> When I add, an item individually it works. :d. Other approach?

Check to make sure you are passing in the correct IWorkbenchWindow when
you create it. Also, check what is being done in the
org.eclipse.ui.internal.ShowViewMenu.fillMenu(IMenuManager) method.
Does it have all of the information it needs to process contributions?

Also, does your perspective define view shortcuts?

Other alternatives: You might have to proxy the
ContributionItemFactory.VIEWS_SHORTLIST instead of using
CompoundContributionItem (so that you're passing on calls to fill(*),
etc) or sublcass ShowViewMenu to provide a default constructor and use
that with <dynamic/>

PW

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


Previous Topic:Bundle org.eclipse.equinox.launcher.win32.win32.x86_1.0.3.R33x_v20080118 failed to resolve.
Next Topic:How to programmatically create a context menu entry for arbitrary editors?
Goto Forum:
  


Current Time: Thu Apr 25 16:03:41 GMT 2024

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

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

Back to the top