|
|
|
Re: Obtaining reference to Action declared in plugin [message #508835 is a reply to message #508453] |
Wed, 20 January 2010 14:00 |
|
AlesD wrote:
>
> is it better with with extension points org.eclipse.ui.commands and
> org.eclipse.ui.commandImages? I have found that some developers consider
> the actions from org.eclipse.ui.actionSets inferior to commands and even
> suggest their deprecation. It seems possible to obtain Command reference
> via ICommandService using it's ID. The Command however miss the UI
> properties like text and image.
There's 2 parts to what you want to do, but I'm not sure what's enough.
If you use a command+hander and command images. you can create a
CommandContributionItem. It can fill the Composite with a button. You
create them with a
org.eclipse.ui.menus.CommandContributionItemParameter, it will fill in
the label from the command name, and the images from commandImages for
you (you can even override some of that information when you create the
CCI).
If you expect to dynamically update a command's menu item or tool item,
then your handler would implement IElementUpdater and ICommandService
can request a UI element refresh ... but that's probably solving a
different problem.
Actions (as implemented in JFace) are tightly coupled MVC. ActionSets
suffer from the same thing, they limit the lifecycle, position,
composition, and behaviour of the contribution. But they both still
work, exactly as they always have (they are not under active
development, though, but are so widespread it would generate a lot of
useless warning messages for us to officially deprecate them).
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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Powered by
FUDForum. Page generated in 0.04237 seconds