Oh you’re right, I misunderstood the question 
Ok this is done usually in the editor_ops.c
file. They are not very different from operators you’d usually define for a space editor. Here few references to define new operators:
https://en.blender.org/index.php/Dev:2.5/Source/Architecture/Operators
https://en.blender.org/index.php/Dev:2.5/Source/Architecture/Operators/Tutorial
Now let’s take again the movie clip as an example. The CLIP_OT_open
function, in clip_ops.c
, is a standard operator. You have to add two things, one in the invoke and one in the exec.
In open_invoke
, this code is used (the open_init
function):
PropertyPointerRNA *pprop;
op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
UI_context_active_but_prop_get_templateID(C, &pprop->ptr, &pprop->prop);
In open_exec
, this:
PropertyPointerRNA *pprop;
if (!op->customdata)
open_init(C, op);
/* hook into UI */
pprop = op->customdata;
if (pprop->prop) {
/* when creating new ID blocks, use is already 1, but RNA
* pointer use also increases user, so this compensates it */
id_us_min(&clip->id);
RNA_id_pointer_create(&clip->id, &idptr);
RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
RNA_property_update(C, &pprop->ptr, pprop->prop);
}
where clip is loaded from the selected file.
This is it actually. With this, you can pass it as operator to template_ID
. For the movie clip:
template_ID(sc, "clip", open="clip.open")