blob: 5abf4fc8efaecfa61e56a7e2d048677d42a50ab3 [file]
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
AnnotationPluginApi,
CoverageProvider,
DiffLayerFactory,
TokenHoverListener,
} from '../../../api/annotation';
import {PluginApi} from '../../../api/plugin';
import {PluginsModel} from '../../../models/plugins/plugins-model';
import {ReportingService} from '../../../services/gr-reporting/gr-reporting';
export class GrAnnotationActionsInterface implements AnnotationPluginApi {
constructor(
private readonly reporting: ReportingService,
private readonly pluginsModel: PluginsModel,
private readonly plugin: PluginApi
) {
this.reporting.trackApi(this.plugin, 'annotation', 'constructor');
}
setCoverageProvider(provider: CoverageProvider) {
this.reporting.trackApi(this.plugin, 'annotation', 'setCoverageProvider');
this.pluginsModel.coverageRegister({
pluginName: this.plugin.getPluginName(),
provider,
});
}
addTokenHoverListener(listener: TokenHoverListener): void {
this.reporting.trackApi(this.plugin, 'annotation', 'addTokenHoverListener');
this.pluginsModel.tokenHoverListenerRegister({
pluginName: this.plugin.getPluginName(),
listener,
});
}
addDiffLayer(factory: DiffLayerFactory): void {
this.reporting.trackApi(this.plugin, 'annotation', 'addDiffLayer');
this.pluginsModel.diffLayerRegister({
pluginName: this.plugin.getPluginName(),
factory,
});
}
}