|
Re: Update label of handled tool item [message #879567 is a reply to message #879072] |
Thu, 31 May 2012 12:59 |
Marko Herchet Messages: 13 Registered: May 2012 |
Junior Member |
|
|
Hi Muki,
you can use the EModelService to get the MainToolbar.
Should look smth. like:
@Inject
private EModelService m_ModelService;
@Inject
private MWindow m_Window;
MApplication app = (MApplication)((EObject)m_Window).eContainer();
MToolBar mainToolbar = (MToolBar)m_ModelService.find("toolbar:org.eclipse.ui.main.toolbar", app);
mainToolbar.getChildren() should contain your login-item. The problem is that iam not sure if the Renderer will react on your MToolItem.setLabel("username") and updates the label of the Widget that was created for the MUIElement.
Bug 374568 for example shows that the Renderers do not react on every change yet.
The (imho) "bad" way would be to directly manipulate the widget which should work (already tried it for the MainMenu) and should look smth. like this:
((MenuItem)((Toolbar)mainToolbar.getWidget()).getItem(i)).setText("username")
[Updated on: Thu, 31 May 2012 13:05] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03168 seconds