Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Custom control on main toolbar (RCP with compatibility layer)
Custom control on main toolbar (RCP with compatibility layer) [message #1728848] Thu, 07 April 2016 21:00 Go to next message
Bo Berney is currently offline Bo BerneyFriend
Messages: 12
Registered: July 2009
Junior Member
We are attempting to run our plug-ins that were created in Eclipse 3.7.2 using the compatibility mode of Eclipse 4.5.2.

Our custom controls are squashed on the toolbar.

Here is an example of our labels with icons:
index.php/fa/25578/0/

Here is an example of a test driver using text labels:
index.php/fa/25579/0/

The third attachment is a test driver that I borrowed and modified from another post (thanks Peter).

Here is what we are doing in the plugin.xml:
<extension point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="toolbar:org.eclipse.ui.main.toolbar">
         <toolbar id="testtoolbars.toolbar2">
            <control
                  class="testtoolbars.MyControlContribution"
                  id="whatevercontrol">
            </control>
         </toolbar>
      </menuContribution>
   </extension>


And MyControlContribution.createControl:
    protected Control createControl(Composite parent) {
        Composite container = new Composite(parent, SWT.NONE);
        container.setLayout(new FillLayout(SWT.HORIZONTAL));
        Label l = new Label(container, SWT.NONE);
        l.setText("AA");
        l = new Label(container, SWT.NONE);
        l.setText("BB");
        l = new Label(container, SWT.NONE);
        l.setText("CC");
        return container;
    }


Any ideas on how to fix this? I've tried a bunch of different layouts with no success.

Thank You.
  • Attachment: snap1.png
    (Size: 1.67KB, Downloaded 2548 times)
  • Attachment: snap2.png
    (Size: 5.91KB, Downloaded 2530 times)
  • Attachment: testtoolbar.zip
    (Size: 20.40KB, Downloaded 250 times)
Re: Custom control on main toolbar (RCP with compatibility layer) [message #1728971 is a reply to message #1728848] Fri, 08 April 2016 17:56 Go to previous messageGo to next message
Eclipse UserFriend
Don't put them inside a toolbar. Toolbar items have limited heights.

Alternatively, you can add a regular toolbar item with an invisible 16x1 pixel image. That's usually enough to resize the contents.
Re: Custom control on main toolbar (RCP with compatibility layer) [message #1728973 is a reply to message #1728971] Fri, 08 April 2016 18:47 Go to previous messageGo to next message
Bo Berney is currently offline Bo BerneyFriend
Messages: 12
Registered: July 2009
Junior Member
We are porting an existing 3.x product to 4.x and are utilizing the compatibility layer. We didn't want to re-write code until we are ready to convert to e4 plug-ins. We should be able to display a simple text label in the toolbar.

The main toolbar has numerous issues in compatibility mode. Toolbar is locked and cannot be unlocked, also no drag handles. The display of custom components (including labels) cuts off at top and bottom. The "toolbar:org.eclipse.ui.trim.command2" locationURI is ignored, so cannot display things on the right-side of the toolbar.

Everything else is working fine, just that the main toolbar does not seem to work well for us in compatibility mode.
Re: Custom control on main toolbar (RCP with compatibility layer) [message #1728975 is a reply to message #1728973] Fri, 08 April 2016 18:58 Go to previous messageGo to next message
Bo Berney is currently offline Bo BerneyFriend
Messages: 12
Registered: July 2009
Junior Member
Thanks for the suggestion to use an invisible icon to expand the composite to the correct height (16px), it's ugly but works.
Re: Custom control on main toolbar (RCP with compatibility layer) [message #1728982 is a reply to message #1728973] Fri, 08 April 2016 21:02 Go to previous messageGo to next message
Bo Berney is currently offline Bo BerneyFriend
Messages: 12
Registered: July 2009
Junior Member
The issue where the "toolbar:org.eclipse.ui.trim.command2" locationURI is ignored only happens with a new runtime workspace. If I close and re-open the application, the toolbar items are correctly located on the right side. Even if I reset the perspective, they stay to the right side. It's only the initial run with a new runtime workspace.


Re: Custom control on main toolbar (RCP with compatibility layer) [message #1792795 is a reply to message #1728982] Tue, 24 July 2018 08:23 Go to previous message
Michael Haywood is currently offline Michael HaywoodFriend
Messages: 4
Registered: July 2018
Junior Member
What if you need the toolbar to stretch more than 16px? I've tried adding a toolitem with a 64px image and it doesn't stretch the whole way.
Previous Topic:Programmatically update all tooltips when context changes?
Next Topic:How to properly include a Feature into another Feature
Goto Forum:
  


Current Time: Tue Apr 16 10:36:45 GMT 2024

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

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

Back to the top