Docking EditorWindow

How can i dock my custom EditorWindow automatically when it is called on menu or when the project opens?

Thanks in advance for any idea.

Finally found this out, there is 2 ways to open editor windows.

The first way:
static function GetWindow (t : System.Type, utility : boolean = false, title : String = null, focus : boolean = true) : EditorWindow

will look like :

AttachmentEditor editorWindow = (AttachmentEditor)EditorWindow.GetWindow ( typeof(AttachmentEditor), false, “Attachment Editor”, true);

The dockable way:
static function GetWindow. (title : String, focus : boolean, params desiredDockNextTo : System.Type) : T

Will look like:

AttachmentEditor editorWindow = GetWindow(“Attachment Editor”, true, typeof(SceneView));

As far I know, it can't be done yet, even in Unity 3.3.0f4

What you can do is create custom (predefined) Unity Layout that already loaded with your custom EditorWindow, and when trying to load the layout, your custom EditorWindow will automatically docked.

At the moment you can called your custom EditorWindow and merge (docked) with another editorwindow.

I know this is old, but if anyone else comes here looking for an answer, docking can be done by dragging the editor window tab, rather than the body of the window.