1. Define CustomAction element in a declarative XML. I recommend to put this in a feature as described here MSDN: CustomAction Element
Note: Do NOT use dots in CustomAction Id, otherwise all buttons with associated actions will be disabled.
2. Register Ribbon on a page. I made it programmatically by the following code in the PreRender event handler.
protected void Page_PreRender(object sender, EventArgs e)
{
SPRibbon current = SPRibbon.GetCurrent(this);
if (current != null)
{
current.MakeTabAvailable("Ribbon.ClassifyDialog.Edit");
current.InitialTabId = "Ribbon.ClassifyDialog.Edit";
current.CommandUIVisible = true;
current.Minimized = false;
}
} 3. Register javascript component containing client side logic on a page using SP.Ribbon.PageManager.get_instance().addPageComponent()
Link with method description is here MSDN: addPageComponent.
This is it. Enjoy professional look'n'feel of your dialogs.