internal void Reload(object userData)
{
EditorWindow editorWindow = userData as EditorWindow;
if (!(editorWindow == null))
{
Type type = editorWindow.GetType();
string json = EditorJsonUtility.ToJson(editorWindow);
DockArea dockArea = editorWindow.m_Parent as DockArea;
if (dockArea != null)
{
int idx = dockArea.m_Panes.IndexOf(editorWindow);
dockArea.RemoveTab(editorWindow, false);
UnityEngine.Object.DestroyImmediate(editorWindow, true);
editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow);
dockArea.AddTab(idx, editorWindow);
}
else
{
editorWindow.Close();
editorWindow = (ScriptableObject.CreateInstance(type) as EditorWindow);
if (editorWindow != null)
{
editorWindow.Show();
}
}
EditorJsonUtility.FromJsonOverwrite(json, editorWindow);
}
}