Skip to main content



      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] Tue, 09 March 2010 22:34 Go to next message
Eclipse UserFriend
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 04:54 Go to previous messageGo to next message
Eclipse UserFriend
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 01:18 Go to previous messageGo to next message
Eclipse UserFriend
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 14:06 Go to previous message
Eclipse UserFriend
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: Mon Jun 16 08:36:54 EDT 2025

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

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

Back to the top