diff --git a/src/edt/edt/edtEditorHooks.cc b/src/edt/edt/edtEditorHooks.cc index b369c5950..f9bacc137 100644 --- a/src/edt/edt/edtEditorHooks.cc +++ b/src/edt/edt/edtEditorHooks.cc @@ -23,6 +23,7 @@ #include "edtEditorHooks.h" #include "tlObjectCollection.h" +#include "tlStaticObjects.h" namespace edt { @@ -30,16 +31,28 @@ namespace edt // --------------------------------------------------------------- // EditorHooksManager definition and implementation +static EditorHooksManager *sp_instance = 0; +static bool sp_instance_initialized = false; + class EditorHooksManager { public: - EditorHooksManager () { } + EditorHooksManager () + { + // .. nothing yet .. + } + + ~EditorHooksManager () + { + sp_instance = 0; + } static EditorHooksManager *instance () { - static EditorHooksManager *sp_instance = 0; - if (! sp_instance) { + if (! sp_instance && ! sp_instance_initialized) { sp_instance = new EditorHooksManager (); + sp_instance_initialized = true; + tl::StaticObjects::reg (&sp_instance); } return sp_instance; } diff --git a/src/edt/edt/gsiDeclEdtEditorHooks.cc b/src/edt/edt/gsiDeclEdtEditorHooks.cc index 50ac6ab80..5350014c2 100644 --- a/src/edt/edt/gsiDeclEdtEditorHooks.cc +++ b/src/edt/edt/gsiDeclEdtEditorHooks.cc @@ -140,6 +140,11 @@ gsi::Class decl_EditorHooksBase ("lay", "EditorHooksBase", ) + gsi::method ("technologies", &edt::EditorHooks::get_technologies, "@brief Gets the list of technologies these hooks are associated with.\n" + ) + + gsi::method ("register", &edt::EditorHooks::register_editor_hook, gsi::arg ("hooks"), + "@brief Registers the hooks in the system.\n" + "The hooks will not be active before they are registered in the system. Registration will " + "also transfer object ownership to the system." ), "@brief The base class for editor hooks\n" "Editor hooks allow implementing technology-specific callbacks into the editor "