How to get context in an editor menu extension

We have a plugin that extends the StaticMeshEditor, by adding a custom Tools Menu… The extension works, the menu shows up, and our delegates are called. The problem is, how do we get a reference back to the StaticMeshEditor instance that launched this menu item? There doesnt seem to be any context information passed to FUIAction delegates.

Heres our code:

struct FStaticMeshEditorExtensions
{

// ****************************************************************
void ApplyUVDisplacement()
{
	// HOW TO??? Get the static mesh editor that called me?!?
}

// ****************************************************************
void FillToolsMenu(FMenuBuilder& InMenuBuilder)
{
	InMenuBuilder.BeginSection("UVTools");
	{
		InMenuBuilder.AddMenuEntry(
			LOCTEXT("StaticMeshEditorExtensionMenuApplyUVDisplacement", "Apply UV Displacement"),
			LOCTEXT("StaticMeshEditorExtensionToolTipApplyUVDisplacement", "ApplyUVDisplacement"),
			FSlateIcon::FSlateIcon(),
			FUIAction(FExecuteAction::CreateRaw(this, &FStaticMeshEditorExtensions::ApplyUVDisplacement))
			);
	}
	InMenuBuilder.EndSection();
}

// ****************************************************************
void GenerateToolsMenu(FMenuBarBuilder& InMenuBarBuilder)
{
	InMenuBarBuilder.AddPullDownMenu(
		LOCTEXT("StaticMeshEditorExtensionMenuTools", "Tools"),
		LOCTEXT("StaticMeshEditorExtensionToolTipTools", "Opens a menu with tools for meshes"),
		FNewMenuDelegate::CreateRaw(this, &FStaticMeshEditorExtensions::FillToolsMenu),
		"Tools");
}

// ****************************************************************
void InstallExtensions()
{
	// Get the StaticMeshEditor module
	IStaticMeshEditorModule* staticMeshEditorModule = &FModuleManager::LoadModuleChecked<IStaticMeshEditorModule>("StaticMeshEditor");
	if (staticMeshEditorModule == nullptr)
		return;
	
	// Create an extension to the static mesh editor menu
	menuExtender = MakeShareable(new FExtender);
	menuExtender->AddMenuBarExtension(
		"Asset",
		EExtensionHook::After,
		NULL,
		FMenuBarExtensionDelegate::CreateRaw(this, &FStaticMeshEditorExtensions::GenerateToolsMenu)
		);
	
	staticMeshEditorModule->GetMenuExtensibilityManager()->AddExtender(menuExtender);
}

Hello,

It is a really old thread but right now, I am getting the exact same issue.
Do you have some news or does someone have a new idea to get the StaticMeshEditor instance ?

Eventually, I just found a way.
You can use FAssetEditorManager to watch what asset was opened, and from here, find the associated editor. It is the same function used to check if the asset is already opened when you try to open again the same asset (giving the focus to the editor instance).

void FMyClassEditor::Initialize()
{
	FAssetEditorManager::Get().OnAssetEditorOpened().AddRaw(this, &FMyClassEditor::OnAssetEditorOpened);
}

void FMyClassEditor::OnAssetEditorOpened(UObject* AssetOpened)
{
	IAssetEditorInstance* assetEditorInstance = FAssetEditorManager::Get().FindEditorForAsset(AssetOpened, false);
	FStaticMeshEditor* staticMeshEditor = (FStaticMeshEditor*)(assetEditorInstance);
}