0

トラブルシューティングに問題があるというこの問題があります。同じビューを含む 2 つのパースペクティブがあります。このビューには、instanceof に基づいて有効になるメニューがあります。ツリーからアイテムを選択して右クリックすると、instanceof が適合するため、メニューが有効になります。次に、同じビューを持つ別のパースペクティブに変更すると、ツリー内の選択は変更されませんが、選択されている同じアイテムを右クリックすると、メニューが有効になりません。メニューを再度有効にするには、ビューをクリックしてから戻す必要があります。plugin.xml を定義する方法は次のとおりです。パースペクティブを変更しない場合は正常に機能するため、plugin.xml は問題ないと思います。パースペクティブを変更するとメニューが更新されるのに、再チェックしない理由を理解する必要があります。

また、このビューを含まないパースペクティブに切り替えると、戻ったときにメニューが有効になります。

<extension

     point="org.eclipse.ui.commands">

  <command

        id="com.cerner.automation.touchstone.workflow.Modify"

        name="%com.cerner.automation.touchstone.workflow.Modify.label">

  </command>

<extension

      point="org.eclipse.ui.handlers">

   <handler



         commandId="com.cerner.automation.touchstone.workflow.Modify">

      <enabledWhen>

         <with

               variable="selection">

            <iterate

                  ifEmpty="false"

                  operator="and">

               <instanceof

                     value="com.cerner.automation.touchstone.model.ModuleItem">

               </instanceof>

            </iterate>  

         </with>

      </enabledWhen>

   </handler>

</extension>

<extension

     point="org.eclipse.ui.menus">

  <menuContribution

        locationURI="popup:com.cerner.automation.touchstone.views.ModuleView">

     <command

           commandId="com.cerner.automation.touchstone.workflow.Modify"

           icon="icons/modify.png"

           label="%com.cerner.automation.touchstone.workflow.Modify.label"

           style="push">

     </command>

  </menuContribution>

 </extension>
4

2 に答える 2

1

選択は選択プロバイダーの観点から処理されるため、問題は要素にあるようです。視点を切り替えると選択が変わり、メニュー項目が無効になりました。選択プロバイダーの数を 1 つのビューに制限するために、有効な activePartID を使用しました。例:

<handler
            class="ru.griffo.core.handlers.EditBOHandler"
            commandId="ru.scops.applications.edit">
         <activeWhen>
            <and>
               <with
                     variable="activePartId">
                  <equals
                        value="ru.scops.applications.applications">
                  </equals>
               </with>
               <count
                     value="+">
               </count>
           <with
                 variable="selection">
              <iterate
                    ifEmpty="false"
                    operator="and">
                 <not>
                    <test
                          property="ru.griffo.core.ui.bo.super"
                          value="griffo.state.State">
                    </test>
                 </not>
              </iterate>
           </with>
        </and>
     </activeWhen>
  </handler>
于 2010-12-11T00:28:52.220 に答える
0

おそらくこのバグに遭遇しています:https ://bugs.eclipse.org/bugs/show_bug.cgi?id = 334524使用しているEclipseのバージョンはどれですか?3.7M5で修正しました。これは最近のビルドまたは3.7M6で発生しますか?

于 2011-03-17T11:31:59.763 に答える