[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: How to associate global actions (copy, rename, etc.) with handler via plugin

In 3.3 you  would provide something in org.eclipse.ui.handlers:

[xml]
<handler
    class="org.example.MyPasteHandler"
    commandId="org.eclipse.ui.edit.paste">
  <activeWhen>
    <with variable="activePartId">
      <equals value="org.example.my.view.id"/>
    </with>
  </activeWhen>
</handler>
[/xml]

In 3.3 if you use ActionFactory.PASTE to create this action, then it will not necessarily be enabled properly when your view is active.

But placing paste in the Edit menu using org.eclipse.ui.menus should work fine.

The other way, acceptable for views and editors is to hook up handlers in your createPartControl(*):
IHandlerService service
= (IHandlerService) getSite().getService(IHandlerService.class);
pasteHandle = new MyPasteHandler(this);
service.activateHandler("org.eclipse.ui.edit.paste", pasteHandler);


Later,
PW


-- Paul Webster http://wiki.eclipse.org/Platform_Command_Framework http://wiki.eclipse.org/Command_Core_Expressions http://wiki.eclipse.org/Menu_Contributions http://wiki.eclipse.org/Menus_Extension_Mapping http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench.htm