Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Adding a custom widget to MToolBar
Adding a custom widget to MToolBar [message #1690854] Tue, 31 March 2015 15:35 Go to next message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Hello,

I have a part with an MToolBar. I want to add to it a widget that isn't a button (let say a spinner, but it can be anything).
So far I created buttons for it by using MMenuFactory.INSTANCE.createDirectToolItem().

How can I add a widget though???
I see I can add a tool control but I am not sure how to use this option...

Thanks!!
Re: Adding a custom widget to MToolBar [message #1690892 is a reply to message #1690854] Tue, 31 March 2015 19:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2495
Registered: July 2012
Senior Member
Yes, what you are searching is the ToolControl. Have a look here for an example: http://www.vogella.com/tutorials/EclipseRCP/article.html#toolbar_advanced_toolcontrols
Re: Adding a custom widget to MToolBar [message #1690962 is a reply to message #1690892] Wed, 01 April 2015 10:13 Go to previous message
Gal Rogozinski is currently offline Gal RogozinskiFriend
Messages: 40
Registered: June 2014
Member
Ok,
My problem is that I am trying to add it to a toolbar of a dynamic part inside of my window, thus the xmi used in the tutorial is no good.
So I am writing the following code:

//create the toolbar programmatically
		MToolBar toolbar = MMenuFactory.INSTANCE.createToolBar();
		
		MToolControl button = MMenuFactory.INSTANCE.createToolControl();
		button.setContributorURI("bundleclass://org.eclipse.swt.widgets.Button");  //I use button just of example in the forum
					
		toolbar.getChildren().add(button);
		part.setToolbar(toolbar);


I tried variations of the is code, like setting contribution URI and not writing "bundleclass"... nothing worked Sad

Any ideas?
Previous Topic:Eclipse Event System
Next Topic:HelpContextId for command in the application model
Goto Forum:
  


Current Time: Sun Sep 24 15:56:19 GMT 2017

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

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