Custom thumbnail for class

Hi,

I am trying to set custom thumbnails, in the editor, for my c++ actor classes, since to search image by eye is faster than to read class names, especially when there are alot classes in one folder.

after some search I have reached to do this:

MyActor.h

class AMyActor : public AActor {
...
static TSharedPtr< class FSlateStyleSet > StyleSet;

}

MyActor.cpp

TSharedPtr< FSlateStyleSet > AMyActor::StyleSet = nullptr;

void AMyActor::foo() {
	StyleSet = MakeShareable(new FSlateStyleSet("MyActorStyleSet"));
	StyleSet->SetContentRoot(FPaths::EngineContentDir() / TEXT("Editor/Slate"));
	StyleSet->SetCoreContentRoot(FPaths::EngineContentDir() / TEXT("Slate"));

	auto brush = new FSlateImageBrush( 
		StyleSet->RootToContentDir(TEXT("Icons/AssetIcons/PaperCharacter_64x"),TEXT(".png"))
		, FVector2D(64.0f, 64.0f)
		);

	StyleSet->Set("ClassThumbnail.AMyActor", brush);
	FSlateStyleRegistry::RegisterSlateStyle(*StyleSet.Get());
}

my questions is:

1- where should I call foo() ?
I have tried to call it from PostInializeComponents() but the editor crashed. ( noob ^^)

2- is this line ok ?
StyleSet->Set(“ClassThumbnail.AMyActor”, brush);

thank you.