Search code examples
eclipseeclipse-plugineclipse-rcpautomated-refactoring

Eclipse RCP - Conflicting handlers for ltk rename command


I am devloping an Eclipse RCP application in which I am writing my own refactoring code. I am overriding org.eclipse.ltk.ui.refactoring.commands.renameResource command as follows:

<extension point="org.eclipse.ui.commands">
  <command
      defaultHandler="com.rename.command.CustomRenameHandler"
      id="org.eclipse.ltk.ui.refactoring.commands.renameResource"
      name="Rename">
  </command>
</extension>

When I run the application, I get following error message

!MESSAGE Conflicting handlers for org.eclipse.ltk.ui.refactoring.commands.renameResource 

Due to this, sometimes my handler is called and sometimes RenameResourceHandler is called.

Any pointers will be helpful.


Solution

  • You can't override a command that already has an active or default handler.

    For refactoring rename you should write a rename participant using the org.eclipse.ltk.core.refactoring.renameParticipants extension point. Your participant will be called along with all the other participants that need to be run during a rename.