theia-sprotty
Version:
Glue code for sprotty diagrams in a Theia IDE
74 lines • 3.02 kB
JavaScript
;
/*
* Copyright (C) 2018 TypeFox and others.
*
* Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var lib_1 = require("sprotty/lib");
var AbstractWorkspaceEditCommand = /** @class */ (function (_super) {
__extends(AbstractWorkspaceEditCommand, _super);
function AbstractWorkspaceEditCommand() {
return _super !== null && _super.apply(this, arguments) || this;
}
AbstractWorkspaceEditCommand.prototype.execute = function (context) {
this.workspaceEdit = this.createWorkspaceEdit(context);
this.workspace.applyEdit(this.workspaceEdit);
return context.root;
};
AbstractWorkspaceEditCommand.prototype.undo = function (context) {
// TODO implement revert workspace edit
return context.root;
};
AbstractWorkspaceEditCommand.prototype.redo = function (context) {
// TODO implement revert workspace edit
return context.root;
};
return AbstractWorkspaceEditCommand;
}(lib_1.Command));
exports.AbstractWorkspaceEditCommand = AbstractWorkspaceEditCommand;
var WorkspaceEditCommand = /** @class */ (function (_super) {
__extends(WorkspaceEditCommand, _super);
function WorkspaceEditCommand(action) {
var _this = _super.call(this) || this;
_this.action = action;
return _this;
}
Object.defineProperty(WorkspaceEditCommand.prototype, "workspace", {
get: function () {
return this.action.workspace;
},
enumerable: true,
configurable: true
});
WorkspaceEditCommand.prototype.createWorkspaceEdit = function (context) {
return this.action.workspaceEdit;
};
WorkspaceEditCommand.KIND = 'workspaceEdit';
return WorkspaceEditCommand;
}(AbstractWorkspaceEditCommand));
exports.WorkspaceEditCommand = WorkspaceEditCommand;
/**
* This is a client only action, so it does not have to be serializable
*/
var WorkspaceEditAction = /** @class */ (function () {
function WorkspaceEditAction(workspaceEdit, workspace) {
this.workspaceEdit = workspaceEdit;
this.workspace = workspace;
this.kind = WorkspaceEditCommand.KIND;
}
return WorkspaceEditAction;
}());
exports.WorkspaceEditAction = WorkspaceEditAction;
//# sourceMappingURL=workspace-edit-command.js.map