BuildComplete.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. class BuildComplete extends Atomic.UIWindow {
  2. constructor(parent: Atomic.UIWidget, ev: ToolCore.BuildCompleteEvent) {
  3. super();
  4. parent.addChild(this);
  5. this.buildFolder = ev.buildFolder;
  6. this.text = ev.success ? "Build Complete" : "Build Failed";
  7. this.load("AtomicEditor/editor/ui/buildcomplete.tb.txt");
  8. this.resizeToFitContent();
  9. this.center();
  10. var reveal = <Atomic.UIButton>this.getWidget("reveal");
  11. if (!ev.success)
  12. reveal.setState(Atomic.UI_WIDGET_STATE_DISABLED, true);
  13. this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
  14. }
  15. handleWidgetEvent(ev: Atomic.UIWidgetEvent): boolean {
  16. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  17. if (ev.target.id == "reveal") {
  18. console.log("REVEAL!");
  19. var utils = new Editor.FileUtils();
  20. utils.revealInFinder(this.buildFolder);
  21. }
  22. if (ev.target.id == "ok") {
  23. // passed up to build output window for now
  24. // which closes both
  25. return false;
  26. }
  27. }
  28. return false;
  29. }
  30. buildFolder: string;
  31. }
  32. export = BuildComplete;