I have this sort of working, but not as I'd like. It seems that
getControllerForCommand always fails and I can't find a way to access
the goDoCommand (which is dumb). See below for my current
implementation that calls getControllers. Note that I must also pas a
null type of the getMostRecentWindow. I then iterate through all of
the controllers and doCommand for the first one that claims to support
it. There must be an easier and more effective way, but the
documentation for XUL is a mess for the novice and Ubiquity doesn't
seem to have the necessary built-in stuff from the
globalOverlay.js.
Any help would be greatly appreciated!!!
function doTheCommand(cmd) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;
1"]
.getService(Components.interfaces.nsIWindowMediator);
var window = wm.getMostRecentWindow(null);
//var controller;
//
window.document.commandDispatcher.getControllerForCommand(cmd,controller);
var controllers=window.document.commandDispatcher.getControllers();
for(i=0;i<controllers.getControllerCount();i++) {
var controller=controllers.getControllerAt(i);
if(controller.supportsCommand(cmd)) {
controller.doCommand(cmd);
displayMessage(cmd+"run");
break;
}
}
}
function cmd_close() {
doTheCommand("cmd_close");
}
function cmd_closeOtherTabs() {
doTheCommand("cmd_closeOtherTabs");
}
function cmd_closeWindow() {
doTheCommand("cmd_closeWindow");
}
function cmd_copy() {
doTheCommand("cmd_copy");
}
....etc....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ubiquity-firefox" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/ubiquity-firefox?hl=en
-~----------~----~----~----~------~----~------~--~---