Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Overriding standard commands (eclipse plugin which overrides buildproject command)
Overriding standard commands [message #1736467] Wed, 29 June 2016 14:51 Go to next message
Karthika Nair is currently offline Karthika NairFriend
Messages: 3
Registered: June 2016
Junior Member
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 11:32 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

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.
Previous Topic:Cannot run Eclipse
Next Topic:Opening .java files
Goto Forum:
  


Current Time: Fri Apr 26 20:14:01 GMT 2024

Powered by FUDForum. Page generated in 0.04161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top