Dynamically create context menu items

Dear community,

is it possible to create context menu items in a dinamic fashion?

Static example:

[Action("MyMainIconAction", typeof(EditorController), Icon = "MyAction_Icon")]
    [ActionLayout(typeof(TranslationStudioDefaultContextMenus.EditorDocumentContextMenuLocation), 2)]
    public class MyMainIconAction : AbstractAction
    {
        protected override void Execute()
        {
            MessageBox.Show("My icon and shortcut key action sample.");
        }
    }


Desired dynamic example (supposed to be executed during runtime):

 MyMainIconAction myAction = new MyMainIconAction();
 myAction.ActionAttribute.ContextByType = typeof(EditorController);
 myAction.ActionAttribute.Id = "New Action";
 myAction.ActionAttribute.Icon = "MyAction_Icon";
 myAction.Initialize();

Thank you very much in advance,
Kai


P.S. I would also love to know, how to use an onActiveFileChange event or Similiar, if available, as I could not find how to use it in the documentation.