| Summary: | [client] can't use Deferred in plugins | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Szymon Brandys <Szymon.Brandys> |
| Component: | Client | Assignee: | Susan McCourt <susan> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | malgorzata.tomczyk |
| Version: | 0.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
This is working for me.
I added a sample deferred command to sampleCommandsPlugin.html. It looks like this:
provider.registerServiceProvider("fileCommands", {
run : function(item) {
var clientDeferred = new dojo.Deferred();
window.setTimeout(function () {
clientDeferred.callback(item.Location);
}, 5000);
return clientDeferred;
}
}, {
image: "/images/gear.gif",
name: "Open HTML in 5 seconds",
id: "sample.commands.sample11",
forceSingleItem: true,
href: true,
validationProperties: {"Name":"*.html"},
tooltip: "Show how a deferred can be used to do asynchronous computation"
});
This command seems to work OK. So the question is...what is different about yours? Maybe there is truly an error happening somewhere in your command.
I added your code to gitPlugin.html and I get Error: Load timeout for plug-in: http://localhost:8080/plugins/gitPlugin.html in the console. So even you code does not work in the gitPlugin. More details from the log: Error: Load timeout for plugin: http://localhost:8080/plugins/gitPlugin.html Error(undefined=""Load timeout for plugi...plugins/gitPlugin.html"") (line 0) _responseHandler(undefined=""onSecurityAlert"", undefined=""OpenAjax.hub.SecurityAlert.LoadTimeout"")pluginregistry.js (line 83) (undefined="[object Object]", undefined=""OpenAjax.hub.SecurityAlert.LoadTimeout"")pluginregistry.js (line 308) _8d(undefined=""OpenAjax.hub.SecurityAlert.LoadTimeout"") The issue here wa "validationProperties: {Name," that I copied and did not notice the error. Finally my code works.
|
gitPlugin.html plugs in actions to the action toolbar in the file navigator. So far it worked well, however there is no way to handle asynchronous calls. For instance: The code below works fine: provider.registerServiceProvider("fileCommands", { run: function(item) { return "/git-log.html#" + item.Git.CommitLocation; } }, { name: "Git Log", id: "eclipse.git.log", tooltip: "Go to Git Log", validationProperties: {"Git":"*"}, href: true, forceSingleItem: true }); It adds Git Log action that opens "/git-log.html#[resource]". However if an asynchronous call is needed in #run, returning Deferred does not work.