Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to calculate which side of the workbench a ContributionItem has been placed.
How to calculate which side of the workbench a ContributionItem has been placed. [message #518421] Thu, 04 March 2010 04:53 Go to next message
ali Mising name is currently offline ali Mising name
Messages: 38
Registered: July 2009
Member
Hello all,

I need to determine on which side of the workbench (top, bottom, left or right) a toolbar ContributionItem has been placed. I understand how to initially position an item using the org.eclipse.ui.menu menuContribution locationURI setting, but I am unsure how to determine an items current location after it has been moved within a RCP Workbench.

I've noticed that WorkbenchWindowControlContribution's have handy getCurSide() method, but unfortunately ContributionItem's don't have this method. I know how to calculate a ContributionItem's orientation, but this doesn't help me know on which workbench side items currently resides.

I've searched the RCP UI model without much luck.

Does anyone have any ideas?
Re: How to calculate which side of the workbench a ContributionItem has been placed. [message #518629 is a reply to message #518421] Thu, 04 March 2010 16:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

That functionality is only implemented for the
WorkbenchWindowControlContribution as you found out.

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: How to calculate which side of the workbench a ContributionItem has been placed. [message #518721 is a reply to message #518629] Thu, 04 March 2010 19:49 Go to previous messageGo to next message
ali Mising name is currently offline ali Mising name
Messages: 38
Registered: July 2009
Member
Yeah, I've noticed this. I'm attempting to investigate some ways that I can determine which side a ContributionItem is docked. I'm hoping that I can use one of the existing Eclipse Services (InternalMenuService, TrimContributionManager, WorkbenchMenuService etc) to perform a search on each of the MenuUtil.TRIM_COMMAND1, MenuUtil.TRIM_COMMAND2, MenuUtil.TRIM_VERTICAL1, MenuUtil.TRIM_VERTICAL2, MenuUtil.TRIM_STATUS for a specific ContributonItem... or search the perspective or something???

If ControlContributions can do it, I'd like to do it too.

Any advice in support of a solution would be fantastic!

Many thanks.
Re: How to calculate which side of the workbench a ContributionItem has been placed. [message #519002 is a reply to message #518721] Fri, 05 March 2010 11:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I'm not sure how you can find out. When I looked at the code we mostly
depend on
org.eclipse.ui.internal.menus.TrimContributionManager.ToolBa rTrimProxy.dock(int)
to call setCurSide(*) on the specific type of contribution. The
implication being that it must be that type, and it's an internal type.

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: How to calculate which side of the workbench a ContributionItem has been placed. [message #519050 is a reply to message #519002] Fri, 05 March 2010 21:13 Go to previous message
ali Mising name is currently offline ali Mising name
Messages: 38
Registered: July 2009
Member
Yeah, I've looked at that code too and not found a solution...

I would happily use the WorkbenchWindowControlContribution, but an existing bug in that class is preventing me from creating a Control Contribution with a non-standard height.

I've searched the forums for a solution for that too, but found nothing that works. I can create another bug / post for that issue, but I don't think it will help because there are already plenty.

Please let me know if anyone does know how to extend WorkbenchWindowControlContribution to create a contribution that is taller that the default.
Previous Topic:How to find necessary features/plugins when composing an application?
Next Topic:"Platform filters" for fragments in Eclipse Product Export Wizard doesn't seem to work
Goto Forum:
  


Current Time: Mon Oct 20 22:58:05 GMT 2014

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

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