问题
I'm trying to override an existing command handler in Eclipse. Specifically, I want to override the Run command (org.eclipse.debug.ui.commands.RunLast) so that it first terminates the process from the previous launch before starts the new one. I read this article, wrote a handler and associated it with the Run command:
<extension point="org.eclipse.ui.handlers">
<handler commandId="org.eclipse.debug.ui.commands.RunLast"
class="net.anggo.tnr.TnRHandler">
<activeWhen>
<with variable="activeContexts">
<iterate operator="or">
<equals value="net.anggo.tnr.TnREnabled"></equals>
</iterate>
</with>
</activeWhen>
</handler>
</extension>
I added activeWhen
clause so that the new handler has a higher priority than the default handler. I activated TnREnabled context in an IStartup
. But still, the default handler is run when I hit the Run menu item. I assume this is because the priority of the default handler is still higher than that of the new one. So my question is..
How can I calculate the priority of the default handler so that I can compare it with that of the new handler? Does my assumption seem correct that it is a priority issue? Is there a diagnostic way I can see what the problem is e.g. plugin spy? I'd appreciate any of help.
来源:https://stackoverflow.com/questions/28132938/eclipse-plugin-overriding-standard-command-handler