简体   繁体   中英

How do I add a spacer to an Eclipse RCP toolbar?

I would like to add a gap between two buttons on an Eclipse toolbar. Both these buttons are defined in the plugin.xml for the plugin. I have tried specifying a separator, as per the following XML snippet, but nothing shows up.

<menuContribution locationURI="toolbar:com.bogus.viewId.MyView">
    <command
          commandId="com.bogus.filters.menu"
          icon="icons/filter.gif"
          label="Filter Menu"
          style="pulldown"
          tooltip="Filter Menu" />
 </menuContribution>
 <menuContribution locationURI="toolbar:com.bogus.viewId.MyView">
     <separator name="com.bogus.separator1" />
 </menuContribution>
 <menuContribution locationURI="toolbar:com.bogus.viewId.MyView">
    <command
          commandId="com.bogus.commands.dangerous"
          icon="icons/bomb.png"
          label="BOOM!"
          tooltip="BOOM!" />
 </menuContribution>

As a side note, does anyone know where I can find a decent schema definition for the plugin.xml file? This is the best I could find so far, but its poor.

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/plugin_manifest.html

So it turns out the separator element can have a 'visible' attribute and this must be set to true.

<separator name="com.bogus.separator1" visible="true" />

I found this out by random googling. Still couldn't find a decent schema definition for the plugin.xml.

Above thing is not work for me. Here is my code.

<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
    <toolbar id="com.qas.testpage.toolbar">
        <separator name="com.qas.separator1" visible="true">
        </separator>
    </toolbar>
</menuContribution>
<menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
    <toolbar id="com.qas.testpage.toolbar">         
        <command commandId="com.qas.javatestsuite" icon="icons/qas/testjavasuite.png" tooltip="Create New Java TestSuite Project" id="com.qas.toolbar" label="Java Test Suite Project">
        </command>
    </toolbar>
</menuContribution>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM