Eclipse plugin: overriding standard command handler

こ雲淡風輕ζ 提交于 2019-12-11 03:03:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!