开发者

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

开发者 https://www.devze.com 2023-01-26 02:46 出处:网络
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 snip

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!" />
 </menuContributi开发者_JAVA技巧on>

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消