0

I'm aware of why using internal classes is discouraged, and am generally happy to stick to not using them.

However, in my RCP I want to use a command rather than an action to display the About dialog. Hence I have extended org.eclipse.ui.internal.about.AboutHandler for my handler class, which is discouraged.

Is there a workaround available to use this class or rather its functionality?

kapa
  • 77,694
  • 21
  • 158
  • 175
s.d
  • 4,017
  • 5
  • 35
  • 65

2 Answers2

2

I think, you could reuse the existing contribution:

  1. Press Alt+Shift+F2 (Ctrl+Shift+F2 on Mac)
  2. Select the About from your Eclipse instance
  3. Will open the Plug-in menu spy that should provide you with the ID of the menu contribution (basically command ID) of the About command.

If you have the command ID, you could simply specify a menu contribution for the item, as shown in the following tutorial using the cut/copy/paste items.

jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
Zoltán Ujhelyi
  • 13,788
  • 2
  • 32
  • 37
  • Thanks. Apart from that the hotkey for the Plug-in menu spy is `ALT+SHIFT+F2` (which was easy to find out when your suggestion didn't work :)), this is very helpful. The menu spy said that the `About` menu and popup is indeed implemented via the `ActionFactory.ABOUT` `action` rather than a `command`, so I guess I'll just stick with the `action` myself. – s.d Jan 10 '12 at 08:58
  • Thanks for the feedback about the hotkey - I am using a Mac which has some keybindings different. I updated my answer to represent this. – Zoltán Ujhelyi Jan 10 '12 at 11:13
2

I'll just add that you get the default AboutHandler for free when you depend on org.eclipse.ui (which provides the RCP workbench support), and prior to that being the default simply creating the org.eclipse.ui.actions.ActionFactory.ABOUT action and registering it in your WorkbenchWindowAdvisor would fill in a handler for the command for free.

Paul Webster
  • 10,614
  • 1
  • 25
  • 32
  • Thanks. That's how I've done it before I read (in Jeff McAffer's book) that `commands` are to be preferred over `actions`. So I've tried the `ui.internal.AboutHandler` as a handler (discouraged), and simply extending that class (also discouraged). If I cannot find a decent way (haven't tried out Zoltán's suggestion yet), I'll simply go back to using the `action`. – s.d Jan 10 '12 at 08:21
  • And why don't you get the handler for free? is it not defined as the defaultHandler in your target platform `org.eclipse.ui/plugin.xml`? – Paul Webster Jan 10 '12 at 13:03
  • Hi @Paul, the `defaultHandler` that is in `org.eclipse.ui/plugin.xml` is the inner class `org.eclipse.ui.internal.about.AboutHandler`... But perhaps I simply didn't get your point correctly? I don't have a `WorkbenchWindowAdvisor.java` in my plugin (only the `ApplicationWorkbenchWindowAdvisor`)... – s.d Jan 10 '12 at 15:25
  • My point is if that is already defined as a default handler in `org.eclipse.ui` you should simply be able to add the about command to the menu. – Paul Webster Jan 11 '12 at 13:07