Files
ide/theia-extensions/gitzone-remote/lib/browser/gitzone-remote-frontend-module.js
T

68 lines
4.1 KiB
JavaScript

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GitZoneRemoteContribution = exports.GitZoneRemoteEnvironmentCommand = void 0;
const ws_connection_provider_js_1 = require("@theia/core/lib/browser/messaging/ws-connection-provider.js");
const common_menus_js_1 = require("@theia/core/lib/browser/common-menus.js");
const command_js_1 = require("@theia/core/lib/common/command.js");
const menu_model_registry_js_1 = require("@theia/core/lib/common/menu/menu-model-registry.js");
const message_service_js_1 = require("@theia/core/lib/common/message-service.js");
const preference_configurations_js_1 = require("@theia/core/lib/common/preferences/preference-configurations.js");
const index_js_1 = require("@theia/core/shared/inversify/index.js");
const gitzone_remote_protocol_js_1 = require("../common/gitzone-remote-protocol.js");
const gitzone_preference_configurations_js_1 = require("../common/gitzone-preference-configurations.js");
exports.GitZoneRemoteEnvironmentCommand = {
id: 'gitzone.remote.environment',
label: 'Git.Zone: Show Remote Environment',
};
let GitZoneRemoteContribution = class GitZoneRemoteContribution {
remoteServer;
messages;
registerCommands(registry) {
registry.registerCommand(exports.GitZoneRemoteEnvironmentCommand, {
execute: async () => {
const environment = await this.remoteServer.getEnvironment();
await this.messages.info(`Remote workspace: ${environment.workspacePath}`);
},
});
}
registerMenus(menus) {
menus.registerMenuAction(common_menus_js_1.CommonMenus.FILE_OPEN, {
commandId: exports.GitZoneRemoteEnvironmentCommand.id,
label: exports.GitZoneRemoteEnvironmentCommand.label,
});
}
};
exports.GitZoneRemoteContribution = GitZoneRemoteContribution;
__decorate([
(0, index_js_1.inject)(gitzone_remote_protocol_js_1.GitZoneRemoteServer),
__metadata("design:type", Object)
], GitZoneRemoteContribution.prototype, "remoteServer", void 0);
__decorate([
(0, index_js_1.inject)(message_service_js_1.MessageService),
__metadata("design:type", message_service_js_1.MessageService)
], GitZoneRemoteContribution.prototype, "messages", void 0);
exports.GitZoneRemoteContribution = GitZoneRemoteContribution = __decorate([
(0, index_js_1.injectable)()
], GitZoneRemoteContribution);
exports.default = new index_js_1.ContainerModule((bind, _unbind, isBound, rebind) => {
const preferenceBinding = isBound(preference_configurations_js_1.PreferenceConfigurations) ? rebind(preference_configurations_js_1.PreferenceConfigurations) : bind(preference_configurations_js_1.PreferenceConfigurations);
preferenceBinding.to(gitzone_preference_configurations_js_1.GitZonePreferenceConfigurations).inSingletonScope();
bind(gitzone_remote_protocol_js_1.GitZoneRemoteServer)
.toDynamicValue((context) => context.container
.get(ws_connection_provider_js_1.WebSocketConnectionProvider)
.createProxy(gitzone_remote_protocol_js_1.gitZoneRemotePath))
.inSingletonScope();
bind(GitZoneRemoteContribution).toSelf().inSingletonScope();
bind(command_js_1.CommandContribution).toService(GitZoneRemoteContribution);
bind(menu_model_registry_js_1.MenuContribution).toService(GitZoneRemoteContribution);
});
//# sourceMappingURL=gitzone-remote-frontend-module.js.map