<legend id='3c87y'><style id='3c87y'><dir id='3c87y'><q id='3c87y'></q></dir></style></legend>
      <bdo id='3c87y'></bdo><ul id='3c87y'></ul>

    <small id='3c87y'></small><noframes id='3c87y'>

      1. <i id='3c87y'><tr id='3c87y'><dt id='3c87y'><q id='3c87y'><span id='3c87y'><b id='3c87y'><form id='3c87y'><ins id='3c87y'></ins><ul id='3c87y'></ul><sub id='3c87y'></sub></form><legend id='3c87y'></legend><bdo id='3c87y'><pre id='3c87y'><center id='3c87y'></center></pre></bdo></b><th id='3c87y'></th></span></q></dt></tr></i><div id='3c87y'><tfoot id='3c87y'></tfoot><dl id='3c87y'><fieldset id='3c87y'></fieldset></dl></div>
      2. <tfoot id='3c87y'></tfoot>

        从 Eclipse 插件以编程方式更改菜单项

        Change Menu Items Programmatically From Eclipse Plugin(从 Eclipse 插件以编程方式更改菜单项)

          <legend id='jJ5F2'><style id='jJ5F2'><dir id='jJ5F2'><q id='jJ5F2'></q></dir></style></legend>
          <tfoot id='jJ5F2'></tfoot>

            <tbody id='jJ5F2'></tbody>

              <small id='jJ5F2'></small><noframes id='jJ5F2'>

            1. <i id='jJ5F2'><tr id='jJ5F2'><dt id='jJ5F2'><q id='jJ5F2'><span id='jJ5F2'><b id='jJ5F2'><form id='jJ5F2'><ins id='jJ5F2'></ins><ul id='jJ5F2'></ul><sub id='jJ5F2'></sub></form><legend id='jJ5F2'></legend><bdo id='jJ5F2'><pre id='jJ5F2'><center id='jJ5F2'></center></pre></bdo></b><th id='jJ5F2'></th></span></q></dt></tr></i><div id='jJ5F2'><tfoot id='jJ5F2'></tfoot><dl id='jJ5F2'><fieldset id='jJ5F2'></fieldset></dl></div>
                <bdo id='jJ5F2'></bdo><ul id='jJ5F2'></ul>
                • 本文介绍了从 Eclipse 插件以编程方式更改菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望能够在我的 eclipse 插件应用程序启动时完全删除菜单项.我想要做的是能够稍后根据基于用户操作的业务逻辑添加这些菜单项.有没有办法做到这一点?我已经考虑过使用贡献,但我觉得这不会是我想要的.

                  I would like to be able to completely remove menu items upon startup of my eclipse plugin application. What I want to do is be able to add these menu items later depending on business logic based off of the user's actions. Is there a way to do this? I've looked at using contributions, but I feel like it's not going to be exactly what I want.

                  如果它可以做我需要它做的事情,我该如何使用它们?提前感谢您的任何帮助.

                  If it can do what I need it to do, how do I go about using them? Thanks in advance for any assistance.

                  推荐答案

                  可以从MenuManager中获取Menu,然后修改contribution.此代码段显示如何访问菜单管理器并删除命名项.

                  You can obtain the Menu from the MenuManager and then modify the contributions. This snippet shows how to access the menu manager and remove a named item.

                  您需要跟踪已删除的项目和项目索引以恢复它们.唯一的麻烦是 indexOf 方法不可见.将此片段添加到与 MenuManager 相同的包中的类型并将其添加到片段是一种解决方法.

                  You'll need to keep track of the removed items and item indices to restore them. The only trouble is that the indexOf method is not visible. Adding this snippet to a type in the same package as MenuManager and adding it to a fragment is one way round that.

                  IWorkbenchWindow window = Workbench.getInstance().getActiveWorkbenchWindow()
                  
                  if(window instanceof WorkbenchWindow) {
                      MenuManager menuManager = ((WorkbenchWindow)window).getMenuManager();
                  
                      //TODO you may need to remove items from the coolbar as well
                      ICoolBarManager coolBarManager = null;
                  
                      if(((WorkbenchWindow) window).getCoolBarVisible()) {
                          coolBarManager = ((WorkbenchWindow)window).getCoolBarManager2();
                      }
                  
                      Menu menu = menuManager.getMenu();
                  
                      //you'll need to find the id for the item
                      String itemId = "menuId";
                      IContributionItem item = menuManager.find(itemId);
                  
                      // remember position, TODO this is protected
                      int controlIdx = menu.indexOf(mySaveAction.getId());
                  
                      if (item != null) {
                          // clean old one
                          menuManager.remove(item);
                  
                          // refresh menu gui
                          menuManager.update();
                      }
                  }
                  

                  这篇关于从 Eclipse 插件以编程方式更改菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                  How can I specify the default JVM arguments for programs I run from eclipse?(如何为从 Eclipse 运行的程序指定默认 JVM 参数?)
                  Class JavaLaunchHelper is implemented in both ... libinstrument.dylib. One of the two will be used. Which one is undefined(JavaLaunchHelper 类在... libinstrument.dylib 中都实现了.将使用两者之一.哪个是未定义的) - IT屋-程序员软件开发技术分享
                  Running Eclipse on Windows 7 JRE and JDK not found(找不到在 Windows 7 JRE 和 JDK 上运行 Eclipse)
                  StringBuilder vs. .concat vs. quot;+quot; Operator relative performance different in eclipse than command line?(StringBuilder vs. .concat vs. “+eclipse中的操作员相对性能与命令行不同?)
                  Is there a maximum number you can set Xmx to when trying to increase jvm memory?(尝试增加 jvm 内存时,您可以将 Xmx 设置为最大数量吗?)
                  <tfoot id='SSkin'></tfoot>

                    1. <small id='SSkin'></small><noframes id='SSkin'>

                      <i id='SSkin'><tr id='SSkin'><dt id='SSkin'><q id='SSkin'><span id='SSkin'><b id='SSkin'><form id='SSkin'><ins id='SSkin'></ins><ul id='SSkin'></ul><sub id='SSkin'></sub></form><legend id='SSkin'></legend><bdo id='SSkin'><pre id='SSkin'><center id='SSkin'></center></pre></bdo></b><th id='SSkin'></th></span></q></dt></tr></i><div id='SSkin'><tfoot id='SSkin'></tfoot><dl id='SSkin'><fieldset id='SSkin'></fieldset></dl></div>
                    2. <legend id='SSkin'><style id='SSkin'><dir id='SSkin'><q id='SSkin'></q></dir></style></legend>
                            <tbody id='SSkin'></tbody>
                            <bdo id='SSkin'></bdo><ul id='SSkin'></ul>