How to get Eclipse Package Explorer Action Bars

799 views Asked by At

i need to retrieve the Package Explorer action bars to set a GlobalAction (setGlobalActionHandler). I'm using Eclipse 3.6.

Ideas?

Thanks!

1

There are 1 answers

3
VonC On

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.