1

I've learned that actions in Eclipse-RCP should not be used and instead commands should be used.

The problem is if I try to use the ExtensionPoint org.eclipse.ui.viewActions(makes little icons on top of views, see Image) only Actions can be defined there.

alt text
(source: eclipse.org)

Is there a way to use commands with this ExtensionPoint?

If that is not possible, is it possible to execute a command from an action?

Thanks.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
flash
  • 6,730
  • 7
  • 46
  • 70

2 Answers2

0

As mentioned in my answer Eclipse RCP: Actions VS Commands, there are command extension points.

Command extension points http://www.vogella.de/articles/RichClientPlatform/images/command40.gif

I would recommand using those instead of action extension points.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I don't understand your answer. Is there a command extension that creates the same behaviour as org.eclipse.ui.viewActions does? – flash Aug 06 '09 at 10:26
0

Ok, I've got it.

You can use the org.eclipse.ui.menus extension point and add a new menuContribution with locationURI: "toolbar:yourViewId".

To this menu you can add commands and they will behave like the org.eclipse.ui.viewActions actions.

flash
  • 6,730
  • 7
  • 46
  • 70
  • I would like to do the same with editorActions but i cannot find a way to add "editorActions" via org.eclipse.ui.menus extension point. you have any idea how to do that? – wuppi Apr 13 '12 at 13:16