InspectorBuilder.plugin.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. var InspectorBuilderServiceUILabel = "Inspector Builder";
  3. //Add custom inspectors here
  4. var ExampleInspector = require("./ExampleInspectors/ExampleInspector");
  5. var InspectorBuilderService = (function () {
  6. function InspectorBuilderService() {
  7. this.name = "InspectorBuilderService";
  8. this.description = "This service provides custom inspector functionality.";
  9. this.serviceLocator = null;
  10. }
  11. InspectorBuilderService.prototype.initialize = function (serviceLoader) {
  12. Atomic.print("InspectorBuilder.initialize");
  13. this.serviceLocator = (serviceLoader);
  14. if (this.serviceLocator) {
  15. this.serviceLocator.projectServices.register(this);
  16. this.serviceLocator.uiServices.register(this);
  17. }
  18. };
  19. InspectorBuilderService.prototype.projectUnloaded = function () {
  20. this.serviceLocator.uiServices.removePluginMenuItemSource(InspectorBuilderServiceUILabel);
  21. Atomic.print("InspectorBuilder.projectUnloaded");
  22. if (this.serviceLocator) {
  23. this.serviceLocator.projectServices.unregister(this);
  24. this.serviceLocator.uiServices.unregister(this);
  25. }
  26. };
  27. InspectorBuilderService.prototype.projectAssetClicked = function (asset) {
  28. Atomic.print("Inspector.projectAssetClicked with extension: " + asset.extension);
  29. if (asset.extension == ".example") {
  30. var exampleInspector = new ExampleInspector();
  31. this.serviceLocator.uiServices.loadCustomInspector(exampleInspector);
  32. exampleInspector.inspect(asset);
  33. return true;
  34. }
  35. return false;
  36. };
  37. return InspectorBuilderService;
  38. }());
  39. var inspectorBuilderService = new InspectorBuilderService();
  40. Object.defineProperty(exports, "__esModule", { value: true });
  41. exports.default = inspectorBuilderService;