|
|
Re: Ping - is anyone home? Anthony? any of the people [message #235138 is a reply to message #235103] |
Tue, 05 June 2007 23:59   |
Eclipse User |
|
|
|
Originally posted by: mlevison.gmail.com
Anthony Hunter wrote:
> Hi Mark,
>
> *Action* is not actually a GEF API but an Eclipse Core UI.
>
> If you google "eclipse retargetAction example" you get a bunch of answers
> back. That may be the place to start.
>
Thanks for the reply Anthony unfortunately none of the examples answer
the question (or any of the others that I asked recently). The java doc
and the examples answer the question - how to subclass a retargetAction.
But they don't answer:
1) What is a retargetActions?
2) How do they differ from IAction's
3) Are they compatible with Paul W.'s work on action Handler's in 3.3?
4) Why do some actions require retarget actions (cut, copy and paste)
and others not (print).
5) When I implement my own actions when do I need a retargetAction? When
don't I?
I also have another batch of open questions:
1) Why use ActionContributor vs. adding Actions in the ActionBarAdvisor?
2) When adding actions via an ActionBarContributor should you add the
actions to a ‘global handler’:
• pageSite.getActionBars().setGlobalActionHandler() as per the
logic editor sample **or** editor handler
• getEditorSite().getService(IHandlerService.class).
activateHandler() as per the shapes example?
3) If you’re using the ActionBarContributor how do you contribute to a
menu that already exists – perhaps file? In a specific place in that menu?
4) What did registering the print action and declaring the global action
key do? As per the redbook example. It certainly didn't add them to the
File Menu or Coolbar.
5) If I need strongly typed constructors and so don't want to use
plugin.xml is there an elegant/appropriate way to install a print action
in the menu?
I'm sorry for being a pain and repeating my questions I genuinely don't
know how else I'm going to get the answers I need to build a product.
Cheers
Mark Levison
|
|
|
Re: Ping - is anyone home? Anthony? any of the people [message #235165 is a reply to message #235138] |
Wed, 06 June 2007 10:32  |
Eclipse User |
|
|
|
Originally posted by: modica.cs.tu-berlin.deNOSPAM
Hi Mark,
I don't claim to be an expert but this is how I believe RetargetActions
work:
> 1) What is a retargetActions?
I can not express it clearlier than the JavaDoc:
* A <code>RetargetAction</code> tracks the active part in the workbench.
* Each RetargetAction has an ID. If the active part provides an action
* handler for the ID the enable and check state of the RetargetAction
* is determined from the enable and check state of the handler. If the
* active part does not provide an action handler then this action is
* disabled.
> 2) How do they differ from IAction's
RetargetActions implement IAction but they are just a kind of
placeholder that call concrete action that does something.
> 4) Why do some actions require retarget actions (cut, copy and paste)
> and others not (print).
Actually it seems that CopyRetargetAction is deprecated and refers to
ActionFactory that builds all kinds of RetargetActiosn including one for
Print!
> 5) When I implement my own actions when do I need a retargetAction? When
> don't I?
As you mentioned copy, cut, paste: It can be useful that a single button
(which is representing an IAction) in the top action bar can be shared
by different views, editors, etc. So a textual editor can tell this RA
that it shoulc C/C/P text. If you switch to a GEF editor the handle of
the RA is updated, so it would call the handling action provided by the
GEF editor.
I think global actions with overloaded notions like copy, cut, paste or
all the other stuff in ActionFactory should indeed be RAs while specific
actions of a single editor should be normal actions as it is unefficient
to set up two actions (the RA and the handle) when one is sufficient.
|
|
|
Powered by
FUDForum. Page generated in 0.02388 seconds