Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » add combobox to toolbar and change drop-down list programmatically(add combobox to toolbar and change drop-down list programmatically)
add combobox to toolbar and change drop-down list programmatically [message #648194] Tue, 11 January 2011 18:08 Go to next message
fran81 Missing name is currently offline fran81 Missing nameFriend
Messages: 27
Registered: November 2010
Junior Member
Hi,

I am trying to add a combobox to a toolbar in an eclipse rcp app. but I'd also like to have the content of the drop-down list changing programmatically (i.e. depending on other events). Right now this combobox works, but it's on a view instead of a toolbar.

Is there a way to achieve this by setting the plugin.xml (it looks like the content of the dropdown needs to be set this way at the beginning, and cannot be changed programmatically)?
Is there another way to do that?

Thanks,
Francesca
Re: add combobox to toolbar and change drop-down list programmatically [message #649333 is a reply to message #648194] Tue, 18 January 2011 19:02 Go to previous messageGo to next message
fran81 Missing name is currently offline fran81 Missing nameFriend
Messages: 27
Registered: November 2010
Junior Member
I found out how to do this, so I thought I may as well share.

To show a combobox (or other buttons) on the toolbar one can create a class for example

public class DoThis extends Action implements IWorkbenchAction {
public DoThis() {

}

|

this class should implements the method

public Menu getMenu(Control parent) {

}
to actually show a combobox and the menu should be populated by menuitems.

After that one needs to add this action to the toolbar. To do that I have written this code in the class that display the view that contains the toolbar

DoThis myaction = new DoThis();
getViewSite().getActionBArs().getToolBarManager().add(myacti on);
Re: add combobox to toolbar and change drop-down list programmatically [message #649335 is a reply to message #648194] Tue, 18 January 2011 19:21 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can place a <control/> in a toolbar using the org.eclipse.ui.menus
contribution. You can also create a dropdown toolitem and fill in the
dropdown menu dynamically also use org.eclipse.ui.menus and a <dynamic/>
element.

See some of the examples in my .sig links


--
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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Scrollbar For TextBox
Next Topic:eclipse rcp + spring + eclipselink
Goto Forum:
  


Current Time: Thu Apr 25 05:02:07 GMT 2024

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

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

Back to the top