I have added visibleWhen directly under toolbar, look like platform is not respecting visibleWhen for toolbar.
This is how I defined the extension:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.trim.vertical2">
<toolbar
id="com.kk.toolbar2"
label="Charm bar">
<command
commandId="com.kk.command.showhelp"
icon="icons/help.gif"
label="Help"
style="push">
</command>
<visibleWhen
checkEnabled="false">
<test
forcePluginActivation="true"
property="com.kk.isKKPerspective"
value="true">
</test>
</visibleWhen>
</toolbar>
</menuContribution>
</extension>
visibleWhen has no effect on toolbar
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201589
Workaround for this problem is, adding visibleWhen for each command.
By adding visibleWhen on each command, toolbar is automatically getting disappeared if there are no visible elements
In my case, I want to add add a righside trim toolbar with some tool items. But I wanted to show this only in my perspective 'KKPerspective'.
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.trim.vertical2">
<toolbar
id="com.kk.toolbar2"
label="Charm bar">
<command
commandId="com.kk.command.showhelp"
icon="icons/help.gif"
label="Help"
style="push">
<visibleWhen
checkEnabled="false">
<test
forcePluginActivation="true"
property="com.kk.isKKPerspective"
value="true">
</test>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="com.kk.KKPerspectiveTester"
id="com.kk.propertyTester2"
namespace="com.kk.propertyTester2"
properties="isKKPerspective"
type="java.lang.Object">
</propertyTester>
</extension>
This is how I defined the extension:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.trim.vertical2">
<toolbar
id="com.kk.toolbar2"
label="Charm bar">
<command
commandId="com.kk.command.showhelp"
icon="icons/help.gif"
label="Help"
style="push">
</command>
<visibleWhen
checkEnabled="false">
<test
forcePluginActivation="true"
property="com.kk.isKKPerspective"
value="true">
</test>
</visibleWhen>
</toolbar>
</menuContribution>
</extension>
visibleWhen has no effect on toolbar
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201589
Workaround for this problem is, adding visibleWhen for each command.
By adding visibleWhen on each command, toolbar is automatically getting disappeared if there are no visible elements
In my case, I want to add add a righside trim toolbar with some tool items. But I wanted to show this only in my perspective 'KKPerspective'.
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.trim.vertical2">
<toolbar
id="com.kk.toolbar2"
label="Charm bar">
<command
commandId="com.kk.command.showhelp"
icon="icons/help.gif"
label="Help"
style="push">
<visibleWhen
checkEnabled="false">
<test
forcePluginActivation="true"
property="com.kk.isKKPerspective"
value="true">
</test>
</visibleWhen>
</command>
</toolbar>
</menuContribution>
</extension>
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="com.kk.KKPerspectiveTester"
id="com.kk.propertyTester2"
namespace="com.kk.propertyTester2"
properties="isKKPerspective"
type="java.lang.Object">
</propertyTester>
</extension>
No comments:
Post a Comment