Overriding standard commands [message #1736467] |
Wed, 29 June 2016 10:51  |
Eclipse User |
|
|
|
Hello there.
I'm writing a plugin for eclipse wherein I would like to override the existing Build Project command and replace it with my own handler. To increase the priority of my handler over the default handler for the run command, I've used the activewhen restriction like so:
<extension
point="org.eclipse.ui.handlers">
<handler
class="%%myHandler"
commandId="org.eclipse.ui.project.buildProject">
<activeWhen>
<with variable="activePartId">
<equals value="%%myActiveViewId"/>
</with>
</activeWhen>
</handler>
</extension>
I've used Alt+Shift+F1,( the spy) to verify that my view is active while using the command.
This is where the command has been declared:
<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.ui.category.project"
id="org.eclipse.ui.project.buildProject"
name="Build Project">
</command>
</extension>
I've also extended org.eclipse.ui.startup to write a startup class to keep lazy loading at bay.
However, on execution, the default handler is still the one that is being executed. What am I doing wrong?
I've been trying to override the run command too,using the same template. However, that attempt also has been futile.(probably due to the same mistake I've made there).
stackoverflow.com/questions/28132938/eclipse-plugin-overriding-standard-command-handler
Can this source be trusted? Is that still the case?
Thanks.
|
|
|
Re: Overriding standard commands [message #1741015 is a reply to message #1736467] |
Mon, 22 August 2016 07:32  |
Eclipse User |
|
|
|
Choosing the right handler is the responsibility of the Platform and there isn't a way to enforce a handler over another in case of multiple ones active at the same time. However, you can contribute builders or listeners to the necessary projects if you want to add steps in the build phase.
The SO question has no answer, so there is nothing to trust in it.
|
|
|
Powered by
FUDForum. Page generated in 0.03148 seconds