|
@@ -7,6 +7,7 @@ import { NotebookSearchProvider } from './providers/notebooksearchprovider';
|
|
|
import { Token } from '@phosphor/coreutils';
|
|
|
import { Widget } from '@phosphor/widgets';
|
|
|
import { IDisposable, DisposableDelegate } from '@phosphor/disposable';
|
|
|
+import { ISignal, Signal } from '@phosphor/signaling';
|
|
|
|
|
|
/* tslint:disable */
|
|
|
/**
|
|
@@ -32,6 +33,12 @@ export interface ISearchProviderRegistry {
|
|
|
* @returns the search provider, or undefined if none exists.
|
|
|
*/
|
|
|
getProviderForWidget(widget: any): ISearchProvider | undefined;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Signal that emits when a new search provider has been registered
|
|
|
+ * or removed.
|
|
|
+ */
|
|
|
+ changed: ISignal<ISearchProviderRegistry, void>;
|
|
|
}
|
|
|
|
|
|
export class SearchProviderRegistry implements ISearchProviderRegistry {
|
|
@@ -53,8 +60,10 @@ export class SearchProviderRegistry implements ISearchProviderRegistry {
|
|
|
*/
|
|
|
register(key: string, provider: ISearchProviderConstructor): IDisposable {
|
|
|
this._customProviders.set(key, provider);
|
|
|
+ this._changed.emit();
|
|
|
return new DisposableDelegate(() => {
|
|
|
this._customProviders.delete(key);
|
|
|
+ this._changed.emit();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -71,6 +80,10 @@ export class SearchProviderRegistry implements ISearchProviderRegistry {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ get changed(): ISignal<this, void> {
|
|
|
+ return this._changed;
|
|
|
+ }
|
|
|
+
|
|
|
private _registerDefaultProviders(
|
|
|
key: string,
|
|
|
provider: ISearchProviderConstructor
|
|
@@ -92,6 +105,7 @@ export class SearchProviderRegistry implements ISearchProviderRegistry {
|
|
|
return undefined;
|
|
|
}
|
|
|
|
|
|
+ private _changed = new Signal<this, void>(this);
|
|
|
private _defaultProviders: Private.ProviderMap = new Map<
|
|
|
string,
|
|
|
ISearchProviderConstructor
|