|
@@ -1,16 +1,19 @@
|
|
|
-var ExamplePluginUILabel = "Example Plugin";
|
|
|
|
|
|
|
+"use strict";
|
|
|
|
|
+var ExamplePluginUILabel = "TS Example Plugin";
|
|
|
var ExamplePluginTBPath = "EditorData/Example.tb.txt";
|
|
var ExamplePluginTBPath = "EditorData/Example.tb.txt";
|
|
|
-var ExamplePluginService = (function () {
|
|
|
|
|
- function ExamplePluginService() {
|
|
|
|
|
|
|
+var InfoboxTBPath = "EditorData/Infobox.tb.txt";
|
|
|
|
|
+var TSExamplePluginService = (function () {
|
|
|
|
|
+ function TSExamplePluginService() {
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
- this.name = "ExampleService";
|
|
|
|
|
|
|
+ this.name = "TSExampleService";
|
|
|
this.description = "This service demonstrates plugin functionality functionality.";
|
|
this.description = "This service demonstrates plugin functionality functionality.";
|
|
|
this.serviceLocator = null;
|
|
this.serviceLocator = null;
|
|
|
this.extensionWindow = null;
|
|
this.extensionWindow = null;
|
|
|
this.lastObjectName = null;
|
|
this.lastObjectName = null;
|
|
|
this.handleWidgetEvent = function (ev) {
|
|
this.handleWidgetEvent = function (ev) {
|
|
|
- if (!_this.extensionWindow)
|
|
|
|
|
|
|
+ if (!_this.extensionWindow) {
|
|
|
return;
|
|
return;
|
|
|
|
|
+ }
|
|
|
if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
|
|
if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
|
|
|
if (ev.target.id == "example_cancel") {
|
|
if (ev.target.id == "example_cancel") {
|
|
|
_this.extensionWindow.hide();
|
|
_this.extensionWindow.hide();
|
|
@@ -25,61 +28,64 @@ var ExamplePluginService = (function () {
|
|
|
return false;
|
|
return false;
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
- ExamplePluginService.prototype.initialize = function (serviceLoader) {
|
|
|
|
|
- Atomic.print("ExamplePluginService.initialize");
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.initialize = function (serviceLoader) {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.initialize");
|
|
|
this.serviceLocator = (serviceLoader);
|
|
this.serviceLocator = (serviceLoader);
|
|
|
if (this.serviceLocator) {
|
|
if (this.serviceLocator) {
|
|
|
this.serviceLocator.projectServices.register(this);
|
|
this.serviceLocator.projectServices.register(this);
|
|
|
this.serviceLocator.uiServices.register(this);
|
|
this.serviceLocator.uiServices.register(this);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.projectUnloaded = function () {
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.projectUnloaded = function () {
|
|
|
this.serviceLocator.uiServices.removeProjectContextMenuItemSource(ExamplePluginUILabel);
|
|
this.serviceLocator.uiServices.removeProjectContextMenuItemSource(ExamplePluginUILabel);
|
|
|
this.serviceLocator.uiServices.removeHierarchyContextMenuItemSource(ExamplePluginUILabel);
|
|
this.serviceLocator.uiServices.removeHierarchyContextMenuItemSource(ExamplePluginUILabel);
|
|
|
this.serviceLocator.uiServices.removePluginMenuItemSource(ExamplePluginUILabel);
|
|
this.serviceLocator.uiServices.removePluginMenuItemSource(ExamplePluginUILabel);
|
|
|
- Atomic.print("ExamplePluginService.projectUnloaded");
|
|
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.projectUnloaded");
|
|
|
if (this.serviceLocator) {
|
|
if (this.serviceLocator) {
|
|
|
this.serviceLocator.projectServices.unregister(this);
|
|
this.serviceLocator.projectServices.unregister(this);
|
|
|
this.serviceLocator.uiServices.unregister(this);
|
|
this.serviceLocator.uiServices.unregister(this);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.projectLoaded = function (ev) {
|
|
|
|
|
- Atomic.print("ExamplePluginService.projectLoaded");
|
|
|
|
|
- this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open": ["exampleplugin open"] });
|
|
|
|
|
- this.serviceLocator.uiServices.createHierarchyContextMenuItemSource(ExamplePluginUILabel, { "Get name": ["exampleplugin hierarchy context"] });
|
|
|
|
|
- this.serviceLocator.uiServices.createProjectContextMenuItemSource(ExamplePluginUILabel, { "Get name": ["exampleplugin project context"] });
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.projectLoaded = function (ev) {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.projectLoaded");
|
|
|
|
|
+ this.serviceLocator.uiServices.createPluginMenuItemSource(ExamplePluginUILabel, { "Open": ["tsexampleplugin open"] });
|
|
|
|
|
+ this.serviceLocator.uiServices.createHierarchyContextMenuItemSource(ExamplePluginUILabel, { "Get name": ["tsexampleplugin hierarchy context"] });
|
|
|
|
|
+ this.serviceLocator.uiServices.createProjectContextMenuItemSource(ExamplePluginUILabel, { "Get name": ["tsexampleplugin project context"] });
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.playerStarted = function () {
|
|
|
|
|
- Atomic.print("ExamplePluginService.playerStarted");
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.playerStarted = function () {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.playerStarted");
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.menuItemClicked = function (refId) {
|
|
|
|
|
- Atomic.print("ExamplePluginService.menuItemClicked: " + refId);
|
|
|
|
|
- if (refId == "exampleplugin open") {
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.menuItemClicked = function (refId) {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.menuItemClicked: " + refId);
|
|
|
|
|
+ if (refId == "tsexampleplugin open") {
|
|
|
this.extensionWindow = this.serviceLocator.uiServices.showModalWindow(ExamplePluginUILabel, ExamplePluginTBPath, this.handleWidgetEvent);
|
|
this.extensionWindow = this.serviceLocator.uiServices.showModalWindow(ExamplePluginUILabel, ExamplePluginTBPath, this.handleWidgetEvent);
|
|
|
this.getWidgets();
|
|
this.getWidgets();
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.hierarchyContextItemClicked = function (node, refid) {
|
|
|
|
|
- Atomic.print("ExamplePluginService.hierarchyContextItemClicked: " + node.name + " " + refid);
|
|
|
|
|
- if (refid == "exampleplugin hierarchy context") {
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.hierarchyContextItemClicked = function (node, refid) {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.hierarchyContextItemClicked: " + node.name + " " + refid);
|
|
|
|
|
+ if (refid == "tsexampleplugin hierarchy context") {
|
|
|
this.lastObjectName = "node " + node.name;
|
|
this.lastObjectName = "node " + node.name;
|
|
|
|
|
+ this.showInfobox("Hierarchy Item Selected ", "Node: '" + node.name + "' was selected.");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.projectContextItemClicked = function (asset, refid) {
|
|
|
|
|
- Atomic.print("ExamplePluginService.projectContextItemClicked: " + asset.name + " " + refid);
|
|
|
|
|
- if (refid == "exampleplugin project context") {
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.projectContextItemClicked = function (asset, refid) {
|
|
|
|
|
+ Atomic.print("TSExamplePluginService.projectContextItemClicked: " + asset.name + " " + refid);
|
|
|
|
|
+ if (refid == "tsexampleplugin project context") {
|
|
|
this.lastObjectName = "asset " + asset.name;
|
|
this.lastObjectName = "asset " + asset.name;
|
|
|
|
|
+ this.showInfobox("Project Asset Selected", "Asset: '" + asset.name + "' was selected.");
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
return false;
|
|
return false;
|
|
|
};
|
|
};
|
|
|
- ExamplePluginService.prototype.getWidgets = function () {
|
|
|
|
|
- if (!this.extensionWindow)
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.getWidgets = function () {
|
|
|
|
|
+ if (!this.extensionWindow) {
|
|
|
return;
|
|
return;
|
|
|
|
|
+ }
|
|
|
this.helloLabel = this.extensionWindow.getWidget("example_hello");
|
|
this.helloLabel = this.extensionWindow.getWidget("example_hello");
|
|
|
this.nameField = this.extensionWindow.getWidget("example_name");
|
|
this.nameField = this.extensionWindow.getWidget("example_name");
|
|
|
if (this.lastObjectName) {
|
|
if (this.lastObjectName) {
|
|
@@ -87,8 +93,17 @@ var ExamplePluginService = (function () {
|
|
|
this.lastObjectName = null;
|
|
this.lastObjectName = null;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
- return ExamplePluginService;
|
|
|
|
|
-})();
|
|
|
|
|
-var examplePluginService = new ExamplePluginService();
|
|
|
|
|
|
|
+ TSExamplePluginService.prototype.showInfobox = function (title, msg) {
|
|
|
|
|
+ var infobox = this.serviceLocator.uiServices.showModalWindow(title, InfoboxTBPath, function (ev) {
|
|
|
|
|
+ if (ev.type == Atomic.UI_EVENT_TYPE_CLICK && ev.target.id == "infobox_ok") {
|
|
|
|
|
+ infobox.hide();
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ var msgLabel = infobox.getWidget("infobox_msg");
|
|
|
|
|
+ msgLabel.text = msg;
|
|
|
|
|
+ };
|
|
|
|
|
+ return TSExamplePluginService;
|
|
|
|
|
+}());
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
-exports.default = examplePluginService;
|
|
|
|
|
|
|
+exports.default = new TSExamplePluginService();
|