在 Application.e4xmi 我有两个观点:
...
<children xsi:type="advanced:PerspectiveStack" xmi:id="_ySFusPeXEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.perspectivestack.main">
<children xsi:type="advanced:Perspective" xmi:id="_83bVsPeXEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.perspective.testmanager" label="Test manager">
...
<children xsi:type="advanced:Perspective" xmi:id="_bDA4oPeaEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.perspective.configurator" label="Configurator">
...
和一个包含两个项目的主菜单:
<mainMenu xmi:id="_xanVgPfWEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.menu.0">
<children xsi:type="menu:HandledMenuItem" xmi:id="_22vnAPfWEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.handledmenuitem.uno" label="uno" command="_LFFTsPhHEeK44MdhTvpdlg">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_28cw8PfXEeKXHJPsnYiiYQ" coreExpressionId="com.myapplication.ui.perspectiveselected.testmanager"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_49obAPfWEeKXHJPsnYiiYQ" elementId="com.myapplication.ui.handledmenuitem.due" label="due" command="_NXT1APhHEeK44MdhTvpdlg">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_ZP4lgPhHEeK44MdhTvpdlg" coreExpressionId="com.myapplication.ui.perspectiveselected.configurator"/>
</children>
</mainMenu>
当显示透视图“com.myapplication.ui.perspective.testmanager”时,必须显示菜单项“com.myapplication.ui.handledmenuitem.uno”。当显示透视图“com.myapplication.ui.perspective.configurator”时,必须显示菜单项“com.myapplication.ui.handledmenuitem.due”。
因此,我在 plugin.xml 中定义:
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="com.myapplication.ui.perspectiveselected.testmanager">
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="com.myapplication.ui.perspective.testmanager">
</equals>
</with>
</definition>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="com.myapplication.ui.perspectiveselected.configurator">
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="com.myapplication.ui.perspective.configurator">
</equals>
</with>
</definition>
</extension>
它不起作用!(菜单项总是显示)有什么想法吗?