| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- import EditorEvents = require("../../editor/EditorEvents");
- import EditorUI = require("../EditorUI");
- import ModalWindow = require("./ModalWindow");
- import ResourceOps = require("../../resources/ResourceOps");
- export class ResourceDelete extends ModalWindow {
- constructor(asset: ToolCore.Asset) {
- super();
- this.asset = asset;
- this.init("Delete Resource", "AtomicEditor/editor/ui/resourcedelete.tb.txt");
- var message = <Atomic.UIEditField> this.getWidget("message");
- var text = "Are you sure you want to delete resource:\n\n";
- text += asset.path;
- text += "\n\nThis operation cannot be undone";
- message.text = text;
- this.resizeToFitContent();
- this.center();
- }
- handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
- if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
- var id = ev.target.id;
- if (id == "delete") {
- this.hide();
- var db = ToolCore.getAssetDatabase();
- db.deleteAsset(this.asset);
- return true;
- }
- if (id == "cancel") {
- this.hide();
- return true;
- }
- }
- }
- asset: ToolCore.Asset;
- }
- export class CreateFolder extends ModalWindow {
- constructor(resourcePath: string) {
- super();
- this.resourcePath = resourcePath;
- this.init("New Folder", "AtomicEditor/editor/ui/resourcenewfolder.tb.txt");
- this.nameField = <Atomic.UIEditField> this.getWidget("folder_name");
- }
- handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
- if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
- var id = ev.target.id;
- if (id == "create") {
- var resourcePath = Atomic.addTrailingSlash(this.resourcePath) + this.nameField.text;
- if (ResourceOps.CreateNewFolder(resourcePath)) {
- this.hide();
- }
- return true;
- }
- if (id == "cancel") {
- this.hide();
- return true;
- }
- }
- }
- resourcePath: string;
- nameField: Atomic.UIEditField;
- }
|