开发者

how to add context menu through java

I want to add a context(Right Click开发者_StackOverflow like open) menu in Eclipse plugin development through Java.I am able to do it through Plugin.xml but i want to add through Java.What is the way to do it?


I usually prefer to use either the class attribute of the menuContribution or alternatively the dynamic element... Using these, means you will have all you contributions in just one place...

If you really want to use Java, have a look at the interface of MenuManager. You simply add your context menu as always and the add the menu items using add(IContributionItem) (and possibly add(Action)).

There are a long list of IContributionItem implementations to get inspired from. Some of the more interesting are:

  • CommandContributionItem - used to add a command as declared with the commands extension point
  • ControlContribution - as a way to add any Control to a toolbar
  • CompoundContributionItem - a way to compute the contributions late
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜