void (@NotNull Editor editor) { initialize(); if (ourEditorSearchActions == null) { return; } // register editor final @Nullable Component newCmp = editor.getHeaderComponent(); final @Nullable WeakReference<Component> oldCmpRef = ourEditors.put(editor, new WeakReference<>(newCmp)); final @Nullable Component oldCmp = oldCmpRef != null ? oldCmpRef.get() : null; if (oldCmp != null) { TouchBarsManager.unregister(oldCmp); } if (newCmp != null) { TouchBarsManager.register(newCmp, ourEditorSearchActions, ourCustomizer); } }