Extending editor without script on GameObject?

I wrote this script to extend the Editor with the purpose to hide the cursor when right clicking in scene view. It works; however, I have to be selected on the object with the script first. Is it possible to extend the Editor like this, but have it not be limited to selecting the gameobject with the script every time?

@CustomEditor (NoRightMouseInScene)
class NoRightMouseInSceneEditor extends Editor{

	function OnSceneGUI ()
	{
		if(Event.current.type == EventType.MouseDown && Event.current.button == 1)
		{
			Screen.showCursor = false;
		}
		else if(Event.current.type == EventType.MouseUp && Event.current.button == 1)
		{
			Screen.showCursor = true;
		}
	}
}

Thanks.

You have that code in an inspector, and so it will only run (I think) when the object is selected. Try moving the code into the OnGUI() function of an object.