1

The Delphi IDE has a plugin system, the Open Tools API. The IDE also has a number of refactorings available, such as a rename refactoring to rename a field, method, etc - an identifier.

Is it possible to invoke this, or any, refactorings from the OTAPI? If not, is there a hacky way to do it?

My research shows no mentions of refactorings in ToolsAPI.pas, but I don't want to give up with "No." It doesn't mean there isn't a way to do it - it just means I don't know what it is :)

David
  • 13,360
  • 7
  • 66
  • 130
  • Do you just want to invoke the commands that show the dialogs? Or do you want to control all of it programmatically? – David Heffernan Jan 24 '14 at 15:26
  • Ideally, all programmatically. That said, invoking the dialogs and then controlling them (via code, eg setting the text fields, "clicking" OK, etc) to invoke the refactoring would fall into "a hacky way to do it". – David Jan 24 '14 at 15:31

1 Answers1

2

There is no support at all from OTA. Therefore your only hope is to hunt down the menu items or actions, invoke their OnClick or OnExecute handlers, poke values into the dialogs that are shown, and then programmatically press the dialog OK buttons.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Thanks David. I was afraid this was the case - but it was worth asking. Do you have any resources on the right way to hunt for menu items within the IDE? I am still quite new to the OTAPI in general. – David Jan 24 '14 at 15:42
  • 2
    I think the best resources are the GExperts and CnPack source code. You might find the GExperts code easier to read. But both do enumerate all the menu items so they already have that part of the code. Poking values into dialogs is a little different. If I recall, these dialogs are not VCL dialogs. They are some wacky J# dialogs, I think. So you might have more trouble with that part of it. – David Heffernan Jan 24 '14 at 15:53