For a previous question which I had, I found a solution which makes use of some deprecated API's.
So to run something when the user click on a marker, I added this into my plugin.xml
:
<extension point="org.eclipse.ui.editorActions">
<editorContribution targetID="org.eclipse.cdt.ui.editor.CEditor"
id="org.eclipse.ui.texteditor.ruler.actions">
<action
actionID="RulerClick"
class="com.example.MarkerClickAction"
id="com.example.MarkerClickAction"
label="%Dummy.label">
</action>
</editorContribution>
</extension>
I tried to translate the editorActions
to org.eclipse.ui.menus
and so far I came up with this:
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="org.eclipse.cdt.ui.editor.CEditor">
<command
commandId="com.example.MarkerClickAction"
description="Opens Quick Fix when the user clicks a marker"
id="org.eclipse.ui.texteditor.ruler.actions"
name="Marker Click Action">
</command>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="com.example.MarkerClickAction"
commandId="com.example.MarkerAction">
</handler>
</extension>
The single thing which I don't know how to map is the actionID="RulerClick"
field from the <action>
.
Where should I configure that information?
You also need a org.eclipse.ui.commands
extension point to define the command id.
There isn't a simple mapping from a handler to an old action.
The handler will usually extends org.eclipse.core.commands.AbstractHandler
.
The org.eclipse.ui.handlers.HandlerUtil
class provides a number of helper methods for handlers to do things like getting the active editor.
Note that although org.eclipse.ui.editorActions
is marked as deprecated it is very unlikely that it will ever be removed as too much existing code uses it.