How do I hook into global actions, such as copy and delete?

Source: Internet
Author: User

 

FAQ how do I hook into global actions, such as copy and delete?

How to associate the global retarget action in the view.

 

Certain Standard toolbar and menu entries can be shared among several views and editors. These actions are called either
GlobalOrRetargetableActions and include such common tools as Undo/Redo, CUT/copy/paste, print, find, delete, and more. 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 typically registers its global action handlers inCreatepartcontrolMethod:

   IActionBars actionBars= getViewSite().getActionBars();   actionBars.setGlobalActionHandler(      ActionFactory.COPY.getId(),      copyAction);

You have to do this only once for each view that is created. The platform remembers your Action Handler and retargets the action each time the view becomes active. to unregister from a global action, simply invoke
SetglobalactionhandlerAgain and pass inNullValue for the handler.

TheIworkbenchactionconstantsInterface inOrg. Eclipse. UIPackage contains a complete list of global actions. Look for constants in this interface with a comment saying "Global Action." In eclipse 3.0, you can also look at
ActionfactoryAndIdeactionfactoryClasses, which define factory objects for creating a variety of common actions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.