Hi,
for my Plugin I'd like to have a menu entry when right clicking into an editor. So I added extensions to org.eclipse.ui.menus, org.eclipse.ui.commands and org.eclipse.ui.handlers:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="popup:#TextEditorContext?before=group.edit">
<command
commandId="menuentries.formattable"
icon="icons/formattable.PNG"
label="Format Table"
style="push"
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="myPackage.TableFormatter"
id="menuentries.formattable"
name="FormatTable">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="myPackage.TableFormatter"
commandId="menuentries.formattable">
</handler>
</extension>
When launching an Eclipse Application the menu entry appears in the editor's contextmenu as I wanted and when I press the entry, the execute-method of TableFormatter is invoked. So everything seems to fit, BUT
if I debug as an Eclipse Application Eclipse will pause when right-clicking into the editor and following stack trace appears:
org.eclipse.equinox.launcher.Main at localhost:1581
Thread [main] (Class load: TableFormatter)
Class<T>.getDeclaredConstructors0(boolean) line: not available [native method]
Class<T>.privateGetDeclaredConstructors(boolean) line: not available
Class<T>.getConstructor0(Class[], int) line: not available
Class<T>.newInstance0() line: not available
Class<T>.newInstance() line: not available
EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor, String, String) line: 184
This happens when the EquinoxRegistryStrategy's createExecutableExtension for the className (second argument) "myPackage.TableFormatter" is invoked.
When I press Continue, everything works fine (execute-method is invoked and works properly).
Did I forget something?
What has also to be mentioned: When exporting my plugin as an Eclipse Product, the menu entry is visible but nothing happens when the entry is clicked on... So there MUST be something that I've done wrong, but I don't hit on it....
my handler:
public class TableFormatter extends AbstractHandler {
public TableFormatter() {
super();
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
}