UIResourceOps.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import EditorEvents = require("../../editor/EditorEvents");
  2. import EditorUI = require("../EditorUI");
  3. import ModalWindow = require("./ModalWindow");
  4. import ResourceOps = require("../../resources/ResourceOps");
  5. export class CreateFolder extends ModalWindow {
  6. constructor(resourcePath: string) {
  7. super();
  8. this.resourcePath = resourcePath;
  9. this.init("New Folder", "AtomicEditor/editor/ui/resourcenewfolder.tb.txt");
  10. this.nameField = <Atomic.UIEditField> this.getWidget("folder_name");
  11. }
  12. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  13. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  14. var id = ev.target.id;
  15. if (id == "create") {
  16. var resourcePath = Atomic.addTrailingSlash(this.resourcePath) + this.nameField.text;
  17. if (ResourceOps.CreateNewFolder(resourcePath)) {
  18. this.hide();
  19. }
  20. return true;
  21. }
  22. if (id == "cancel") {
  23. this.hide();
  24. return true;
  25. }
  26. }
  27. }
  28. resourcePath:string;
  29. nameField: Atomic.UIEditField;
  30. }