开发者

How to get Eclipse Package Explorer Action Bars

i need to retrieve the Pack开发者_如何学Pythonage Explorer action bars to set a GlobalAction (setGlobalActionHandler). I'm using Eclipse 3.6.

Ideas?

Thanks!


Not tested, but this old 2006 thread might still present the right principle:

Certain standard menu entries can be shared among several views and editors.
So called global or retargetable actions and include tools like undo/redo, cut/copy/paste, print, find, delete, and more. (look at class IWorkbenchActionFactory).
Each view or editor is allowed to contribute a handler for these actions; when a new part becomes active, its handler takes control of that action. A view has to register its global action handlers in the createPartControl method:

   IActionBars actionBars = getViewSite().getActionBars();
   actionBars.setGlobalActionHandler(
      IWorkbenchActionFactory.COPY,
      myCopyAction);

In order to override copy/paste implementation of Package Explorer you need to get its ViewSite.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜