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 classIWorkbenchActionFactory
).
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 thecreatePartControl
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
.
精彩评论