I'm in the process of implementing a custom tab, group and button for the SharePoint 2010 ribbon. The button is to behave almost identically to the standard Editing Tools>Insert>Link button, except instead of allowing freetext entry of a link, the dialog will launch an ActiveX DMS browser allowing a document to be selected, and a link generated.
I've attempted to pull apart the implementation of the standard Link button but I've been unable to satisfactorily determine how it works. I'd have expected there to be a CommandUIHandler for the standard button in CMDUI.XML, with possibly an EnabledScript (so I could see how it's enabled/disabled and copy this) and a CommandAction (so I could determine how to correctly launch the RTEDialog.aspx page and have it insert a link). Neither of those are present in CMDUI.XML (as far as I can tell).
With the background information out of the way, I guess my actual question can be broken down into two parts:
How can I mimic the standard Insert Link button enabled/disabled states?
How can I launch a slightly tweaked version of RteDialog.aspx correctly, so that my generated link is inserted successfully?