5

I would like to have a right aligned search field in the toolbar of an Eclipse RCP application. I already created the text field as ControlContribution and the respective search action in the ActionBarAdvisor class:

protected void fillCoolBar(ICoolBarManager coolBar) {
  IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
  //...
  toolbar.add(new ControlContribution("searchText") {
  //...

This works and I have the search field in the toolbar. But how can I align the search text (or the toolbar with the search text) on the right side?

Thanks, Michael

0

1 Answer 1

9

If you mean positioning search toolbar on the right hand site of the main toolbar, then consider using these areas instead (when using org.eclipse.ui.menus extension point):

toolbar:org.eclipse.ui.main.toolbar - the top-level tool bar 
toolbar:org.eclipse.ui.trim.command1 - the top left trim 
toolbar:org.eclipse.ui.trim.command2 - the top right trim 
toolbar:org.eclipse.ui.trim.vertical1 - the left vertical trim 
toolbar:org.eclipse.ui.trim.vertical2 - the right vertical trim 
toolbar:org.eclipse.ui.trim.status - the status line trim 
2
  • Hey Michael, could you make an example? Is it compatible with e4 ?
    – Campa
    Commented Jun 18, 2019 at 15:58
  • @Campa Hi. Sorry, is been 8 years since I've submitted the answer - I don't even have the environment to write an example, since I've switched to a different tech stack since then.. Commented Jun 18, 2019 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.