Workaround for using the internal class AboutHandler in RCP for which access is discouraged

354 views Asked by At

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?

2

There are 2 answers

2
Zoltán Ujhelyi On BEST ANSWER

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.

4
Paul Webster On

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.