动态菜单对View ToolBar的贡献通过plugin.xml

时间:2017-12-08 08:40:44

标签: eclipse plugins e4 pde

我们正在尝试使用MenuService填充View的工具栏,如本教程中所述 http://appddeevvmeanderings.blogspot.in/2007/10/eclipse-defining-your-own-toolbar-menu.html

在上面的教程中,他在视图中创建工具栏并从plugin.xml中读取命令

toolbar = new ToolBarManager(SWT.FLAT);
       getMenuService().populateContributionManager(toolbar, "toolbar:yourapp.toolbarX");
       toolbar.createControl(p);

在我们的代码中,我们使用View的ToolBarManager而不是创建ToolBarManager。

toolbar = getViewSite().getActionBars().getToolBarManager();
           getMenuService().populateContributionManager((ToolBarManager)toolbar, "toolbar:YourID?after=additions");
//         ((ToolBarManager)toolbar).createControl(parent);
           toolbar.update(true);
           getViewSite().getActionBars().updateActionBars();

这不起作用。任何帮助将受到高度赞赏。我想将其添加到视图的工具栏而不是我自己的自定义工具栏。它似乎在Eclipse 3.8中工作,而不是在Eclipse 4x以后。

0 个答案:

没有答案
相关问题