Editor scripting - How to show the Assets menu as a context menu

I have an editor script that lets me select project files, similarly to what happens in Unity’s project view. When I right click the selected files, I want to display the Assets menu as the context menu, just like Unity does in the project view:

Is there a way to do this? I know I can replicate the Assets menu item by item, using something like the following:

var menu = new GenericMenu ();

(...)

menu.AddItem (new GUIContent ("Show in Explorer"),
  false, () => EditorApplication.ExecuteMenuItem("Assets/Show in Explorer"));

menu.AddItem (new GUIContent ("Open"),
  false, () => EditorApplication.ExecuteMenuItem("Assets/Open"));

(...)

menu.ShowAsContext ();

But this is unmaintainable, because there are a lot of menu items (especially in the Create submenu) and every time Unity changes the Assets menu (or another editor script adds a menu item), I will have to change code to be compatible.

Can this be done in a generic way? Maybe even using reflection. Having access to the way Unity’s project view does things would be a blessing.

Thanks!

There’s a way to show any built-in menu using Unity - Scripting API: EditorUtility.DisplayPopupMenu