0
我想通過一個插件在Eclipse的運行菜單中添加一個菜單項。只爲一個透視圖添加一個菜單項
但是,我只希望在「報表設計」角度(此爲BIRT)時顯示此項目。其次,(如果可能的話)我希望菜單項僅在打開文件的擴展名爲.rptdesign時才能啓用。
我並沒有 滾裝
任何提示讚賞使用任一知名度或在plugin.xml visibleWhen元素運氣好的話,
我想通過一個插件在Eclipse的運行菜單中添加一個菜單項。只爲一個透視圖添加一個菜單項
但是,我只希望在「報表設計」角度(此爲BIRT)時顯示此項目。其次,(如果可能的話)我希望菜單項僅在打開文件的擴展名爲.rptdesign時才能啓用。
我並沒有 滾裝
任何提示讚賞使用任一知名度或在plugin.xml visibleWhen元素運氣好的話,
最終得到了它,這是我有什麼做.....
創建Command
<extension
point="org.eclipse.ui.commands">
<command
name="Deploy"
icon="icons/deploy.gif"
style="push"
id="com.test.deployCommand">
</command>
創建的處理程序中的命令
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="com.test.deployCommand"
class="com.test.DeployHandler">
</handler>
添加一個可用的現有特性的檢查中BIRT(測試文件類型) - 如果我改變了命名空間參數是行不通的
<extension
point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
class="org.eclipse.birt.report.debug.internal.ui.script.ScriptDebuggerPropertyTester"
id="com.test.propertyTester1"
namespace="scriptdebug"
properties="isRptdesign"
type="org.eclipse.core.runtime.IAdaptable">
</propertyTester>
增加了兩個定義
<extension point="org.eclipse.core.expressions.definitions">
<definition id="com.test.inRptDesignPerspective">
<with variable="activeWorkbenchWindow.activePerspective">
<equals value="org.eclipse.birt.report.designer.ui.ReportPerspective"/>
</with>
</definition>
<definition id="com.test.inRptDesignFile">
<with variable="selection">
<count value="1" />
<iterate>
<and>
<test property="scriptdebug.isRptdesign" />
</and>
</iterate>
</with>
</definition>
</extension>
在我的菜單擴展,增加了設置的命令,這標誌着當其可見
<extension
point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:org.eclipse.ui.main.menu" id="com.test.contribution2">
<menu
id="org.eclipse.ui.run"
label="Run"
path="additions">
<groupMarker
name="preview">
</groupMarker>
<command
commandId="com.test.deployCommand"
icon="icons/deploy.gif"
id="com.test.deployCommand"
menubarPath="org.eclipse.ui.run/preview"
style="push"
class="com.test.DeployHandler">
<visibleWhen>
<and>
<reference definitionId="com.test.inRptDesignPerspective"/>
<reference definitionId="com.test.inRptDesignFile"/>
</and>
</visibleWhen>
</command>
</menu>
</menuContribution>
您使用的是'isPerspectiveOpen'財產? – tkotisis
不,我一直沒有使用isPerspectiveOpen,但我無法找到該屬性使用的一個很好的例子。 –