how to add menu in eclipse MenuBar through eclipse plugin from java File
I want to add my menu in eclipse through eclipse plug-in development but not through plugin.xml. I want to use java code, as we can do the same by using IWorkBenchWindowPullD开发者_StackOverflow中文版own interface for adding pulldown menu. So what is the way to add menu in menuBar.
As above, you can use org.eclipse.ui.menus and add a menuContribution that includes a dynamic element. Then you can return whatever IContributionItems you would like from your implementation of CompoundContributionItem. See http://wiki.eclipse.org/Menu_Contributions
See the documentation of MenuManager. You could get the MenuManager via WorkbenchWindow.getMenuManager()
Check this out Menu Contributions. Scroll down for Menus API.
精彩评论