簡體   English   中英

菜單eclipse插件中的命令激活

[英]Command activation in menu eclipse plugin

我想在“視圖菜單”中創建一個菜單,以使用戶可以通過選擇菜單項之一來選擇如何顯示視圖。

因此,我確實添加了一個有助於視圖的菜單,並在其中添加了兩個樣式為“無線電”的命令,我將兩個命令都指向了相同的命令名稱,並在其中添加了兩個不同的值。 我聲明了一個新的命令,一個新的處理程序,並且我的處理程序工作正常,因為我確實將sysout設置為“ Handler Executed”,並且每次在視圖中打開菜單時,都會執行“ isEnabled”功能。

我的問題是,我無法單擊我的收音機按鈕,也不知道為什么。 我的plugin.xml中沒有警告,我不知道它拒絕工作的原因。

命令proc“ isEnabled”,但無法選擇條目

如果您能幫助我,請先謝謝您,我感覺有點卡在這里:/

這是我的plugin.xml。 擴展菜單:

<menuContribution
            allPopups="false"
            locationURI="menu:fr.sumo.ui.view.MyView">
         <command
               commandId="fr.sumo.ui.handlers.ShowTreeViewerHandler"
               label="Command1"
               style="push">
            <parameter
                  name="fr.sumo.ui.commands.ShowTreeViewerHandler"
                  value="RuleTreeViewer">
            </parameter>
         </command>
         <command
               commandId="fr.sumo.ui.handlers.ShowTreeViewerHandler"
               label="Command2"
               style="push">
            <parameter
                  name="fr.sumo.ui.commands.ShowTreeViewerHandler"
                  value="FileTreeViewer">
            </parameter>
         </command>
      </menuContribution>

命令擴展:

<command
        id="fr.sumo.ui.handlers.ShowTreeViewerHandler"
        name="Show Rule TreeViewer">
     <commandParameter
           id="fr.sumo.ui.commands.ShowTreeViewerHandler"
           name="fr.sumo.ui.commands.ShowTreeViewerHandler">
     </commandParameter>
  </command>

擴展處理程序:

 <handler
        class="fr.sumo.ui.handler.ShowRuleTreeViewerHandler"
        commandId="fr.sumo.ui.handlers.ShowTreeViewerHandler">
 </handler>

所以我終於找到了答案,這是顯而易見的。 在我的處理程序類中,方法isEnabled()返回false ,這是我的項目不可點擊的原因。 只是必須將其變為真實。

@Override
public boolean isEnabled() {
    System.out.println("isEnabled !");
    return false;
}

謝謝btw ppl,誰可能嘗試在我的plugin.xml中查找問題^^

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM