Search code examples
eclipseeclipse-rcpe4

Eclipse 3.x trimbar in Eclipse 4.x


Currently I am migrating a Eclipse RCP 3.7 application to an Eclipse 4.5 application. In the first step I have updated the target platform to Eclipse 4.5 and checking differences to the old version of the application.

In the new version the status bar height seems to be shrinked: enter image description here

In the old version it looks like this: enter image description here

I have tried to change from menuContributions (locationURI: toolbar:org.eclipse.ui.trim.status) in the plugin.xml to ModelFragment->TrimContribution->Toolbar->Tool Controls in fragment.e4xmi

Do I need to change the main CSS to adjust the height of the Toolbar? Which selector do I need to use?


Solution

  • Thanks to Rüdigers hint I have figured out, how to add the ContributionItems without the shown cut off.

    Firstly I have created a Handler:

    public class TrimWidget extends AbstractHandler
    {
        @Override
        public Object execute(ExecutionEvent event) throws ExecutionException
        {
            return null;
        }
    } 
    

    and registered it as command in the plugin.xml:

    <command
        defaultHandler="com.example.TrimWidget"
        id="com.example.trimWidget"
        name="-">
    </command>
    

    At last I have added the command to every ToolbarItem:

    <toolbar id="com.example.statusBarItem">
        <control 
            class="com.example.MyStatusBarContribution"
            id="MyStatusBarContribution">
        </control>
        <command
            commandId="com.example.trimWidget"
            icon="icons/toolbar-command.png">
        </command>
    </toolbar>
    

    The result does not look like the version of Eclipse 3, but it is acceptable. The Items are left aligned in the status bar and cannot be moved via drag and drop.