Extend editor for spawning prefab on click.

I would like to extend editor with on click spawning prefab from a set of prefabs.

To be more precise It would look like this:
I would have a scriptable object with a set of prefabs, I would than open a window and drag this SO onto specified field. Click on a “Start” kind of button, and from now on every click on the scene would raycast to it and spawn prefabs at position with orientation derived from normals of the surface.

What I especially don’t know how to do is to take control of the cursor so clicking somewhere will override default behavior of clicking on the scene.

I gathered some info about this problem.
For people with similar issue I paste here the bare bone:

using System;
using UnityEditor;
using UnityEngine;

public class OnClickSpawnPrefabWizard : ScriptableWizard
{

    bool SpawnMode { get; set; }

    static string otherButtonNameFormat = "Active = {0}";

    [MenuItem("Tools/On Click Spawn Prefab")]
    public static void ShowWindow() {
        //Show existing window instance. If one doesn't exist, make one.
        ScriptableWizard.DisplayWizard<OnClickSpawnPrefabWizard>(
            "Spawn Prefabs", "Finish", string.Format(otherButtonNameFormat, false));
    }


    void OnWizardUpdate() {
        helpString = "Select prefabs set.";
        isValid = prefabsSet != null;
        this.errorString = isValid ? "" : "Prefabs Set not present!";
    }

    private void OnWizardOtherButton() {
        SpawnMode = !SpawnMode;
        this.otherButtonName = string.Format(otherButtonNameFormat, SpawnMode);
    }

    void OnWizardCreate() {
    }

    private void OnEnable() {
        SceneView.duringSceneGui += SceneView_duringSceneGui;
    }

    private void OnDisable() {
        SceneView.duringSceneGui -= SceneView_duringSceneGui;
    }

    private void SceneView_duringSceneGui(SceneView obj) {

        Handles.BeginGUI();
        // GUI Code here
        Handles.EndGUI();

        if (SpawnMode) {
            Event e = Event.current;
            int controlID = GUIUtility.GetControlID(FocusType.Passive);
            switch (e.GetTypeForControl(controlID)) {
                case EventType.MouseDown:
                    Debug.Log("Do the spawning here");
                    GUIUtility.hotControl = controlID;
                    e.Use();
                    break;
            }
        }
    }

 
}