UNPKG

2.85 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2019 TypeFox and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.DispatchingProgressClient = void 0;
19const tslib_1 = require("tslib");
20const inversify_1 = require("inversify");
21const progress_status_bar_item_1 = require("./progress-status-bar-item");
22const progress_location_service_1 = require("./progress-location-service");
23let DispatchingProgressClient = class DispatchingProgressClient {
24 showProgress(progressId, message, cancellationToken) {
25 const locationId = this.getLocationId(message);
26 if (locationId === 'window') {
27 return this.statusBarItem.showProgress(progressId, message, cancellationToken);
28 }
29 return this.locationService.showProgress(progressId, message, cancellationToken);
30 }
31 reportProgress(progressId, update, message, cancellationToken) {
32 const locationId = this.getLocationId(message);
33 if (locationId === 'window') {
34 return this.statusBarItem.reportProgress(progressId, update, message, cancellationToken);
35 }
36 return this.locationService.reportProgress(progressId, update, message, cancellationToken);
37 }
38 getLocationId(message) {
39 return message.options && message.options.location || 'unknownLocation';
40 }
41};
42(0, tslib_1.__decorate)([
43 (0, inversify_1.inject)(progress_status_bar_item_1.ProgressStatusBarItem),
44 (0, tslib_1.__metadata)("design:type", progress_status_bar_item_1.ProgressStatusBarItem)
45], DispatchingProgressClient.prototype, "statusBarItem", void 0);
46(0, tslib_1.__decorate)([
47 (0, inversify_1.inject)(progress_location_service_1.ProgressLocationService),
48 (0, tslib_1.__metadata)("design:type", progress_location_service_1.ProgressLocationService)
49], DispatchingProgressClient.prototype, "locationService", void 0);
50DispatchingProgressClient = (0, tslib_1.__decorate)([
51 (0, inversify_1.injectable)()
52], DispatchingProgressClient);
53exports.DispatchingProgressClient = DispatchingProgressClient;
54//# sourceMappingURL=progress-client.js.map
\No newline at end of file