Refactor controller architecture and multi-insert state
- Rename ControllerContext to ControllerMessageBus for clarity - Switch ControllerBase to use SingletonRaised - Replace MarkEventsMixin with MarkerManager for multi-cursor editing - Add populate_popup event support for source view context menus - Remove unused swap file events - Moved JSON prettify feature to plugin - Fix event name: "removed_file" -> "remove_file"
This commit is contained in:
@@ -15,15 +15,15 @@ class SingletonError(Exception):
|
||||
T = TypeVar('T', bound='SingletonRaised')
|
||||
|
||||
class SingletonRaised:
|
||||
_instance = None
|
||||
__instance = None
|
||||
|
||||
def __new__(cls: Type[T], *args: Any, **kwargs: Any) -> T:
|
||||
if cls._instance is not None:
|
||||
if cls.__instance is not None:
|
||||
raise SingletonError(f"'{cls.__name__}' is a Singleton. Cannot create a new instance...")
|
||||
|
||||
cls._instance = super(SingletonRaised, cls).__new__(cls)
|
||||
return cls._instance
|
||||
cls.__instance = super(SingletonRaised, cls).__new__(cls)
|
||||
return cls.__instance
|
||||
|
||||
def __init__(self) -> None:
|
||||
if self._instance is not None:
|
||||
if self.__instance is not None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user