Just a quick tip, instead of
Dialogue dialogue = EditorUtility.InstanceIDToObject(instanceID) as Dialogue;
if (dialogue != null)
{
ShowEditorWindow();
return true;
}
one can inline it all including casting, which for some makes it more readable
if(EditorUtility.InstanceIDToObject(instanceID) is Dialogue dialogue)
{
ShowEditorWindow();
return true;
}