0

我有这个问题,我无法排除故障。我们有两个包含相同观点的观点。此视图有一个基于 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

似乎问题出在元素上,因为从角度来看,选择正在处理任何选择提供者。当您切换透视选择更改并且菜单项被禁用时。我使用有效的 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.7 M5 中。这是否发生在最近的版本或 3.7 M6 中?

于 2011-03-17T11:31:59.763 回答