Search code examples
javaeclipse-rcprcpe4

How to position a Handled Tool Item to the right


I've an application built on eclipse e4 framework. I want to position a Handled Tool Item to the far right end. How can I achieve it?

enter image description here


Solution

  • You need to use two 'Toolbar' entries with a 'Tool Control' between them: enter image description here

    so something like:

    enter image description here

    In the Tags for the Tool Control add the word stretch this will make the trim bar manager stretch out the control to use all available space pushing everything after it to the right: enter image description here

    The class for the control can something simple like:

    public class SpacerControl
    {
      @PostConstruct
      public void postConstruct(Composite parent)
      {
        Composite body = new Composite(parent, SWT.NONE);
    
        body.setLayout(new GridLayout());
      }
    }